bluetooth-wizard cannot pair with a 1byone bluetooth keyboard (or possibly, any keyboard that requires a PIN code?)

Bug #1492443 reported by Michael Terry on 2015-09-04
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
unity-control-center (Ubuntu)
High
Kai-Heng Feng
Xenial
High
Unassigned

Bug Description

* Impact
some bluetooth keyboards can't be paired

* Test case
If you own a keyboard requiring a pincode for pairing try to pair it, it should work

* Regression potential
limited, it's only adding new code to a callback function which was unimplemented

------------------------------------

I'm on wily. I just got this keyboard, so I don't know if this is a regression or not with Bluez5. I'm guessing it is though.

I can pair via the console just fine (though connecting is another story -- bug 1492441):

$ bluetoothctl
[NEW] Device 08:73:00:13:CC:45 1byone Keyboard
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# pair 08:73:00:13:CC:45
Attempting to pair with 08:73:00:13:CC:45
[CHG] Device 08:73:00:13:CC:45 Connected: yes
[agent] PIN code: 420005
[CHG] Device 08:73:00:13:CC:45 Modalias: usb:v04E8p7021d011B
[CHG] Device 08:73:00:13:CC:45 UUIDs: 00001000-0000-1000-8000-00805f9b34fb
[CHG] Device 08:73:00:13:CC:45 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device 08:73:00:13:CC:45 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 08:73:00:13:CC:45 Paired: yes
Pairing successful
[CHG] Device 08:73:00:13:CC:45 Connected: no

But when using bluetooth-wizard, none of the "PIN options" options work for me. I expected to be prompted to enter a random PIN code like I do when connecting it to my iPad or when connecting via the console above. But it just spins for a while and says that pairing failed.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: unity-control-center 15.04.0+15.10.20150818-0ubuntu1
ProcVersionSignature: Ubuntu 4.1.0-3.3-generic 4.1.3
Uname: Linux 4.1.0-3-generic x86_64
ApportVersion: 2.18-0ubuntu9
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Sep 4 15:55:47 2015
DistributionChannelDescriptor:
 # This is a distribution channel descriptor
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-precise-amd64-20120703-2
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-01-09 (967 days ago)
InstallationMedia: Ubuntu 12.04 "Precise" - Build amd64 LIVE Binary 20120703-15:08
SourcePackage: unity-control-center
SystemImageInfo:
 current build number: 0
 device name:
 channel: daily
 last update: Unknown
UpgradeStatus: Upgraded to wily on 2013-01-31 (945 days ago)

Related branches

Michael Terry (mterry) wrote :
Sebastien Bacher (seb128) wrote :

Confirmed and I think I know what's wrong there, working on a fix for it

Changed in unity-control-center (Ubuntu):
importance: Undecided → High
status: New → In Progress
assignee: nobody → Sebastien Bacher (seb128)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-control-center - 15.04.0+15.10.20150923-0ubuntu1

