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

autopair legacy devices #2178

Open
cschramm opened this issue Oct 27, 2023 · 2 comments
Open

autopair legacy devices #2178

cschramm opened this issue Oct 27, 2023 · 2 comments
Milestone

Comments

@cschramm
Copy link
Member

Follow-up to #2167

It turns out that BlueZ' autopair does not really make a PIN database obsolete, opposed to what I assumed in #1614.

When BlueZ receives a PIN code request, it invokes callbacks to find one only if the pairing got initiated locally. That is the case if a blueman user uses "Pair". If "Connect" is used to connect to an unpaired device, the pairing is actually triggered by an incoming HCI event so that the autopair plugin does not get used.

The reason for that is security. When BlueZ determines a PIN to use, instead of RequestPinCode it invokes DisplayPinCode if the user needs to know it or even just uses the code if its a fixed one. If it would do that on incoming pairing requests, it would automatically accept the initiating devices (not a problem for a random PIN code for a keyboard as the device does not know it, but a huge problem if a fixed PIN code like 0000 is chosen).

gnome-bluetooth adds another layer of default PINs on top that seems completely redundant for outgoing pairing requests but also works for incoming ones. BlueZ always forwards PIN code requests for incoming ones with RequestPinCode and gnome-bluetooth tries to find a match in its database no matter which side initiated the pairing. Instead of just responding to BlueZ' request with the determined code, it first awaits user confirmation on remote initiated pairing attempts.

I filed bluez/bluez#637 for discussion as I'd love to see this getting improved on the bluetoothd layer (otherwise the autopair plugins seems rather useless), but the other option is to (re-)implement a proper autopair solution in blueman...

@cschramm cschramm added this to the 2.5 milestone Oct 29, 2023
@cschramm cschramm modified the milestones: 2.5, 2.4 Dec 14, 2023
@infirit
Copy link
Contributor

infirit commented Dec 20, 2023

Yesterday I checked how plasma/bluedevil handles this. Remote pairing is the same as blueman, the user is prompted to provide a pin. When it's initiated locally thought their wizard it does a local pair so the pin is provided by the plugin. The difference is we allow users to connect to unpaired devices and from my testing bluedevil always does an explicit local pair (at least for the legacy pairing keyboards I tried).

Maybe for 2.4 we remove "Generic connect" and always do an explicit local pair. Or we don't allow this for legacypairing devices?

@cschramm
Copy link
Member Author

cschramm commented Jan 1, 2024

we remove "Generic connect" and always do an explicit local pair

You still need "generic connect" for paired devices and the situation is probably exactly the same for specific services (network and serial), but yes, we could enforce or even implicitly trigger a pairing attempt before providing / executing any connection attempt to still rely on the autoconnect plugin. The thing is just... devices may provide services without pairing, so I'm not sure how valid that is. Also, the DualShock 3 controller is an example where you even cannot successfully pair with local initiation if I get it right.

@cschramm cschramm modified the milestones: 2.4, 2.5 Jan 7, 2024
@github-actions github-actions bot added the stale label Mar 8, 2024
@infirit infirit added enhancement and removed stale labels Mar 8, 2024
@blueman-project blueman-project deleted a comment from github-actions bot Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants