summaryrefslogtreecommitdiff
path: root/profiles/battery
diff options
context:
space:
mode:
authorSonny Sasaka <sonnysasaka@chromium.org>2021-03-30 11:38:35 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-03-30 12:12:44 -0700
commit09080c0022ba11ddf70b8b0c4f5119072017e04e (patch)
tree991234d70eee0b18103d34b59b0c89caa72f786e /profiles/battery
parent9f11632b1fca71af4ae7de58ea757a5bf7de20da (diff)
downloadbluez-09080c0022ba11ddf70b8b0c4f5119072017e04e.tar.gz
profiles/battery: Reset battery value cache on disconnect
Due to cache in batt object, bluetoothd fails to update publish the battery value after reconnection when the battery value does not change compared to before reconnection. We should reset the battery percentage cache on disconnect. Reviewed-by: Alain Michaud <alainm@chromium.org>
Diffstat (limited to 'profiles/battery')
-rw-r--r--profiles/battery/battery.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 81f849d57..176d127f6 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -75,6 +75,7 @@ static void batt_free(struct batt *batt)
static void batt_reset(struct batt *batt)
{
batt->attr = NULL;
+ batt->percentage = -1;
gatt_db_unref(batt->db);
batt->db = NULL;
bt_gatt_client_unref(batt->client);