-
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
BlueZ battery workaround #393
Comments
Based on #411 (comment), I'm starting to think that maybe we should just remove the battery service workaround instead and recommend that users disable the BlueZ battery plugin if they want to use devices with the battery service with Bleak. It means the OS will loose access to the battery service, but it will prevent BlueZ from interfering with Bleak. |
I agree. The current Battery API does make the BlueZ backend behave different from the other OS backends. If it can be disabled, then it will produce a more coherent solution for all backends. But it does require users to make non-trivial changes in the OS. Even though it is a simple fix, it does add a strange step to the installation procedure for Linux. |
hrm, I'm kinda of the opinion that the whole reason to use a Dbus based library is so that the existing OS stuff still works. If wanted to shut the OS out of my code, I'd use something speaking HCI directly, and just take over the device? However, as #389 got merged, is it possible this issue is just outdated and should be closed now? |
I assume you are advocating for leaving the Battery Service workaround in place? In that case, we still should fix Bleak so that it depends on the D-Bus object being present or not rather than on the BlueZ version as it currently does. |
I don't actually have a strong opinion on the battery service itself but yes, I would say that bleak should make the battery service look "normal" cross platform, regardless of bluez version or the presence/lack thereof of the battery plugin. My reasoning being that that leaves the system interfaces "as is" which to me is the major appeal of a dbus based BLE toolkit rather than a HCI based toolkit. |
Up until now, we missed bluez/bluez@713f6f0 which exposes the battery service in BlueZ again starting in BlueZ v5.55. The version check for this is fixed in #976. So eventually, we can just remove the battery workaround completely when we drop support for BlueZ < 5.55. |
Thanks dlech... |
Closing since the workaround is no longer needed. |
bluetoothctl -v
) in case of Linux: >= 5.48 <5.55Description
Currently, we have a workaround for the standard battery service in the BlueZ backend based on BlueZ version.
bleak/bleak/backends/bluezdbus/client.py
Lines 467 to 482 in e968a7b
However, I have just learned that there is a
-P battery
option tobluetoothd
that can disable this feature. So the version check will actually break things for someone who has set this option.So the logic should probably be changed so that rather than looking at the BlueZ version, just say: if we are looking for the battery service there is no matching D-Bus GATT service, then check if the D-Bus
org.bluez.Battery1
interface exists.For the curious, you can disable the BlueZ battery plugin by running
sudo systemctl edit bluetooth.service
and adding the following:The text was updated successfully, but these errors were encountered: