LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > IsaacKuo
User Name
Password

Notices


Rate this Entry

Simple Bluetooth Keyboard How-To

Posted 09-01-2017 at 09:37 AM by IsaacKuo
Updated 09-01-2017 at 09:42 AM by IsaacKuo
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:
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
Things will look like this:

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:~# _
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.
Posted in Uncategorized
Views 6825 Comments 2
« Prev     Main     Next »
Total Comments 2

Comments

  1. Old Comment
    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
    Step 2) Run:
    Code:
    systemctl daemon-reload
    systemctl restart bluetooth
    chmod 777 /var/run/sdp
    Step 3) Open up Applications -> Internet -> Unified Remote, and click on RESTART SERVER button.
    Posted 09-06-2017 at 02:47 PM by IsaacKuo IsaacKuo is offline
  2. Old Comment
    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
    Here's how I fixed it:

    As root:
    Code:
    apt-get install pulseaudio-module-bluetooth
    As regular user:
    Code:
    pulseaudio -k
    pulseaudio --start
    Then go back to "bluetoothctl -a" (as root) to attempt to connect.

    This fix was found here:

    https://unix.stackexchange.com/quest...z-error-failed
    Posted 09-11-2017 at 10:35 AM by IsaacKuo IsaacKuo is offline
 

  



All times are GMT -5. The time now is 11:51 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration