Skip to content

Fix com.bluez.battery1 randomly missing percentage

Yancey Chiew linux-bluetooth 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1profiles/battery: Fix batt random lose percentageprofiles/battery/battery.c+6 -41 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH BlueZ 0/1] Fix com.bluez.battery1 randomly missing percentage

For more than a year, I often found that the org.bluez.Battery1 dbus interface randomly failed to obtain the battery level of some devices.

When this happens, it is always accompanied by a "Trying to update an unregistered battery" log.

Finally, I found a bug in battery.c:parse_battery_level(). Except when called for the first time, it will wait until the battery percentage changes before updating the value in the dbus interface.

For BLE devices, changes in battery percentage will take a long time, which is enough for the device to disconnect/reconnect multiple times due to sleep/wake-up. And every reconnection has a chance to cause "Trying to update an unregistered battery".

This is a new version of the previous patch, fixes the style problem.

Quoted 1 line

id: 20240723082843.184915-1-YanceyChiew () gmail ! com

Yancey Chiew (1):
profiles/battery: Fix batt random lose percentage

 profiles/battery/battery.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.45.2