New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Xbox Series X controller bluetooth profile #5406
Conversation
|
The kernel patch might be dicey if you're breaking other userspace applications that expect the old mapping. What happens without the patch? |
The axes are mapped incorrectly currently from a Linux point of view. The driver could in theory have a module option to retain the old behaviour but that does not sound ideal either. I can't really test the difference here for the existing binding, do you know why the guid is different? |
Can you elaborate? Which axes? What is your expected mapping vs the actual mapping?
It looks like that's the SDL/src/joystick/linux/SDL_sysjoystick.c Lines 236 to 247 in dfbe1f7
What firmware version is your controller running? |
The right trigger is mapped to ABS_GAS which is for flight sim joysticks The right joystick is mapped to ABS_Z/RZ while it should be the right X/Y axes. The kernel driver corrects this. So without my kernel driver and profile, SDL maps the right trigger to the right joystick's Y axis: The left trigger is mapped to the right trigger and the right joystick axes are also incorect. |
Using I don't think it's a good idea to try to artificially change that. It creates a scenario where certain kernels will have one mapping and other kernels will have a different mapping, causing havoc for userspace. Consider SDL itself, where the mapping GUID for patched and non-patched kernels would be identical, and we couldn't tell which mapping to use. It also risks causing behavior to change unexpectedly when Microsoft releases a new firmware (if the fixup is only done for certain firmware versions), or potentially interfering with legitimate HID descriptor changes (if the fixup is done for all firmware versions).
We can probably improve SDL's heuristic in |
Yep, that's a great idea. |
|
It would be useful to add test data for this Xbox Series X controller using an unpatched kernel (in Bluetooth mode, and also in USB mode if different) to The easiest thing to convert into Another thing that can be useful when investigating new controllers is the ~/.steam/root/ubuntu12_32/steam-runtime/run.sh steam-runtime-input-monitor with this device not connected, and wait for it to finish describing all your other devices (it should say |
This heuristic for gamepads without a more specific mapping already tried two incompatible conventions for handling triggers: the Linux Gamepad Specification uses hat switch 2 for the triggers (for whatever reason), but the de facto standard set by the drivers for older Xbox and Playstation controllers represents each trigger as the Z-axis of the nearest analog stick. Android documentation encourages Bluetooth gamepad manufacturers to use a third incompatible convention where the left and right triggers are represented as the brake and gas pedals of a driving simulator controller. The Android convention also changes the representation of the right stick: instead of using X and Y rotation as a second pair of axes, Android uses Z position as a second horizontal axis, and Z rotation as a second vertical axis. Try to cope gracefully with all of these. This will hopefully resolve the issue described in libsdl-org#5406 (when using unpatched kernels). Signed-off-by: Simon McVittie <smcv@collabora.com>
#7791 added test data for a "Microsoft Xbox Series S|X Controller model 1914" which is a slightly different device: the one my colleague examined is reported as product 0b12 version 050f via USB or version 0515 via Bluetooth, while @jelly's is reported as product 0b13 version 0509 via Bluetooth (and an unknown product/version via USB). My colleague's device has different input mappings via USB and Bluetooth. Via USB, it has the typical Xbox-360-style axes (X, Y, Z, RX, RY, RZ), which are presumably X/Y for the left stick, RX/RY for the right stick, Z for the left trigger and RZ for the right trigger, but via Bluetooth, it has X, Y, Z, RZ, GAS and BRAKE, which are presumably the Android-style layout that @cgutman describes. @jelly's comments suggest that the same could be true for their controller. It would be useful to confirm that via
I think that would be a better solution than merging this PR, particularly if this PR requires a patched kernel. I've proposed #7797. |
This heuristic for gamepads without a more specific mapping already tried two incompatible conventions for handling triggers: the Linux Gamepad Specification uses hat switch 2 for the triggers (for whatever reason), but the de facto standard set by the drivers for older Xbox and Playstation controllers represents each trigger as the Z-axis of the nearest analog stick. Android documentation encourages Bluetooth gamepad manufacturers to use a third incompatible convention where the left and right triggers are represented as the brake and gas pedals of a driving simulator controller. The Android convention also changes the representation of the right stick: instead of using X and Y rotation as a second pair of axes, Android uses Z position as a second horizontal axis, and Z rotation as a second vertical axis. Try to cope gracefully with all of these. This will hopefully resolve the issue described in #5406 (when using unpatched kernels). Signed-off-by: Simon McVittie <smcv@collabora.com>
|
Fixed by #7797 |
This heuristic for gamepads without a more specific mapping already tried two incompatible conventions for handling triggers: the Linux Gamepad Specification uses hat switch 2 for the triggers (for whatever reason), but the de facto standard set by the drivers for older Xbox and Playstation controllers represents each trigger as the Z-axis of the nearest analog stick. Android documentation encourages Bluetooth gamepad manufacturers to use a third incompatible convention where the left and right triggers are represented as the brake and gas pedals of a driving simulator controller. The Android convention also changes the representation of the right stick: instead of using X and Y rotation as a second pair of axes, Android uses Z position as a second horizontal axis, and Z rotation as a second vertical axis. Try to cope gracefully with all of these. This will hopefully resolve the issue described in #5406 (when using unpatched kernels). Signed-off-by: Simon McVittie <smcv@collabora.com> (cherry picked from commit cf1dc66)

My Xbox Series X controller has a different guid then the existsing SDL entry which means the buttons are mappend wrong.
Description
My Xbox series X controller runs the latest firmware and the only difference is the last part of the guid:
Existing entry's guid: 050000005e040000130b000011050000
My guid: 050000005e040000130b000009050000
This mapping requires a kernel patch to be applied as well as it fixes the mapping of some axes so they are correctly displayed in evemu-record. I haven't sent the patch upstream yet as it most likely will break the existing SDL entry and I would love to figure out what the difference is between the existing and my guid.