---------------
unity-control-center (15.04.0+15.10.20150923-0ubuntu1) wily; urgency=medium

  * [bluetooth] restore the ssp pairing signature fix which was applied
    to our gnome-bluetooth package but got discarded by error when
    updating ucc to the new bluez version (LP: #1492443)

 -- Sebastien Bacher <email address hidden> Wed, 23 Sep 2015 06:52:32 +0000

Changed in unity-control-center (Ubuntu):
status: In Progress → Fix Released
el_calavera (simon-hebel) wrote :

I cannot confirm this, the bug is still present as described by the OP!
(Version is 15.04.0+15.10.20150923-0ubuntu1)

Maurizio Gobbo (gibbio) wrote :

I can confirm, the bug is still present on unity-control-center (15.04.0+16.04.20160315-0ubuntu1).
Tested with 1byone keyboard (both bluetooth 2.1 and 4.0 adapters) and also with a Microsoft Wedge Keyboard (just when using a bluetooth 2.1 adapter)

If I put the PIN Code show in the btmon output the pairing process is successful and the device is working.
btmon log attached.

Maurizio Gobbo (gibbio) wrote :

I've found the problem. The function display_pincode_callback in panels/bluetooth/gnome-bluetooth/wizard/main.c is empty so the gtk ui wont show the pincode (like for the passkey auth).
Quick solution is to change the function to:
static void
display_pincode_callback (GDBusMethodInvocation *invocation,
     GDBusProxy *device,
     const char *pincode,
     gpointer user_data)
{
 gchar *text, *label;

 display_called = TRUE;
 gtk_assistant_set_current_page (window_assistant, PAGE_SSP_SETUP);

 replace_target_properties_for_device (device);

 gtk_widget_show (label_ssp_pin);

 if (target_ui_behaviour == PAIRING_UI_KEYBOARD) {
  label = g_strdup_printf (_("Please enter the following PIN on '%s' and press “Enter” on the keyboard:"), target_name);
  text = g_strdup_printf("%s⏎", pincode);
 }
 else {
  label = g_strdup_printf (_("Please enter the following PIN on '%s':"), target_name);
  text = g_strdup_printf("%s", pincode);
 }

 gtk_label_set_markup(GTK_LABEL(label_ssp_pin_help), label);
 set_large_label (GTK_LABEL (label_ssp_pin), text);
 g_free(text);

 g_free(label);

 /* Reject all the calls here, so that we'll get asked about the
  * pincode instead of being told the pincode */
 g_dbus_method_invocation_return_dbus_error (invocation,
          "org.bluez.Error.Rejected",
          "Rejected bluetoothd generated PIN code");
}

Sebastien Bacher (seb128) wrote :

@Maurizio, but that functions is not empty? It has code to reject the call to trigger a fallback to the other method, but I guess there is an issue with bluez/the hardware which makes the fallback method not work?

Maurizio Gobbo (gibbio) wrote :

@Sebastien,
I've just edited the display_pincode_callback function like in my last post and now the bluetooth-wizard show me the label_ssp_pin widget page with the correct pin code to insert.
I've seen that the display_pincode_callback function is used just when i try to pair an old device and/or by using an old bt usb dongle.
I'll test it with more devices and I'll let you know.

Sebastien Bacher (seb128) wrote :
Changed in unity-control-center (Ubuntu):
status: Fix Released → Triaged
Sebastien Bacher (seb128) wrote :

In fact ignore that, the code from upstream needs to be adapted to the current codebase which is more work

Sebastien Bacher (seb128) wrote :

If your code was working maybe you could probably a merge request with the change against lp:unity-control-center?

Sebastien Bacher (seb128) wrote :
Changed in unity-control-center (Ubuntu):
assignee: Sebastien Bacher (seb128) → Kai-Heng Feng (kaihengfeng)
status: Triaged → In Progress
description: updated
Martin Pitt (pitti) wrote :

Please fix this in yakkety first. In the meantime, unity-control-center is already in -proposed for bug 1562822.

Changed in unity-control-center (Ubuntu Xenial):
importance: Undecided → High
status: New → Triaged
Sebastien Bacher (seb128) wrote :

right, the current SRU is ready to move to updates and there is a landing up for yakkety ... should be good when the next SRU reviewer looks at it

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-control-center - 15.04.0+16.10.20160525.1-0ubuntu1

---------------
unity-control-center (15.04.0+16.10.20160525.1-0ubuntu1) yakkety; urgency=medium

  [ Kai-Heng Feng ]
  * bluetooh: fix keyboard pairing issue. Maurizio Gobbo (gibbio) is the
    original author. (LP: #1492443)

 -- Sebastien Bacher <email address hidden> Wed, 25 May 2016 09:49:04 +0000

Changed in unity-control-center (Ubuntu):
status: In Progress → Fix Released

Hello Michael, or anyone else affected,

Accepted unity-control-center into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unity-control-center/15.04.0+16.04.20160413-0ubuntu3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: hw-specific
Changed in unity-control-center (Ubuntu Xenial):
status: Triaged → Fix Committed
tags: added: verification-needed
Kai-Heng Feng (kaihengfeng) wrote :

I can confirm that unity-control-center 15.04.0+16.04.20160413-0ubuntu3 in xenial-proposed fixes the issue.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-control-center - 15.04.0+16.04.20160413-0ubuntu3

---------------
unity-control-center (15.04.0+16.04.20160413-0ubuntu3) xenial; urgency=medium

  * panels/bluetooth/gnome-bluetooth/wizard/main.c:
    - backport fix for making pairing of old bluetooth keyboard work,
      thanks Kai-Heng Feng and Maurizio Gobbo (lp: #1492443)

 -- Sebastien Bacher <email address hidden> Tue, 24 May 2016 16:30:41 +0200

Changed in unity-control-center (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for unity-control-center has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers