Skip to content
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

Lakka 3.5 Bluetooth Controllers Refuse to Auto Connect #1528

Closed
PhasecoreX opened this issue Oct 11, 2021 · 19 comments
Closed

Lakka 3.5 Bluetooth Controllers Refuse to Auto Connect #1528

PhasecoreX opened this issue Oct 11, 2021 · 19 comments
Assignees

Comments

@PhasecoreX
Copy link

  • Which version of Lakka are you using?
    • RPi3.aarch64-3.5
  • What system hardware are you using?
    • Raspberry Pi 3B+
  • What did you do?
    • Updated from 3.4 to 3.5, pressed the A button on my WiiU pro controller to turn it on.
  • What did you expect to happen?
    • Expected the controller to connect automatically, as it has always done in versions prior.
  • What happened instead?
    • The controller player LEDs blinks once and doesn't connect.

When running bluetoothctl, every time I turn the controller on (by tapping power/start/A) I see this message pop up:

[CHG] Device 40:F5:07:D8:E3:2B Connected: no

So it seems like the controller is connecting to the Pi, then whatever is running on the Pi that would accept the connection just doesn't work, and then the controller turns off. If I have the Pi turned off, turning the controller causes the player LEDs to blink for 30 seconds, as it is searching for the Pi to connect to. That leads me to believe something on the Pi is actively refusing the connection for some reason (and causing that log message above).

From both bluetoothctl as well as Lakkas bluetooth menu, I can manually connect to the controller. With bluetoothctl, simply using the connect <mac_address>, and then turning the controller on while it's attempting to connect allows the controller to connect successfully. With the Lakka bluetooth menu, I need to select the controller, and then press the pairing button on the controller. So I am still able to use them, just that it's pretty inconvenient (since I need a keyboard to actually get to that menu).

Looking in /storage/.cache/bluetooth/B8:57:AB:61:C3:5C, I see my four controller MAC addresses as 4 folders. The info file in each shows them as Trusted and not Blocked. They worked for 3.4, haven't touched them since (or ever).

Any help with this would be greatly appreciated! And if you need any other info let me know.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 11, 2021

This might be due to the added driver for Xbox Wireless gamepads (xpadneo) - you can disable this driver by:

echo "blacklist xpadneo" > /storage/.config/modprobe.d/blacklist-xpadneo.conf

Please, let us know if this solves your issue.

@PhasecoreX
Copy link
Author

This did not solve the issue. I ran the above command and rebooted the Pi, however the same behavior is happening with the controllers.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 11, 2021

Did you pair the controller with a different OS/device prior to connecting again to Lakka? If so, you have to re-pair. To remove the pairing in Lakka navigate to settings - Bluetooth - mark the device you want to un-pair, press start/space, restart RetroArch and pair again.

@PhasecoreX
Copy link
Author

I have not paired these controllers with any other device, they have exclusively been used with this Raspberry Pi.

However I have removed them all from Lakka with the space bar as you mentioned, restarted Lakka, and then paired one of the controllers. Upon rebooting, it again would not automatically connect. The same observations in my original post are still present (one LED blink, bluetoothctl log message, etc).

I even went and removed the entire /storage/.cache/bluetooth folder, rebooted, and paired a controller. Upon rebooting again, still doesn't auto connect.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 15, 2021

Do you connect the gamepad using command line (bluetoothctl) or the SettingsBluetooth menu? Is the service enabled in SettingsServicesBluetooth?

@PhasecoreX
Copy link
Author

Bluetooth service is enabled. For pairing the controller, I used the Lakka Bluetooth menu. Using the menu, I can pair the controller and it immediately connects after the pairing process. However once the controller is turned off and then back on, the controller will not automatically connect.

I did just now try the bluetoothctl method of pairing the controller and then trusting it. But when I turn the controller on, it again will not automatically connect. Same message as before in the log:

[CHG] Device 40:F5:07:D8:E3:2B Connected: no

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 16, 2021

To rule out / isolate the issue, can you, please, roll back to 3.4 and confirm, this issue is not present? Thank you!

@PhasecoreX
Copy link
Author

I have downgraded to RPi3.aarch64-3.4, paired a controller with the Lakka bluetooth menu, rebooted the Pi, and upon turning on the controller it connects successfully! I paired my other 3 controllers and they all connect automatically as well.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 16, 2021

thank you, I will try to find a fix, maybe it is really related to the xpadneo driver, maybe not...

@ToKe79 ToKe79 self-assigned this Oct 16, 2021
@jdalmanza
Copy link

Same issue on pi4 upgraded from 3.4 to 3.5.1
Also using the WiiU Pro Controller -- configured via GUI and not paired to any other devices other than this pi4 since lakka v3.0

please let me know if you need any logs.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 22, 2021

