Skip to content

Bluetooth auto reconnect service#1029

Open
RowlaxX wants to merge 1 commit into
ChimeraOS:masterfrom
RowlaxX:bluetooth-scan
Open

Bluetooth auto reconnect service#1029
RowlaxX wants to merge 1 commit into
ChimeraOS:masterfrom
RowlaxX:bluetooth-scan

Conversation

@RowlaxX

@RowlaxX RowlaxX commented Oct 9, 2024

Copy link
Copy Markdown

Motivation

Hi, after installing ChimeraOS, I was unable to connect my Xbox Series controller until I navigated to the bluetooth settings. It was very similar to this issue

Investigation

After searching the cause of this problem, it seems that a Bluetooth scan was triggered while navigating to the Gnome Bluetooth Settings, and disabled when leaving that page.

Later, I was able to reconnect my controller by using the command bluetoothctl -t -1 scan on without navigating to the bluetooth settings

Solution

This PR add a simple systemd service that periodically scan for previously connected Bluetooth devices

I am now able to automatically reconnect my controller in the following cases :

  • On startup even before the session is loaded
  • When I unplug & replug my bluetooth dongle
  • When my controller is disconnected due to idle or battery and I press the guide button

Mention

It seems that Bluez allow for periodic scans in the config via ScanIntervalAutoConnect & ScanWindowAutoConnect parameters (link).

This could be a way cleaner solution, but I was unable to make them work.

Hardware & Software

Note

This is my first PR for Chimera so I may not have respected some design & architectural choice

@RowlaxX RowlaxX changed the title Auto bluetooth auto reconnect service Bluetooth auto reconnect service Oct 9, 2024
@alkazar

alkazar commented Oct 16, 2024

Copy link
Copy Markdown
Member

Thanks for the work, but I am a bit confused as to why this is necessary.

If the controller is paired, it should be able to autoconnect without this service.

@RowlaxX

RowlaxX commented Oct 17, 2024

Copy link
Copy Markdown
Author

It appears that Bluez don't support autoconnect for some bluetooth controller unless there is a bluetooth scan occuring. It was the case with the bluetooth dongle mentioned above.

However, I tried to run a fresh chimeraos with another bluetooth dongle (this one) and didn't got any issue

This service is a fix for controllers that need a scan for connecting devices

@alkazar

alkazar commented Oct 17, 2024

Copy link
Copy Markdown
Member

I see, so it is hardware dependent. Thank you.

I am not sure if it is a good idea to be scanning constantly like that. I will have to do some research and think about it.

@kharenis

kharenis commented Dec 31, 2024

Copy link
Copy Markdown

@alkazar Have you had a chance to consider this further? I've had to implement it myself locally to resolve the same issue as there seems to be no other viable solution for me (having to use a keyboard to manually disable/re-enable bluetooth to reconnect the controller everytime quickly fails family UAT). I'm surprised this hasn't been an issue for more people to be honest.
I'm using the built-in bluetooth on the ASRock B550M-ITX/ac motherboard.

I implemented the following;

[Unit]
Description=A service that periodicaly scan & connect for previously connected bluetooth devices
After=bluetooth.service

[Service]
ExecStart=/usr/bin/bluetoothctl -t 3 scan on
Restart=always
RestartSec=15

@RowlaxX

RowlaxX commented Dec 31, 2024

Copy link
Copy Markdown
Author

I bought a pci bluetooth/wifi card and this problem has been resolved for me. It is hardware dependent as far as I can tell.

Maybe a nice compromise could be to add this service for the next release and keeping it disabled by default. We can also add an option to the web UI to enable/disable this service in case some user have this problem.

I can start working on that if needed @alkazar

@kal0ngg

kal0ngg commented Mar 23, 2025

Copy link
Copy Markdown

@RowlaxX can you share which card you bought? Im having bt troubles also (with a fenvi card)

@RowlaxX

RowlaxX commented Mar 23, 2025

Copy link
Copy Markdown
Author

@kal0ngg

kal0ngg commented Mar 23, 2025

Copy link
Copy Markdown

@RowlaxX Bonne soirée et passe un excellent dimanche soir!

@alkazar

alkazar commented Apr 7, 2025

Copy link
Copy Markdown
Member

As a compromise, I was thinking what if we run this service only for the first few minutes after startup?

@kharenis

Copy link
Copy Markdown

That sounds like a good compromise to me. Sadly a PCIe card is out of the question for me as I don't have enough slots.

@arthurlutz

Copy link
Copy Markdown

I think having the service integrated, disabled by default and an option (with a warning about constant scanning) would be a nice work around so that other users don't have to go into the depths of issues/wiki/discord to find a fix for this and supporting existing hardware instead having to buy new hardware is always a good thing.

Would there be a nice privacy-preserving way to report back the bluetooth hardware used so that in the future this could be automatically enabled when certain hardware setups are detected ?

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

Successfully merging this pull request may close these issues.

5 participants