Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to receive 'Scan Response' (4) advertising packets, no luck #4

Open
deepcoder opened this issue Apr 19, 2020 · 1 comment
Open

Comments

@deepcoder
Copy link

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

@gled-rs
Copy link

gled-rs commented Dec 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants