Close

Bluetooth HID is easy right?

A project log for Samsung NP540U4E to BLE keyboard conversion

I always wanted to have a wireless keyboard with touchpad. Preferably with Bluetooth. So I have started to build one.

miklos-martonMiklos Marton 01/01/2019 at 18:320 Comments

... or maybe not.

I have flashed the nordic keyboard example to make sure that the basic HID - BLE functionality works as expected:

https://github.com/I0x0I/DIY-A-BLE-Keyboard

Then I followed the Archlinux Wiki about the Bluetooth keyboard bringup:

https://wiki.archlinux.org/index.php/bluetooth_keyboard

Unfortunately I am not able to pair to my device:

mm@lapos:~$ bluetoothctl
[NEW] Controller 00:15:83:D1:A9:E6 BT 4.0 [default]
[NEW] Device A0:6F:AA:9E:3E:03 LG SJ5(03)
[NEW] Device E8:83:76:AE:34:7D Nordic_Keyboard
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent KeyboardOnly
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:15:83:D1:A9:E6 Discovering: yes
[CHG] Device A0:6F:AA:9E:3E:03 RSSI: -91
[NEW] Device 51:CA:CE:EF:57:5C 51-CA-CE-EF-57-5C
[CHG] Device E8:83:76:AE:34:7D RSSI: -71
[CHG] Device E8:83:76:AE:34:7D RSSI: -86
[bluetooth]# pair E8:83:76:AE:34:7D 
Attempting to pair with E8:83:76:AE:34:7D
[bluetooth]# trust E8:83:76:AE:34:7D 
Changing E8:83:76:AE:34:7D trust succeeded
[bluetooth]# connect E8:83:76:AE:34:7D 
Attempting to connect to E8:83:76:AE:34:7D
[CHG] Device E8:83:76:AE:34:7D Connected: yes
[CHG] Device E8:83:76:AE:34:7D Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled
Failed to connect: org.bluez.Error.Failed
[CHG] Device E8:83:76:AE:34:7D RSSI: -73
[CHG] Device E8:83:76:AE:34:7D RSSI: -81
[CHG] Device E8:83:76:AE:34:7D RSSI: -72
[CHG] Device E8:83:76:AE:34:7D RSSI: -81
[CHG] Device E8:83:76:AE:34:7D RSSI: -73

Here is what I see when doing the connect with btmon:

        Handle: 39
        Random number: 0xff9f0b8649b6cf46
        Encrypted diversifier: 0x3ffe
        Long term key: e085b0c06f0bdfede3bd0238fc181ed4
> HCI Event: Command Status (0x0f) plen 4                                                                                                [hci0] 4.419375
      LE Start Encryption (0x08|0x0019) ncmd 1
        Status: Success (0x00)
> HCI Event: Encryption Change (0x08) plen 4                                                                                             [hci0] 4.470241
        Status: PIN or Key Missing (0x06)
        Handle: 39
        Encryption: Disabled (0x00)
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                           [hci0] 4.470347
        Handle: 39
        Reason: Authentication Failure (0x05)
> HCI Event: Command Status (0x0f) plen 4                                                                                                [hci0] 4.472318
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                           [hci0] 4.487330
        Status: Success (0x00)
        Handle: 39
        Reason: Connection Terminated By Local Host (0x16)

To make sure that my setup works I have even started Windows, but I was not able to install drivers to my dongle, since the installer says it is a counterfeit unit...

Discussions