Raspberry Pi & Nexdock: Bluetooth via the command line
This article first appeared on October 11, 2016.
I received my Nexdock today and have begun configuring a Raspberry Pi 3 to work with it. I wasn't able to find current instructions for getting the Nexdock keyboard and trackpad to work with the Pi using the command line, so I've documented the procedure that I used.
Run:
bluetoothctl
Then, from the bluetooth prompt:
power on
agent on
scan on
You should see a line to the effect of:
[NEW] Device 20:16:07:05:95:EB NexDock Keyboard
Replacing the MAC address shown with your own, type:
pair 20:16:07:05:95:EB
connect 20:16:07:05:95:EB
trust 20:16:07:05:95:EB
exit
Typically, this would be enough, but it seems the Nexdock doesn't remember bluetooth connections, so you need to reconnect at each boot. Nex says you can do this by adding the following line to your crontab:
@reboot echo "connect 20:16:07:05:95:EB" | bluetoothctl
I found that didn't work for me, although the command did work after the computer was fully booted. Adding a delay solved the issue:
@reboot sleep 5 && echo "connect 20:16:07:05:95:EB" | bluetoothctl
I'm experiencing a lot of key repeats. The problem is at its worst when I type quickly and with force. If I try to moderate my force on the keys, the problem seems to go away. Turning off key repeat does not eliminate the bounce.