Skip to content

Instantly share code, notes, and snippets.

@0
Last active November 26, 2024 17:48
Show Gist options
  • Save 0/c73e2557d875446b9603 to your computer and use it in GitHub Desktop.
Save 0/c73e2557d875446b9603 to your computer and use it in GitHub Desktop.
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm

Pair

  1. Start daemon: systemctl start bluetooth

  2. Pair using bluetoothctl:

    power on
    agent on
    scan on
    ... wait ...
    scan off
    pair <dev>
    
  3. Create serial device: rfcomm bind 0 <dev>

You should now have /dev/rfcomm0.

Unpair

  1. Remove serial device: rfcomm release 0

  2. Unpair using bluetoothctl:

    remove <dev>
    power off
    
  3. Stop daemon: systemctl stop bluetooth

Troubleshooting

Check rfkill list to make sure that the Bluetooth device is not blocked.

@hpsaturn
Copy link

hpsaturn commented Apr 6, 2020

Good, with my current version of Debian, Blueman applet fails after pair, it did can't create the serial device (rfcomm bind), but with bluetoothctl works fine. Thanks.

@Hritik14
Copy link

Hritik14 commented Dec 3, 2020

Weird for issue on Archlinux.
After pairing, when I attempt to connect via bluetoothctl itself, I get these:

[bluetooth]# connect 38:0B:3C:XX:XX:XX
Attempting to connect to 38:0B:3C:XX:XX:XX
[CHG] Device 38:0B:3C:XX:XX:XX Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device 38:0B:3C:XX:XX:XX Connected: no

Made me scratch my head for an hour when I found this gist and just rfcomm bind 0 <dev> worked.

EDIT: Just figured out the even the wiki suggests to only pair. Damn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment