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
Passive scan returns different address type than active scan for BLE devices #262
Comments
Hi, you want to take a look at hci_monitor_cb() in bluepy-helper.c. I can try to look into this in the next few weeks, unless you'd like to debug it yourself. Best, Andy. |
Hi Andy, Thanks for your answer. I quickly took a look at hci_monitor_cb() in bluepy-helper.c. It seems not very easy to understand. So it would be nice if you debug it yourself. I think that it will take me more time than you to do the same thing. Don't hesitate to ping me if you need help, I will try to do my best :). Cheers, |
Hi, |
Andy, I've just tried your fix with a BLE device which advertises with random address. I've the pleasure to announce you that it works well ! Both active and passive scans show that advertising address used is random for this device. Thank you really much for your good job :). Cheers, |
Great, thanks for the feedback. |
Fix #262: Return correct address type in passive scan mode
Hi,
First, thank you for your work. I really enjoy this Bluetooth python module and its simplicity of use.
Unfortunately, I've discovered that, with passive scan, a found BLE device doesn't have the same address type than if it is discovered during an active scan. I checked the scanned results with Wireshark and it seems that the problem comes from the bluepy python module as Wireshark detects the same device address type whether an active or a passive scan is triggered.
Actually, I'm using the original python code from scanner.py (available in bluepy/bluepy/scanner.py) and I just changed the lines:
print(strftime("%Y-%m-%d %H:%M:%S", gmtime()), dev.addr, dev.getScanData())
BY print(strftime("%Y-%m-%d %H:%M:%S", gmtime()), dev.addr, dev.addrType, dev.getScanData())
scanner.scan(10.0, passive=True) BY scanner.scan(10.0)
To illustrate my issue, for instance, when I run an active scan (with scanner.scan(10.0)), I have the following : ... 11:22:33:44:55:66 random.... And, you would have understood it, when I run a passive scan (with scanner.scan(10.0,passive=True)), I have the following : ... 11:22:33:44:55:66 public...
So please, can you fix this little problem ? Or maybe I can help you to do this if you can show me the code part involved in this process of finding device address type ?
Thanks in advance.
G.C.
The text was updated successfully, but these errors were encountered: