atar-axis / xpadneo

Advanced Linux Driver for Xbox One Wireless Controller (shipped with Xbox One S)
https://atar-axis.github.io/xpadneo/
GNU General Public License v3.0
1.87k stars 110 forks source link

Xbox Wireless Controller is seen as Xbox 360 controller and cannot use share button #423

Open elirasza opened 1 year ago

elirasza commented 1 year ago

Version of xpadneo

0.9.5

Controller Model

Connection mode

Installed Software

Protocol Information

Please help us identify at which layer the problem can be found if you want to report mapping errors or if the controller fails to be detected:

Please describe how it is failing below in the next sections.

Severity / Impact

Describe the Bug

My Xbox Series X|S, connected to my computer with a Bluetooth dongle, works perfectly. With your module, I was even able to get back the rumble feature I lost by switching to Linux. However, I still have two problems which I think are linked:

Steps to Reproduce

Connect the controller, go in xboxdrv or Steam controller settings. Exit, try to use the Share button in showkey.

Expected Behavior

The module should expose the controller as a Xbox X|S controller.

Screenshots / GIFs / Videos

Screenshot_20230503_182020

Screenshot_20230503_182116

System Information

# uname -a
Linux stagcrown 6.2.13-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 26 Apr 2023 20:50:14 +0000 x86_64 GNU/Linux
# xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum)
00000000: 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff  .............0.1..'.
00000014: ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00  .....u.........3.4..
00000028: 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff  '......u.......2..&.
0000003c: 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09  ...u.....%.u........
00000050: 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01  5..&....u.....%.u...
00000064: 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04  .....9..%.5.F;.f..u.
00000078: 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03  ...Bu.....%.5.E.e...
0000008c: 05 09 19 01 29 0c 15 00 25 01 75 01 95 0c 81 02 15 00 25 00  ....)...%.u.......%.
000000a0: 75 01 95 04 81 03 05 0c 0a b2 00 15 00 25 01 95 01 75 01 81  u............%...u..
000000b4: 02 15 00 25 00 75 07 95 01 81 03 05 0f 09 21 85 03 a1 02 09  ...%.u........!.....
000000c8: 97 15 00 25 01 75 04 95 01 91 02 15 00 25 00 75 04 95 01 91  ...%.u.......%.u....
000000dc: 03 09 70 15 00 25 64 75 08 95 04 91 02 09 50 66 01 10 55 0e  ..p..%du......Pf..U.
000000f0: 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 00 26 ff 00 75 08  ..&..u.........&..u.
00000104: 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 00 75 08 95 01 91  ....e.U..|..&..u....
00000118: 02 c0 c0                                                     ...
2986910699 1363

Controller and Bluetooth Information

xpadneo-btmon.txt xpadneo-dmesg.txt xpadneo-lsusb.txt

Additional Context

Thank you for your awesome work ! I did not try to listen to the Share button input manually via some C++ code but I think there should be an easier way. I saw in the doc this specific button was bound to the KEY_RECORD keyboard input, but cannot find a way to get to it.

kakra commented 1 year ago

Current xpadneo is not compatible with Steam Input, you should disable Xbox controller support in Steam. That being said, the documentation is wrong about this, I forgot to change it: It currently maps to a BTN_TRIGGER_HAPPY1 in the 0.9 branch, and it maps to KEY_F12 in the development branch. KEY_RECORD never worked and could not be seen by applications.

Steam Input doesn't expect to see more than 10 buttons (or 11 buttons if you count the Guide button) from an Xbox controller, thus it won't see the button.

Thanks for pointing it out, I'll update the documentation. Future version will be made compatible with Steam Input but I'm not sure if it lands in v0.10 or v0.11. If you play Steam games exclusively, you might want to use hid-microsoft (part of the kernel) with Steam Input instead of xpadneo but you may need to disable rumble to not crash the controller firmware then.

elirasza commented 1 year ago

Thank you very much for your answer ! Changing the binding to KEY_F12 is smart as it is the default shortcut for a screenshot in Steam ; and hearing that a full support could exist in the future is heartwarming. Making "short press to screenshot" and "long press to clip" on Linux thanks to it would be really nice.

Moreover, would there be any chance to be able to customize what the share key binds to in the future, in a configuration file for instance ? Does it have to be hardcoded ? Or is it just not your priority / goal ?

kakra commented 1 year ago

Changing the binding to KEY_F12 is smart as it is the default shortcut for a screenshot in Steam

Yes, that was the idea behind that change for upcoming v0.10.

and hearing that a full support could exist in the future is heartwarming.

User-space has matured enough compared to when the "modern" Bluetooth controllers came out that xpadneo should stop doing tricks to bypass SDL while making jsdev happy at the same time. SDL completely detects all models now and supports runtime loading of newer versions into old binary-only software, Proton has gained full support, wine has learned to handle the device, most user-space ships with fixes to work around rumble-introduced firmware crashes... Yes, I think it's time.

Making "short press to screenshot" and "long press to clip" on Linux thanks to it would be really nice.

This actually was the idea behind using KEY_RECORD but except for some very rare exceptions, most user-space completely ignores this event, probably because it needs to be sent via consumer-control devices - which is not a keyboard and thus invisible to most desktop apps.

Moreover, would there be any chance to be able to customize what the share key binds to in the future, in a configuration file for instance ? Does it have to be hardcoded ? Or is it just not your priority / goal ?

It will be configurable, probably coming with a sysfs interface and a small rust-based tool to remember your controller mappings and load them back when the controller is re-connected, and maybe some GUI to do that stuff and switch presets. But most of this will be handled after v0.10 which is supposed to lay the ground-work for customizations. At that point, xpadneo will probably move over to a completely new project incorporating multiple tools as sub-projects, leaving the atar-axis repository as an archive. As the maintainer of this project (but not owner) I do not have full control over the repository which complicates some things like using CI pipelines, atar-axis stopped developing xpadneo some years ago and handed it over to me.

elirasza commented 1 year ago

Thank you very much for your work and for your insight ! It is very instructive. It's been ages since I developed in C++ / low-level programming, as I'm more in web nowadays, but maybe I could help in the near future.

For now, I will stick with this repo version and the F12_KEY, as it already suits my needs. Thanks again !