How do you retrieve the advertising payload for a Bluetooth LE emitter in linux?
Specifically, I've configured arduino's and R-PI's using hcitool to act as iBeacons.
What I'm looking for is a command to print out what the current advertising payload is for the device.
At Radius Networks, we put together a set of scripts that parse the iBeacon identifiers out of BLE advertisement detected on Linux. You can find a description of this here.
If you simply want to see the raw advertisement bytes, you can start scanning on Linux with:
sudo hcitool lescan --duplicates &
And then see the results with:
sudo hcidump --raw
More details are in the answer linked above.
sudo hcitool lescan --duplicates &
sudo hcitool spinq
Both commands runs an infinite loop
how to run a finite loop and get the data
Since libpcap-1.0+ now supports Bluetooth capture you can use Wireshark/tshark/tcpdump to capture and display Bluetooth packets - both BTLE and other packet types.
To capture the LE packets with Wireshark you will still need to tell the Bluetooth interface to query for LE packets, as mentioned in the previous answer:
sudo hcitool lescan --duplicates &
In addition if you want the adapter to do a periodic query for Bluetooth devices, which are in discoverable mode, you can run (though these queries won't pick up BTLE emissions):
sudo hcitool spinq