After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751990 - Mouse missing from PIN database
Mouse missing from PIN database
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: general
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2015-07-05 18:30 UTC by James
Modified: 2017-11-06 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Scans of relevant manual pages (403.85 KB, image/jpeg)
2015-07-05 20:14 UTC, James
  Details
lib: Fix mouse setup with non-Apple, non-Microsoft mice (973 bytes, patch)
2017-11-03 11:20 UTC, Bastien Nocera
committed Details | Review

Description James 2015-07-05 18:30:44 UTC
My bluetooth mouse is missing from the PIN database so I get an unnecessary PIN prompt and am unable to connect. Adding the line

  <device oui="00:12:A1:" type="mouse" pin="NULL" />

to pin-code-database.xml works for me, although I suspect this will need refining. bluetoothctl info output:

Device 00:12:A1:REDACTED
	Name: Bluetooth Mouse
	Alias: Bluetooth Mouse
	Class: 0x002580
	Icon: input-mouse
	Paired: no
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Service Discovery Serve.. (REDACTED)
	UUID: Human Interface Device... (REDACTED)
	UUID: PnP Information           (REDACTED)
	Modalias: usb:v3938p1001d1F16
Comment 1 Bastien Nocera 2015-07-05 18:45:57 UTC
And what mouse is that? Please link to the manual explaining how to pair that mouse.

>	UUID: Service Discovery Serve.. (REDACTED)
>	UUID: Human Interface Device... (REDACTED)
>	UUID: PnP Information           (REDACTED)

That's great, you're redacting stuff that's actually useful for debugging...

What distribution do you use, what plugins are included in your BlueZ compilation?
Comment 2 James 2015-07-05 19:52:57 UTC
(In reply to Bastien Nocera from comment #1)
> And what mouse is that? Please link to the manual explaining how to pair
> that mouse.

This particular one's branded "Nikkai", model A63HL. I can't find the manual anywhere online so I'll try and attach some scans of the relevant pages later. 
It's written for Windows XP, where for the passkey step it says 'Click "Don't use a passkey"'.

> >	UUID: Service Discovery Serve.. (REDACTED)
> >	UUID: Human Interface Device... (REDACTED)
> >	UUID: PnP Information           (REDACTED)
> 
> That's great, you're redacting stuff that's actually useful for debugging...

OK, I didn't know how "unique" those numbers were.

	UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

> What distribution do you use, what plugins are included in your BlueZ
> compilation?

Fedora 22, stock bluez packages:

bluez-libs-5.29-2.fc22.x86_64
bluez-5.29-2.fc22.x86_64
bluez-hid2hci-5.29-2.fc22.x86_64
bluez-cups-5.29-2.fc22.x86_64
Comment 3 James 2015-07-05 20:14:53 UTC
Created attachment 306871 [details]
Scans of relevant manual pages
Comment 4 Bastien Nocera 2015-07-23 12:11:06 UTC
(In reply to James Ettle from comment #0)
> My bluetooth mouse is missing from the PIN database so I get an unnecessary
> PIN prompt and am unable to connect. Adding the line
> 
>   <device oui="00:12:A1:" type="mouse" pin="NULL" />
> 
> to pin-code-database.xml works for me, although I suspect this will need
> refining.

So, this is the wrong fix. The PIN database is to override the default values from plugins/autopair.c in bluez. In plugins/autopair.c, we're supposed to try and connect to the mouse with a PIN, which would fail, and fallback to no PIN at all:
https://git.kernel.org/cgit/bluetooth/bluez.git/tree/plugins/autopair.c#n119

Unfortunately, I can't reproduce this locally, as the only mouse that doesn't require a PIN that I have refuses to give out its name...

I'll try again on another system.
Comment 5 James 2015-07-23 17:34:22 UTC
(In reply to Bastien Nocera from comment #4)
> So, this is the wrong fix. The PIN database is to override the default
> values from plugins/autopair.c in bluez. In plugins/autopair.c, we're
> supposed to try and connect to the mouse with a PIN, which would fail, and
> fallback to no PIN at all:
> https://git.kernel.org/cgit/bluetooth/bluez.git/tree/plugins/autopair.c#n119

OK, that was just the XML hack I was using locally in the meantime to get things working. Is there any debug info I can get from bluez that would help?
Comment 6 Bastien Nocera 2017-11-03 11:20:14 UTC
Created attachment 362893 [details] [review]
lib: Fix mouse setup with non-Apple, non-Microsoft mice

Contrary to what was mentioned in commit 5b50189, the autopair plugin
will not help us setup most mice, as we shouldn't be pairing them.

This caused pairing attempts being made to mice which did not support
it. Re-add the quirk that made mice not attempt pairing.
Comment 7 Bastien Nocera 2017-11-03 11:36:23 UTC
Thank you for your patience. Hopefully you've been able to use your mouse properly. I should really have paid more attention to your bug, as it turns out I broke setup for mice other than Apple's and Microsoft's 4 years ago, 2 years before your bug report.

This is finally fixed though, so there's always that. If you want to re-test, you should be able to replace the couple of lines you added with the ones in this patch.
Comment 8 Bastien Nocera 2017-11-03 11:37:56 UTC
Attachment 362893 [details] pushed as d2a9771 - lib: Fix mouse setup with non-Apple, non-Microsoft mice
Comment 9 James 2017-11-04 23:58:23 UTC
Confirm patch works with

gnome-bluetooth-3.26.1-1.fc27.x86_64
bluez-5.47-2.fc27.x86_64

In GNOME Settings at first after connecting it says "Connected". No response from the cursor, but If I click the mouse button it disconnects. It works properly after I click on its properties and connect that way, but this is probably a separate bug.

Not tried logging out and back in again.
Comment 10 Bastien Nocera 2017-11-06 16:27:49 UTC
(In reply to James Ettle from comment #9)
> Confirm patch works with
> 
> gnome-bluetooth-3.26.1-1.fc27.x86_64
> bluez-5.47-2.fc27.x86_64
> 
> In GNOME Settings at first after connecting it says "Connected". No response
> from the cursor, but If I click the mouse button it disconnects. It works
> properly after I click on its properties and connect that way, but this is
> probably a separate bug.

I'm not sure that's a different bug. Can you run "gnome-control-center --verbose bluetooth" and reproduce the problem? Make sure you've remove the mouse from the devices using either bluetoothctl or the Bluetooth Settings (in a different run) so as not to pollute the logs.
Comment 11 Bastien Nocera 2017-11-06 16:29:08 UTC
I tested this with a Wacom Graphire Bluetooth tablet which cannot pair either, just remembers that the computer was the first to connect after pressing the "connect" button at the bottom of it.