Remove newlines from log messages

This commit is contained in:
nightmareci
2025-01-22 12:59:57 -08:00
committed by Sam Lantinga
parent 17625e20df
commit 718034f5fa
123 changed files with 1143 additions and 1118 deletions

View File

@@ -327,7 +327,7 @@ static bool IsJoystick(const char *path, int *fd, char **name_return, Uint16 *ve
FixupDeviceInfoForMapping(*fd, &inpid);
#ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
#endif
if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) {
@@ -470,12 +470,12 @@ static void MaybeAddDevice(const char *path)
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Checking %s\n", path);
SDL_Log("Checking %s", path);
#endif
if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found joystick: %s\n", path);
SDL_Log("found joystick: %s", path);
#endif
item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item));
if (!item) {
@@ -516,7 +516,7 @@ static void MaybeAddDevice(const char *path)
if (IsSensor(path, &fd)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found sensor: %s\n", path);
SDL_Log("found sensor: %s", path);
#endif
item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item));
if (!item_sensor) {
@@ -1217,7 +1217,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true;
@@ -1227,7 +1227,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < BTN_JOYSTICK; ++i) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true;
@@ -1250,14 +1250,14 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
const int hat_index = (i - ABS_HAT0X) / 2;
struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index);
SDL_Log("Joystick has digital hat: #%d", hat_index);
if (hat_x >= 0) {
SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum,
absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution);
}
if (hat_y >= 0) {
SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum,
absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution);
}
@@ -1285,8 +1285,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
continue;
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has absolute axis: 0x%.2x", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1340,7 +1340,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < key_pam_size; ++i) {
Uint16 code = joystick->hwdata->key_pam[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", code);
SDL_Log("Joystick has button: 0x%x", code);
#endif
joystick->hwdata->key_map[code] = joystick->nbuttons;
joystick->hwdata->has_key[code] = true;
@@ -1366,7 +1366,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
int hat_index = (code - ABS_HAT0X) / 2;
if (!joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index);
SDL_Log("Joystick has digital hat: #%d", hat_index);
#endif
joystick->hwdata->hats_indices[hat_index] = joystick->nhats++;
joystick->hwdata->has_hat[hat_index] = true;
@@ -1377,7 +1377,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
} else {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", code);
SDL_Log("Joystick has absolute axis: 0x%.2x", code);
#endif
joystick->hwdata->abs_map[code] = joystick->naxes;
joystick->hwdata->has_abs[code] = true;
@@ -1398,8 +1398,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
joystick->hwdata->accelerometer_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has accelerometer axis: 0x%.2x", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1416,8 +1416,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
joystick->hwdata->gyro_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has gyro axis: 0x%.2x", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1522,7 +1522,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
}
close(fd_item);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick UNIQ: %s\n", uniq_item);
SDL_Log("Joystick UNIQ: %s", uniq_item);
#endif // DEBUG_INPUT_EVENTS
for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) {
@@ -1544,7 +1544,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
}
close(fd_sensor);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Sensor UNIQ: %s\n", uniq_sensor);
SDL_Log("Sensor UNIQ: %s", uniq_sensor);
#endif // DEBUG_INPUT_EVENTS
if (SDL_strcmp(uniq_item, uniq_sensor) == 0) {
@@ -1800,7 +1800,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
absinfo.value = AxisCorrect(joystick, i, absinfo.value);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Axis %d (%d) val= %d\n",
SDL_Log("Joystick : Re-read Axis %d (%d) val= %d",
joystick->hwdata->abs_map[i], i, absinfo.value);
#endif
SDL_SendJoystickAxis(timestamp, joystick,
@@ -1831,7 +1831,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
if (joystick->hwdata->has_key[i]) {
bool down = test_bit(i, keyinfo);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Button %d (%d) val= %d\n",
SDL_Log("Joystick : Re-read Button %d (%d) val= %d",
joystick->hwdata->key_map[i], i, down);
#endif
SDL_SendJoystickButton(timestamp, joystick,
@@ -1858,7 +1858,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) {
data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f\n", i, data[i]);
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f", i, data[i]);
#endif
}
}
@@ -1870,7 +1870,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f\n", i, data[i]);
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f", i, data[i]);
#endif
}
}
@@ -1913,7 +1913,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (event->type) {
case EV_KEY:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Key 0x%.2x %s\n", code, event->value ? "PRESSED" : "RELEASED");
SDL_Log("Key 0x%.2x %s", code, event->value ? "PRESSED" : "RELEASED");
#endif
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
joystick->hwdata->key_map[code],
@@ -1932,7 +1932,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
hat_index = (code - ABS_HAT0X) / 2;
if (joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
break;
@@ -1940,7 +1940,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
SDL_FALLTHROUGH;
default:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
event->value = AxisCorrect(joystick, code, event->value);
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
@@ -1964,7 +1964,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped = true;
break;
@@ -2047,7 +2047,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped_sensor = true;
break;