Debugging Bluetooth Stack on Linux

As I’m developing a Linux based SSH pkcs11 library which proxies key access to Bluetooth device, I had to troubleshoot many problems related to Bluetooth.

Linux Bluetooth Stack

The Linux user-space stack is hosted here: https://github.com/bluez/bluez.git

You can pick a specific version (git tag) and checkout it. Follow readme and compile the tools in some other root directory (not to override existing OS based version).

./bootstrap
./configure
export CPPFLAGS="-g"
export CFLAGS="-g"
./configure  --prefix=$(pwd)/here
make -j$(nproc)
make install
sudo here/libexec/bluetooth/bluetoothd -n --debug='*'

Tracing Bluetooth events

sudo ./here/bin/btmon -S -A -I -M

Exploring d-bus object tree (its exporting IPC interface to user-space components like KDE and GNOME BT config)

/usr/lib/x86_64-linux-gnu/qt5/bin/qdbusviewer # naviget to "system bus" tab and filter by "org.bluez"

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *