FreeBSD The Power to Serve

New Bluetooth® configuration daemon: blued

Introduction

The blued utility provides an IPC interface that lets an unprivileged user connect to and use Bluetooth devices in a user-friendly way and supports secure simple pairing (public-key cryptography and if the device allows it man-in-the-middle protection).

What is blued?

There are three parts to blued: a library, a daemon and a command line utility. The library abstracts away bluetooth details, the daemon manages Bluetooth devices and the command line utility lets users list or scan for Bluetooth devices, pair with a device, or unpair from one. The command line utility communicates with the daemon via a UNIX socket.

Unlike bthidd and hcsecd, blued supports secure simple pairing and provides an IPC. To get a HID device to work, bthidd is still needed. A script is provided to pair a Bluetooth device and appropriately configure bthidd so it just works and reconnects without user intervention.

Once pairing has proven stable and bugs have been ironed out, the plan is to integrate bthidd with/into blued in some way to have HID devices automatically start functioning when paired without the use of an external script. A long-term goal is to provide a graphical user interface that can list devices and provide a simple one-click setup to connect them.

Installing and using blued v0.1

You need the optional src component installed in /etc/src.

To test blued, fetch the blued v0.1 source code. Then compile it, patch your FreeBSD kernel with the patches in kernel_patches, and recompile the hci module as explained in README.

I have primarily tested blued on FreeBSD 12.3, but my patches applied cleanly on 13.1 when I tested. I am not supplying a port at the moment, but it is possible to run the software straight from the build directory or run "make install" that will install all needed files. Both blued and bluecontrol use capsicum and blued can be configured to drop its root privileges.

For more information, refer to the Running blued section of README.

Helping out

Testing

I have only tried this software with my own mouse and realise that a sample size of one single bluetooth device is pretty small. I’m expecting issues and am greatly looking forward to feedback from others!

In case of trouble, output from /var/log/debug.log and /var/log/messages as well as a traffic dump from "hcidump -x" while trying to pair will help with troubleshooting.

Contributing

If you want to get involved with the code and submit patches, you’re welcome to visit the repository on Lysator’s Git.


Last modified on: August 2, 2022 by Lorenzo Salvadore