Simple Bluetooth Keyboard How-To
Tags bluetooth
Here's how I pair a Logitech K810 persistently, on Debian 9 Stretch (should work on most Linux distributions).
The important thing is to do the "trust" step AFTER the "connect" step. If you get the order wrong, your connection will not persist after a reboot!
I do the following as root:
Things will look like this:
This simple example includes removing the device, which is what you do if you need to clean up a botched try. If, on the other hand, you are a perfect being and get it right the first try, you do not need the "remove" step.
The important thing is to do the "trust" step AFTER the "connect" step. If you get the order wrong, your connection will not persist after a reboot!
I do the following as root:
Code:
bluetoothctl -a remove 00:1F:20:91:C7:8C scan on pair 00:1F:20:91:C7:8C <type passkey on bluetooth keyboard> connect 00:1F:20:91:C7:8C trust 00:1F:20:91:C7:8C quit
Code:
root@rapunzel:~# bluetoothctl -a [NEW] Controller 74:F0:6D:EA:D2:14 rapunzel [default] [NEW] Device 00:1F:20:91:C7:8C Logitech K810 Agent registered [Logitech K810]# remove 00:1F:20:91:C7:8C [CHG] Device 00:1F:20:91:C7:8C ServicesResolved: no Device has been removed [CHG] Device 00:1F:20:91:C7:8C Connected: no [DEL] Device 00:1F:20:91:C7:8C Logitech K810 [bluetooth]# scan on Discovery started [CHG] Controller 74:F0:6D:EA:D2:14 Discovering: yes [NEW] Device 00:1F:20:91:C7:8C Logitech K810 [bluetooth]# pair 00:1F:20:91:C7:8C Attempting to pair with 00:1F:20:91:C7:8C [CHG] Device 00:1F:20:91:C7:8C Connected: yes [agent] Passkey: 391752 [agent] Passkey: 391752 [agent] Passkey: 391752 [agent] Passkey: 391752 [agent] Passkey: 391752 [agent] Passkey: 391752 [agent] Passkey: 391752 [CHG] Device 00:1F:20:91:C7:8C Modalias: usb:v046DpB319d1202 [CHG] Device 00:1F:20:91:C7:8C UUIDs: 00001000-0000-1000-8000-00805f9b34fb [CHG] Device 00:1F:20:91:C7:8C UUIDs: 00001124-0000-1000-8000-00805f9b34fb [CHG] Device 00:1F:20:91:C7:8C UUIDs: 00001200-0000-1000-8000-00805f9b34fb [CHG] Device 00:1F:20:91:C7:8C ServicesResolved: yes [CHG] Device 00:1F:20:91:C7:8C Paired: yes Pairing successful [CHG] Device 00:1F:20:91:C7:8C ServicesResolved: no [CHG] Device 00:1F:20:91:C7:8C Connected: no [bluetooth]# connect 00:1F:20:91:C7:8C Attempting to connect to 00:1F:20:91:C7:8C [CHG] Device 00:1F:20:91:C7:8C Connected: yes Connection successful [CHG] Device 00:1F:20:91:C7:8C ServicesResolved: yes [Logitech K810]# trust 00:1F:20:91:C7:8C [CHG] Device 00:1F:20:91:C7:8C Trusted: yes Changing 00:1F:20:91:C7:8C trust succeeded [Logitech K810]# quit Agent unregistered [DEL] Controller 74:F0:6D:EA:D2:14 ariel [default] root@rapunzel:~# _
Total Comments 2
Comments
-
Not entirely related, but I'm putting this here because it's convenient for my notes:
For a slate computer, it is convenient to use Unified Remote to turn a smart phone into a bluetooth keyboard/mouse/etc. However, with Debian 9 the version of bluez is too modern to work with SDP out-of-box. I found a fix on this page:
https://bbs.archlinux.org/viewtopic.php?id=201672
the steps are:
Step 0) Pair with the phone as above (this will pair them, but without SDP Unified Remote still won't work).
Step 1) Edit /etc/systemd/system/dbus-org.bluez.service
Code:ExecStart=/usr/lib/bluetooth/bluetoothd --compat
Code:systemctl daemon-reload systemctl restart bluetooth chmod 777 /var/run/sdp
Posted 09-06-2017 at 02:47 PM by IsaacKuo -
If you get something like this, when attempting to connect:
Code:[bluetooth]# connect 80:58:F8:D2:9D:54 Attempting to connect to 80:58:F8:D2:9D:54 Failed to connect: org.bluez.Error.Failed
As root:
Code:apt-get install pulseaudio-module-bluetooth
Code:pulseaudio -k pulseaudio --start
This fix was found here:
https://unix.stackexchange.com/quest...z-error-failedPosted 09-11-2017 at 10:35 AM by IsaacKuo