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.
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.
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?
@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. But I got it working perfectly now, thanks!