Create a gist now

Instantly share code, notes, and snippets.

Embed
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.

@lukasz-kwasniewski

This comment has been minimized.

Show comment
Hide comment
@lukasz-kwasniewski

lukasz-kwasniewski Feb 27, 2016

great!

great!

@dimitar-kunchev

This comment has been minimized.

Show comment
Hide comment
@dimitar-kunchev

dimitar-kunchev Mar 1, 2017

Awesome guide! It helped me out just perfect.

If I may add a few things for people reading it:

  • for me the bluetooth service was not enabled to start on boot, nor was the rfcomm module loaded. Surprisingly rfcomm bind... command doesn't spit errors in that case - just exits and doesn't create the serial port.
  • Once you have paired a device it will be remembered by the core bluetooth module. So after reboot (host and peripheral) you don't have to do the bluetoothctl commands - just go to step 3 (rfcomm bind...) and when you open the serial port it will connect.
  • I was surprised how well all this works. Tried bullying it around by loosing connection, restarting peripherals and etc while working and even when the serial port was kept open and commands were executing everything kept re-establishing connection and resuming just nicely. No need to re-bind the serial port again or anything (until the next host reboot that is).

Tested with debian kernel 4.10 on a Cubieboard2 using CSR8510 dongle from adafruit (product ID 1327).

Awesome guide! It helped me out just perfect.

If I may add a few things for people reading it:

  • for me the bluetooth service was not enabled to start on boot, nor was the rfcomm module loaded. Surprisingly rfcomm bind... command doesn't spit errors in that case - just exits and doesn't create the serial port.
  • Once you have paired a device it will be remembered by the core bluetooth module. So after reboot (host and peripheral) you don't have to do the bluetoothctl commands - just go to step 3 (rfcomm bind...) and when you open the serial port it will connect.
  • I was surprised how well all this works. Tried bullying it around by loosing connection, restarting peripherals and etc while working and even when the serial port was kept open and commands were executing everything kept re-establishing connection and resuming just nicely. No need to re-bind the serial port again or anything (until the next host reboot that is).

Tested with debian kernel 4.10 on a Cubieboard2 using CSR8510 dongle from adafruit (product ID 1327).

@adlerweb

This comment has been minimized.

Show comment
Hide comment
@adlerweb

adlerweb Jul 5, 2017

The rfcomm-utility is now considered deprecated and was removed from the official package. You can still find it at au (bluez-utils-compat or bluez-rfcomm).

adlerweb commented Jul 5, 2017

The rfcomm-utility is now considered deprecated and was removed from the official package. You can still find it at au (bluez-utils-compat or bluez-rfcomm).

@keinstein

This comment has been minimized.

Show comment
Hide comment
@keinstein

keinstein Dec 15, 2017

@adlerweb what should be used instead? Today, I came across this page and it still worked on my Debian Testing/Sid system.

@adlerweb what should be used instead? Today, I came across this page and it still worked on my Debian Testing/Sid system.

@ryanstout

This comment has been minimized.

Show comment
Hide comment
@ryanstout

ryanstout Jan 1, 2018

@adlerweb Same here, any replacement for rfcomm?

@adlerweb Same here, any replacement for rfcomm?

@E1k3

This comment has been minimized.

Show comment
Hide comment
@E1k3

E1k3 Jan 25, 2018

Not that I am aware of, but if you find one, please share it here and on unix.stackexchange

E1k3 commented Jan 25, 2018

Not that I am aware of, but if you find one, please share it here and on unix.stackexchange

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