Bluetooth sniffer: How can I install btmon on raspberry Pi?

zono picture zono · Apr 18, 2014 · Viewed 11.4k times · Source

A kind person said that btmon is a useful tool to exam Bluetooth packets.

I want to use btmon in Raspberry Pi but the tool seems to be not installed by default.

Does anyone know that how to install the tool? I am looking for the information for a long time, but I cannot find it.

Thanks.

P.S.

I can use hcidump. However, I guess that btmon is a more user-friendly tool.

Answer

John Bessire picture John Bessire · May 10, 2015

These instructions install both bluez and btmon.
http://www.elinux.org/RPi_Bluetooth_LE

Here is a summary of the instructions in case the link changes.

Install libraries

sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libical-dev libreadline-dev libudev-dev libusb-dev make

Download the source files

mkdir -p work/bluepy
cd work/bluepy
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.30.tar.xz
tar xvf bluez-5.30.tar.xz

Compile the file

cd bluez-5.30
./configure --disable-systemd
make

sudo make install

Make sure USB device is seen so run the command

lsusb

After running lsusb you may get something like this.

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0a5c:21e8 Broadcom Corp. 

Make sure the Bluetooth adapter is up.

sudo hciconfig hci0 up

To see if any Bluetooth LE devices are nearby run. Ctrl-C to stop command.

sudo hcitool lescan

You can now run btmon with hcitool.

./btmon &
hcitool lescan