-
Notifications
You must be signed in to change notification settings - Fork 304
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
Cannot set LE security level #77
Comments
This is something I definitely want to support, but I actually do not know how. I ahve received multiple questions about security related reading and writing issues with Bleak, but I have failed to find much documentation about it. There is [https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt#n180](a read and write property) on the from bleak.backends.bluezdbus import defs
await client._bus.callRemote(
client._device_path,
"Set",
interface=defs.PROPERTIES_INTERFACE,
destination=defs.BLUEZ_SERVICE,
signature="ssv",
body=[defs.DEVICE_INTERFACE, "Trusted", True],
returnSignature="a{sv}",
).asFuture(self.loop) Try setting both before and after See documentation about the I have no devices to test this on myself, so you will have to help me with this. |
Thanks for the response. Putting this before the |
Ok. Thank you very much for testing the code; it was a bit of a leap of faith... There is something I need to focus on in the handling of secure BLE connections apparently. Would you mind telling me what kind of device you are trying to connect to so I can buy one and try to get Bleak to work against it and by doing so hopefully all other BLE peripherals with additional security requirements? Or another BLE device, which costs as little as possible but still exibits this behaviour if you know of that? |
Possibly related to #64. |
The device is not out yet, so unfortunately I can't help you there :( I'm also not really a user of Bluetooth (ironic, I know), so I don't know any specific device that I can recommend here. I think it should be enough to take any BT device that can be set to not require a PIN code to pair to have the same effect. |
Ok, I will continue my search for devices that I can use for testing. Until then, I cannot do much more than that. |
This Stack Overflow answer explains that elevated security levels are required for pairing iPhones, so those might be testing devices. https://stackoverflow.com/a/24725691 |
I'm interested in the same but for Windows. |
If it is possible then you are more than welcome to do the work and send me a Pull Request. |
I've been trying to get pairing / bonding to work on windows without much luck - running into issues/limitation with pythonnet (and/or my understanding of how to use it). I've tried discussing it with them without much resolution: pythonnet/pythonnet#940 |
Pairing is implemented for .NET and BlueZ backends in version 0.8.0. Will close this for now. |
Description
Cannot set BTLE security level before connecting.
I'm currently rewriting an internal testing tool from bluepy to an async library. I decided to test out bleak, but one of the problems I ran into was our device giving an "LE security request" when connecting to it. This didn't happen with the old library.
After some talking with our Bluetooth guys and testing with
gatttool
it seems that the old library defaults to what gatttool would callsec-level low
, while bleak seems to default to at least medium.bluepy
allows setting this, but I cannot find anything in thebleak
API description on how to set the security level, so I looked at the bluez dbus "documentation", hoping I could hack in a workaround, but couldn't find anything either.Any help is appreciated.
The text was updated successfully, but these errors were encountered: