mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-27 10:57:22 +08:00
Added additional debug logging for Linux joysticks
This commit is contained in:
@@ -1810,6 +1810,9 @@ static void HandleInputEvents(SDL_Joystick *joystick)
|
|||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case EV_KEY:
|
case EV_KEY:
|
||||||
|
#ifdef DEBUG_INPUT_EVENTS
|
||||||
|
SDL_Log("Key 0x%.2x %s\n", code, event->value ? "PRESSED" : "RELEASED");
|
||||||
|
#endif
|
||||||
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
|
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
|
||||||
joystick->hwdata->key_map[code],
|
joystick->hwdata->key_map[code],
|
||||||
event->value);
|
event->value);
|
||||||
@@ -1826,11 +1829,17 @@ static void HandleInputEvents(SDL_Joystick *joystick)
|
|||||||
case ABS_HAT3Y:
|
case ABS_HAT3Y:
|
||||||
hat_index = (code - ABS_HAT0X) / 2;
|
hat_index = (code - ABS_HAT0X) / 2;
|
||||||
if (joystick->hwdata->has_hat[hat_index]) {
|
if (joystick->hwdata->has_hat[hat_index]) {
|
||||||
|
#ifdef DEBUG_INPUT_EVENTS
|
||||||
|
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
|
||||||
|
#endif
|
||||||
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
|
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
|
#ifdef DEBUG_INPUT_EVENTS
|
||||||
|
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
|
||||||
|
#endif
|
||||||
event->value = AxisCorrect(joystick, code, event->value);
|
event->value = AxisCorrect(joystick, code, event->value);
|
||||||
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
|
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
|
||||||
joystick->hwdata->abs_map[code],
|
joystick->hwdata->abs_map[code],
|
||||||
|
|||||||
Reference in New Issue
Block a user