From 3452140a6cf07d730ec267e08c3378587477b013 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Thu, 19 Dec 2024 14:31:07 +0800 Subject: [PATCH] src: up-device-battery: Reset values when the battery is not present If the battery is not present, reset the attribute values. Resolves: #292 --- src/up-device-battery.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/up-device-battery.c b/src/up-device-battery.c index b6e04d0..ad5e19b 100644 --- a/src/up-device-battery.c +++ b/src/up-device-battery.c @@ -595,16 +595,21 @@ up_device_battery_update_info (UpDeviceBattery *self, UpBatteryInfo *info) "vendor", NULL, "model", NULL, "serial", NULL, + "state", UP_DEVICE_STATE_UNKNOWN, "technology", UP_DEVICE_TECHNOLOGY_UNKNOWN, "capacity", (gdouble) 0.0, + "energy", (gdouble) 0.0, "energy-full", (gdouble) 0.0, "energy-full-design", (gdouble) 0.0, + "voltage", (gdouble) 0.0, "charge-cycles", -1, "has-history", FALSE, "has-statistics", FALSE, + "percentage", (gdouble) 0.0, + "temperature", (gdouble) 0.0, "update-time", (guint64) g_get_real_time () / G_USEC_PER_SEC, "charge-start-threshold", 0, - "charge-end-threshold", 100, + "charge-end-threshold", 0, "charge-threshold-enabled", FALSE, "charge-threshold-supported", FALSE, NULL);