Bluetooth autoconnect on boot needs a reimplementation
Description
Environment
Activity

Scott Murray March 7, 2022 at 7:59 PM
To update, was correct; I for some reason thought that connman's technology stuff around Bluetooth was purely for networking, but it does go in and override the rfkill behavior. Which is maybe less than ideal in a system where systemd-rfkill is also inherently present, since it renders that mechanism effectively unusable, and the only workable option is to indeed drive it via connman. I have pushed a change to the settings app for now to try enabling Bluetooth when the app is started, which isn't an exact reproduction of the old behavior wrt the rfkill state, but since connman will persist the state, on subsequent boots it will be enabled by default. Automatic device connection is still dependent on the code leveraged from the old binding and tied to the settings app startup. It's possible that some devices will manage to auto-connect without that, but at least with the devices I test with that didn't seem to be the case, so we'll definitely need to investigate further post-13.0.0 and discuss device management (and perhaps weigh going back to something in the vein of agl-service-bluetooth once there's some evidence we can build and maintain APIs with grpc). I'm inclined to keep this issue open to track the need for more work on this in the future, but if there's an argument for resolving it, please comment.

Scott Murray February 8, 2022 at 9:48 PM
connman doesn't drive the base Bluetooth connection AFAIK, it only comes into play when you want to do PAN. When I asked Matt Ranostay about the code in agl-service-bluetooth, and then did some research myself, the reason we need this is that in a perfect world the target device (e.g. phone) would be autoconnecting, but in practice it proved not particularly reliable/quick. As far as Matt and myself could find BlueZ itself has no provision for it. One wrinkle for us in Marlin is that with the handling moved out into the apps, as opposed to a long-running daemon they communicate with, some thought will be required with respect to how to manage someone starting up the Settings app if an autoconnect helper is still running. It's hard to see how to avoid potential conflict issues without some form of IPC.

Vasyl Vavrychuk February 8, 2022 at 8:26 PM
Shouldn't connman be responsible for that?
Details
Details
Assignee

Reporter

Automatically reconnecting to a previously paired Bluetooth device, as well as ensuring the BT adapter is not blocked by rfkill on boot was previously implemented in the agl-service-bluetooth app framework binding. Since it does not give a good user experience to wait until the settings app is started to do this, we need some form of replacement. Current thinking is perhaps a small program/daemon that leverages the new split out bluez-glib library.