py-bluetooth-utils
py-bluetooth-utils copied to clipboard
Trying to receive 'Scan Response' (4) advertising packets, no luck
I am testing your nice BLE utility code and I am trying to receive the advertising packet of event type 4, Scan Response. In testing with your example_ble_scan.py code, I only receive event type 0, 1, 2 and 3. None of the type 4 packets. Is there some way to enable reception of these packets in your code?
If I run the following two executables on the same machine (each running in a separate sudo process), I see the Scan Response packets and data in the hcidump output
sudo hcitool -i hci0 lescan
sudo hcidump -i hci0 hci
example output from hcidump:
HCI Event: LE Meta Event (0x3e) plen 33 LE Advertising Report SCAN_RSP - Scan Response (4) bdaddr FA:79:61:BC:CC:09 (Random) Unknown type 0x16 with 19 bytes data RSSI: -86 HCI Event: LE Meta Event (0x3e) plen 26 LE Advertising Report ADV_IND - Connectable undirected advertising (0) bdaddr F2:5C:4D:47:47:2F (Random) Flags: 0x06 Shortened service classes: 0xfeaf Complete local name: 'N07RZ' RSSI: -83
Thanks in advance for any ideas! Dave
Probably because enable_le_scan is passive.
You'll need to change the cmd_pkt = struct.pack("<BHHBB", SCAN_TYPE_PASSIVE, interval, window,own_bdaddr_type, filter_policy) replacing SCAN_TYPE_PASSIVE with a more appropriate value for active scan ?
0x01 Seems to do the trick here.