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
How to force pairing with a device with Bluepy? #26
Comments
It is possible to force pairing/bonding with the btle.setSecurityLevel() function. When I set the security level to medium after the connection is established, I could see the pairing request/response/key generation in hcidump and my bluetooth device. btle.connect() btle.setSecurityLevel() equals gatttool> connect gatttool> sec-level medium However, it is not clear to me who controls the storage of the link keys. (I assume it is the bluetoothd daemon) |
Hej, I have been trying to set security level to medium through gatttool, but it does not react. Same goes if I try to use setSecurityLevel(). What could be the problem? |
I didn't know that I could use setSecurityLevel() to that purpose so I adapted btle.py a bit so that I could call the pair method of bluepy-helper. First I got a nomgmt error, and seeing that mgmt_master would only be created when iface is not None I changed its default in Peripheral to 0 instead. Then, it was still not pairing presenting me with a protoerr result. So, any reason why the pairing won't work this way? (I did execute 'pairable on' beforehand.) |
Hello @clarkli86 I have tried your method and used setSecurityLevel() method but it does not work. Even tried with gatttool command line but no help over there as well. Can you please explain how you got connected ? |
Hello,
I have successfully established an LE connection to my BLE device with Bluepy. Now for testing reasons, I would like to control the authentication and encryption of the link. Is this possible? I have tried setting the security level but it did not change anything. Is is possible to do this? If this is the case, who controls the storage of the link keys?
Thanks
The text was updated successfully, but these errors were encountered: