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, via Bluetooth, disconnects/reconnects once, but only after fresh boot/wake from sleep. #424

Closed benkei-kuruma closed 1 year ago

benkei-kuruma commented 1 year ago

Version of xpadneo

0.9.5-2 (installed from copr)

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

Upon fresh boot, or after resuming from sleep, after connecting my Xbox Wireless Controller via Bluetooth, the controller will disconnect after about 30 seconds, then immediately reconnect. I'm trying to figure out why it is doing this.

Steps to Reproduce

  1. Boot into OS, or wake the PC from sleep.
  2. Connect Xbox Wireless Controller via Bluetooth.
  3. Wait ~30 seconds.

Expected Behavior

The controller shouldn't disconnect. Note that if I log out, or restart the computer, this doesn't happen.

  1. I have the same OS and Bluetooth/WiFi card installed on three different systems, but only one of them (mine unfortunately) has this problem.
  2. On the same system, this problem does not occur in Windows 11.

Screenshots / GIFs / Videos

System Information

# uname -a

6.2.14-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 1 00:55:28 UTC 2023 x86_64 GNU/Linux

I'm running Fedora Silverblue 38 if it matters.

# xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum)

I ran this in a toolbox since xxd is not installed normally on Silverblue. Here's the output:

xxd: /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor: No such file or directory 4294967295 0

Controller and Bluetooth Information

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

Additional Context

I'm 99.99% certain this is a hardware-related issue. It also doesn't seem to matter if I use xpadneo or not, it'll happen regardless. I figured I'd post here anyway, since this is the only place I could find dedicated to using this specific controller on Linux.

I'm wondering if it's just a matter of the kernel interacting with my CPU? I don't recall it happening "several kernels ago", if that makes sense. And it only happens with this controller; no other Bluetooth devices experience this issue.

If it helps, here are my system specs:

image

kakra commented 1 year ago

Actually, xpadneo is not a Bluetooth driver so it has absolutely no responsibility. The layer above xpadneo is HID, and HID in turn is provided by the Bluetooth layer. So your problem is really with the Bluetooth drivers of the system.

xxd: /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor: No such file or directory 4294967295 0

This needs the xpadneo driver loaded and bound to the HID subsystem. Otherwise it won't work. It might work if you replace hid:xpadneo with *. But this information is unimportant anyways for your problem.

The 30 seconds interval indicates that the Bluetooth subsystem does not fully establish the connection, eventually it runs into a timeout, then tries to reconnect. If it works this second time, I suspect there might be a race condition within the protocol handshake. This issue should be inspected by the Bluetooth team of the kernel.

> HCI Event: Disconnect Complete (0x05) plen 4            #152 [hci0] 64.953775
        Status: Success (0x00)
        Handle: 3585 Address: 3C:FA:06:40:CD:A6 (Microsoft Corporation)
        Reason: Remote User Terminated Connection (0x13)

It looks like the firmware is actively disconnecting, it's probably missing parts of the handshake. This is usually due to bluez not being able to complete the full handshake.

[  122.902531] xpadneo 0005:045E:0B13.0006: BLE firmware version 5.15

This firmware version is supposed to work correctly for most Bluetooth chipsets.

= Index Info: 78:2B:46:50:08:E7 (Intel Corp.)                   [hci0] 0.197871

But from the reports I'm seeing the Intel chipsets still seem to have problems especially with some devices. From personal experience, I can confirm that Intel chipsets are even problematic with Xbox controllers in Windows - so this may be something that cannot be fixed by Bluetooth drivers or bluez updates alone, we may need to wait for another Xbox controller firmware update.

If there are no other issues like intermittent disconnects, you could try living with this 30 seconds delay until it becomes fixed at some time in the future. Otherwise, I'd recommend to go with a genuine (aka "not China clone") version of the CSR chipset which many known-brand USB dongles use and place it at the top/front of your PC case or above your computer desk, and disable the integrated Intel Bluetooth function.

benkei-kuruma commented 1 year ago

Thanks a million for all of the work you do. Also thanks for replying to my post with such in-depth info.

I've decided to just upgrade my WiFi/Bluetooth card, since I'd rather not deal with any of these issues at all. I'm going to try an Intel AX210 and see how that goes. I'll report here just to keep the records for anyone that is having similar issues.

Edit: Just an update. As mentioned above, I simply replaced my WiFi/Bluetooth card with an Intel AX210, and I'm no longer experiencing any disconnection issues. So kakra was right on point in his suggestion.

kakra commented 1 year ago

So we have one more confirmation that AX210 is working now. Which kernel version are you running? (uname -a)

thiccaxe commented 11 months ago

Can confirm that AX210 is working on Linux thcwrk 6.3.12-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 6 04:05:18 UTC 2023 x86_64 GNU/Linux tested on SuperTuxKart.

latest firmware on the "Series" controller.