linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bluez/bluez] 140d3a: profiles/battery: handle reversed ordering of CCC ...
@ 2025-07-11 17:46 Pauli Virtanen
  0 siblings, 0 replies; only message in thread
From: Pauli Virtanen @ 2025-07-11 17:46 UTC (permalink / raw)
  To: linux-bluetooth

  Branch: refs/heads/981617
  Home:   https://github.com/bluez/bluez
  Commit: 140d3a65108e5c7c3f1fd137c04f437ab5e9159d
      https://github.com/bluez/bluez/commit/140d3a65108e5c7c3f1fd137c04f437ab5e9159d
  Author: Pauli Virtanen <pav@iki.fi>
  Date:   2025-07-11 (Fri, 11 Jul 2025)

  Changed paths:
    M profiles/battery/battery.c

  Log Message:
  -----------
  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



To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-11 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11 17:46 [bluez/bluez] 140d3a: profiles/battery: handle reversed ordering of CCC Pauli Virtanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).