Skip to content

Instantly share code, notes, and snippets.

@hpsaturn
Forked from 0/bluetooth_serial.md
Created April 6, 2020 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hpsaturn/2c33eae4decb8de8994954525d7e9a4a to your computer and use it in GitHub Desktop.
Save hpsaturn/2c33eae4decb8de8994954525d7e9a4a 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.

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