I checked the commit history but did not find anything that would relate to bluetooth / Wii controllers - besides the added xpadneo bluetooth driver. So to confirm/rule this out, I created an image without the driver for RPi3 and RPi4 (aarch64 both).
https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/
There is a kernel patch related to the xpadneo driver that should avoid hid-generic claiming two VID-PID, but it can be also the kernel update itself that is causing the issue.

EDIT: The images are based on master + revert of the commit that added xpadneo driver. Please, test with this image, as I don't have the appropriate hardware. Thanks!

@PhasecoreX
Copy link
Author

I used the Lakka-RPi3.aarch64-3.5-devel-20211022210729-71d62cd.img.gz to upgrade my Lakka from 3.4, and the controllers still work correctly! So it must be something with that xpadneo commit messing with the bluetooth connections.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 23, 2021

Can you make another test with updated image - now I omitted only the kernel patch, but kept the xpadneo driver.
Thank you!
https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/only_patches_omitted/

@PhasecoreX
Copy link
Author

I have upgraded to your Lakka-RPi3.aarch64-3.5-devel-20211023124955-abb4718.img.gz and the controllers no longer connect automatically.

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 23, 2021

and adding

echo "blacklist xpadneo" > /storage/.config/modprobe.d/blacklist-xpadneo.conf

does not really solve the issue?

if you could provide output of lsmod (I'm not sure if the module name is xpadneo or hid_xpadneo).
and for xpadneo we also do options bluetooth disable_ertm=1, so maybe try adding options bluetooth disable_ertm=0.
on the image look at:
/usr/lib/modprobe.d/xpadneo.conf
/usr/lib/udev/rules.d/60-xpadneo.rules
for any conflicting entries.

To exclude those udev-rules and modprobe entries I created new image without the above two files. If this would be the case, we could still include the driver and navigate the users to add custom udev-rules / modprobe configuration via /storage/.config.

If you could make another test with below image, it will be appreciated.
https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/removed_patches_and_rules/

@PhasecoreX
Copy link
Author

Testing Lakka-RPi3.aarch64-3.5-devel-20211023193241-abb4718.img.gz from the latest link https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/removed_patches_and_rules/ does fix it again so the controllers auto connect correctly.

I am confused by your other comments, do you want me to do that blacklisting xpadneo and the lsmod stuff on the released 3.5.1 image, or the one located at https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/only_patches_omitted/ ? Or was the latest image you built sufficient enough?

@PhasecoreX
Copy link
Author

I took the /usr/lib/modprobe.d/xpadneo.conf and /usr/lib/udev/rules.d/60-xpadneo.rules files from the official release and copied them to /storage/.config/modprobe.d/ and /storage/.config/udev.rules.d respectively. Then I upgraded to the Lakka-RPi3.aarch64-3.5-devel-20211023193241-abb4718.img.gz from the latest link https://nightly.builds.lakka.tv/members/vudiq/rpi3-4_no_xpadneo/removed_patches_and_rules/.

When it booted up after the upgrade, the controllers did not connect automatically, as I would expect. I simply changed the options bluetooth disable_ertm=1 to options bluetooth disable_ertm=0 (and nothing else) in the /storage/.config/modprobe.d/xpadneo.conf file that I copied over, and after a reboot, the controllers connect automatically.

So it seems like it's this line messing it up: options bluetooth disable_ertm=1

@ToKe79
Copy link
Collaborator

ToKe79 commented Oct 24, 2021

thank you for your testing, I will remove the offending line from image/package, users can still add it via

echo options bluetooth disable_ertm=1 > /storage/.config/modprobe.d/disable_ertm.conf

@ToKe79 ToKe79 closed this as completed in 188e970 Oct 24, 2021
ToKe79 added a commit that referenced this issue Oct 25, 2021
as it causes connection issues with different gamepads, it is safer to
remove it and the user can add this on need basis via

```
echo options bluetooth disable_ertm=1 > /storage/.config/modprobe.d/disable_ertm.conf
```

fixes #1528
ToKe79 added a commit to ToKe79/Lakka-LibreELEC that referenced this issue Oct 26, 2021
as it causes connection issues with different gamepads, it is safer to
remove it and the user can add this on need basis via

```
echo options bluetooth disable_ertm=1 > /storage/.config/modprobe.d/disable_ertm.conf
```

fixes libretro#1528
@ToKe79
Copy link
Collaborator

ToKe79 commented Nov 1, 2021

On a side note - I had similar issue today on RPi400. I looked at the folders and noticed that the /storage/.cache folder and subfolders had weird owner - uid 1023 (no such uid in Lakka). Then I recalled that I had the drive connected to my Android TV box (I was copying over files) which might have messed up the ownership. After fixing the ownership (chown root:root .cache -R) pairing started working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants