Comment 29 for bug 1490347

TJ (tj) wrote :

I've just revisited this issue on 16.04 with the HWE v4.13 kernel and still having the same problem.

This time however I seem to have discovered a workaround that successfully pairs the Apple Wireless Keyboard A1016. This uses the 'bluetoothctl' CLI tool in the terminal.

In short, instead of initiating the pairing from the PC you must INITIATE PAIRING FROM THE KEYBOARD.

1. Activate the KeyboardDisplay PIN agent
2. Start the bluetooth controller scanning.
3. Power-on the BT Keyboard and ensure it is in pairing mode (LED flashing rapidly)
4. Once the PC discovers the BT Keyboard REMOVE it (this deletes any existing stored configuration)
5. After a few seconds the BT Keyboard should be re-discovered.
6. CONNECT to the BT Keyboard
7. Wait a few seconds then type a PIN code ON THE BT KEYBOARD and press Enter
8. The PC will prompt for the PIN code. Type it on an already-connected keyboard (built-in, USB, etc.)
9. Once the "Paired: yes" message is reported TRUST the BT Keyboard

 tj  ~  bluetoothctl
[NEW] Controller 00:1F:3A:E0:0A:AF XPS1530 [default]
[NEW] Device 00:0A:95:44:37:11 Apple Wireless Keyboard
[NEW] Device 2C:8A:72:15:A8:55 HTC One M8
[NEW] Device 00:07:61:3B:86:98 Bluetooth Travel Mouse
[NEW] Device 00:19:15:29:83:14 Think Outside Keyboard

[bluetooth]# power on

[CHG] Controller 00:1F:3A:E0:0A:AF Class: 0x3c010c
Changing power on succeeded
[CHG] Controller 00:1F:3A:E0:0A:AF Powered: yes

[bluetooth]# agent KeyboardDisplay

Agent registered

[bluetooth]# default-agent
Default agent request successful

[bluetooth]# scan on

Discovery started
[CHG] Controller 00:1F:3A:E0:0A:AF Discovering: yes
[CHG] Device 00:0A:95:44:37:11 LegacyPairing: yes
[CHG] Device 00:0A:95:44:37:11 RSSI: -56
[CHG] Device 00:0A:95:44:37:11 RSSI: -45
[CHG] Device 00:0A:95:44:37:11 RSSI: -60
[CHG] Device 00:0A:95:44:37:11 RSSI: -51
[CHG] Device 00:0A:95:44:37:11 RSSI: -42

[bluetooth]# devices

Device 00:0A:95:44:37:11 Apple Wireless Keyboard
Device 2C:8A:72:15:A8:55 HTC One M8
Device 00:07:61:3B:86:98 Bluetooth Travel Mouse
Device 00:19:15:29:83:14 Think Outside Keyboard
[CHG] Device 00:0A:95:44:37:11 RSSI: -50

[bluetooth]# remove 00:0A:95:44:37:11

[DEL] Device 00:0A:95:44:37:11 Apple Wireless Keyboard
Device has been removed
[NEW] Device 00:0A:95:44:37:11 Apple Wireless Keyboard

[bluetooth]# devices

Device 2C:8A:72:15:A8:55 HTC One M8
Device 00:07:61:3B:86:98 Bluetooth Travel Mouse
Device 00:19:15:29:83:14 Think Outside Keyboard
Device 00:0A:95:44:37:11 Apple Wireless Keyboard

[bluetooth]# connect 00:0A:95:44:37:11

Attempting to connect to 00:0A:95:44:37:11

Request PIN code
[agent] Enter PIN code: 1234

[CHG] Device 00:0A:95:44:37:11 Connected: yes
[CHG] Device 00:0A:95:44:37:11 Modalias: usb:v05ACp0209d0110
[CHG] Device 00:0A:95:44:37:11 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device 00:0A:95:44:37:11 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 00:0A:95:44:37:11 Paired: yes
Connection successful

[Apple Wireless Keyboard]# trust 00:0A:95:44:37:11

[CHG] Device 00:0A:95:44:37:11 Trusted: yes
Changing 00:0A:95:44:37:11 trust succeeded
[CHG] Device 00:07:61:3B:86:98 Connected: yes

[Apple Wireless Keyboard]#