如何在 Linux 中检索蓝牙 LE 发射器的广告负载?
具体来说,我已经使用 hcitool 配置了 arduino 和 R-PI 以充当 iBeacons。
我正在寻找的是一个命令来打印出设备的当前广告有效负载。
如何在 Linux 中检索蓝牙 LE 发射器的广告负载?
具体来说,我已经使用 hcitool 配置了 arduino 和 R-PI 以充当 iBeacons。
我正在寻找的是一个命令来打印出设备的当前广告有效负载。
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.
由于libpcap-1.0+ 现在支持蓝牙捕获,您可以使用 Wireshark/tshark/tcpdump来捕获和显示蓝牙数据包 - BTLE 和其他数据包类型。
要使用 Wireshark 捕获 LE 数据包,您仍然需要告诉蓝牙接口查询 LE 数据包,如上一个答案中所述:
sudo hcitool lescan --duplicates &
此外,如果您希望适配器对处于可发现模式的蓝牙设备进行定期查询,您可以运行(尽管这些查询不会获取 BTLE 排放):
sudo hcitool spinq
sudo hcitool lescan --duplicates &
sudo hcitool spinq
两个命令都运行一个无限循环 如何运行一个有限循环并获取数据