Bluewalker - Simple BLE scanner for Linux with support for reading Ruuvi tag data

I implemented a simple BLE scanner for Linux using go and the raw HCI sockets. It can be used to scan any BLE Advertising data, and it can also decode ruuvi tag data. Bluewalker allows you to dump the data as JSON allowing further processing.

Source code available in gitlab: https://gitlab.com/jtaimisto/bluewalker

4 Likes

This is a really promising project and maybe something we could use on our “official” BLE-WiFi gateway.

Have you tried to run this on Raspberry Pi Zero W?

@Scrin what do you think about advantages compared to hcitool and hcidump?

When I heard about this on the Ruuvi Slack for the first time and read a bit more about it, I immediately bookmarked it for further study as the methods used by Bluewalker sound like they could be a viable replacement. There are already feasible replacements for hcitool, but so far I haven’t seen any feasible replacements for hcidump until now, the raw HCI sockets may be the answer.

I’ve used bluewalker with both Raspberry Pi 3 and Raspberry Pi Zero W without any problems.

It seems like the only way you can get all advertising data to user space in Linux is raw HCI sockets as the bluez stack D-Bus API does not seem (haven’t really checked for a while, though) to have any API for that. The problem, of course, is that with raw HCI sockets you are bypassing the Bluetooth host implementation on Linux and have to write the relevant stuff yourself.

The bluez project does have a replacement for hcidump called btmon, it is great for debugging, but I felt that screen scraping AD data from one of those was a bit … iffy.

@jtt, I managed to install Bluewalker on my Raspberry Pi 3 model B (running Raspbian Stretch 2018-11-13) after installing Go 1.11, but it just displays the following error:

pi@raspberrypi:~ $ sudo go/bin/bluewalker -device hci0 -ruuvi
Error while opening RAW HCI socket: device or resource busy
Are you running as root and have you run sudo hciconfig hci0 down?

Any advice? hciconfig reports the device is up:

pi@raspberrypi:~ $ hciconfig
hci0: Type: Primary Bus: UART
BD Address: B8:27:EB:DA:62:65 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:239599 acl:0 sco:0 events:5611 errors:0
TX bytes:15601 acl:0 sco:0 commands:1645 errors:0

@ZeroOne Did you try to run sudo hciconfig hci0 down before running bluewalker? If the device is up, bluewalker can not open it as the Linux Bluetooth stack is using it. Thus the device needs to be down when bluewalker is started.

Unfortunately, you need to do this every time you start bluewalker. You can disable the linux Bluetooth stack until reboot with sudo service bluetooth stop.

Oh, no, I missed that part in the instructions! It’s rather counter-intuitive: to get a Bluetooth thingie to work, the Bluetooth interface needs to be down… I also obviously couldn’t parse the error message “Are you running as root and have you run sudo hciconfig hci0 down?” or thought that there must be something wrong with the message. :woozy_face: But I got it working perfectly now, thanks! :sunglasses: