Parent: f086b3d27c4141d45017342f3450a3d078cc4d27
Author: Pauli Virtanen <pav@iki.fi>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2025-07-30 16:15:54
Tree: dbd0cc9f068113f6e06374690802a8a55fb56950
profiles/battery: handle reversed ordering of CCC and value Order of batt_io_value_cb() and batt_io_ccc_written_cb() may be reverse. This causes device to appear with 0% or missing battery percentage, because batt->percentage is set on the ignored update so the initial update is lost. Fix by saving new initial value, if battery is not registered. Also downgrade warning to debug message. Also check data length before parsing it. Log (Sony Linkbuds S): src/shared/att.c:can_read_data() (chan 0x7c31eea05c50) ATT PDU received: 0x1b profiles/battery/battery.c:parse_battery_level() Battery Level updated: 87% profiles/battery/battery.c:parse_battery_level() Trying to update an unregistered battery src/battery.c:btd_battery_register() path = /org/bluez/hci1/dev_CF_D2_4D_EE_A2_1A src/battery.c:btd_battery_register() registered Battery object: /org/bluez/hci1/dev_CF_D2_4D_EE_A2_1A profiles/battery/battery.c:batt_io_ccc_written_cb() Battery Level: notification enabled
Diffstat
| M | profiles/battery/battery.c | | | 19 | ++++++++++++- - - - - - - |
1 files changed, 12 insertions(+), 7 deletions(-)