From 96f6bd7fa566532a57a2fb3cc2a0e590c212422c Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 7 Jan 2018 17:39:44 +0100 Subject: [PATCH] input: fixes for joysticks in Linux compatibility mode --- panda/src/device/linuxJoystickDevice.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/panda/src/device/linuxJoystickDevice.cxx b/panda/src/device/linuxJoystickDevice.cxx index 7c62ce2ae5..f510e02f6a 100644 --- a/panda/src/device/linuxJoystickDevice.cxx +++ b/panda/src/device/linuxJoystickDevice.cxx @@ -133,6 +133,8 @@ open_device() { } } else if (handle == GamepadButton::action_a()) { _device_class = DC_gamepad; + } else if (handle == GamepadButton::trigger()) { + _device_class = DC_flight_stick; } else if (handle == GamepadButton::ltrigger()) { _ltrigger_button = i; } else if (handle == GamepadButton::rtrigger()) { @@ -152,17 +154,21 @@ open_device() { switch (axmap[i]) { case ABS_X: if (_device_class == DC_gamepad) { - axis = C_left_x; + axis = InputDevice::C_left_x; + } else if (_device_class == DC_flight_stick) { + axis = InputDevice::C_roll; } else { - axis = C_x; + axis = InputDevice::C_x; } break; case ABS_Y: if (_device_class == DC_gamepad) { - axis = C_left_y; + axis = InputDevice::C_left_y; + } else if (_device_class == DC_flight_stick) { + axis = InputDevice::C_pitch; } else { - axis = C_y; + axis = InputDevice::C_y; } break; @@ -183,7 +189,11 @@ open_device() { break; case ABS_RZ: - axis = C_right_trigger; + if (_device_class == DC_gamepad) { + axis = InputDevice::C_right_trigger; + } else { + axis = InputDevice::C_yaw; + } break; case ABS_THROTTLE: