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 111 forks source link

Xbox Controller still shown as connected after disconnecting #475

Open OffApparition opened 1 month ago

OffApparition commented 1 month ago

Version of xpadneo

xpadneo-dkms 0.9.6-1

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

After disconnecting my Xbox Controller, my system still shows that the controller is connected. Steam will show controller support for my Xbox Controller on game pages (it does not do that when no controller is connected). Furthermore, I can see the controller under System Settings > Game Controller (on KDE). It shows my Xbox Controller (/dev/input/event22). When running the following command after disconnecting the controller

# lsmod | grep hid_xpadneo
hid_xpadneo            40960  0
ff_memless             20480  1 hid_xpadneo

I can still see xpadneo even though no controller is connected.

This messes up other controller inputs, e.g. when connecting my PS4 controller after the Xbox controller was disconnected. Input will behave in a weird manner. Buttons will be sent constantly pressed and the input of the other controller will be drowned by constant input being sent from the already disconnected controller.

Steps to Reproduce

  1. Connect Xbox Controller
  2. Disconnect Xbox Controller
  3. Controller is still shown

Expected Behavior

Controller should not be shown anymore.

Screenshots / GIFs / Videos

The controller was not connect to the computer while these screenshots were taken. image image

Usually in the System Settings there is no entry (when booting the system before connecting the Xbox controller) and Steam does not show any controller support information.

System Information

# uname -a
Linux spectra 6.9.1-zen1-2-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 22 May 2024 13:47:12 +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

Additional Context

kakra commented 1 month ago

This is a new behavior of bluez that it no longer destroy input device of disconnected endpoints, and reuses the same input device node if the endpoint reconnects. You can disable this behavior in the bluez config.

And yes, it messes up Steam games if you switch controllers because many Windows games often only look at the first controller.

I'm leaving this open so we can document this behavior. I currently can't recall where I found the info about that change, it was in one of the commits to bluez, pointing to a hidden configuration variable you can set.