src: up-device-battery: Reset values when the battery is not present

If the battery is not present, reset the attribute values.

Resolves: #292
This commit is contained in:
Kate Hsuan 2024-12-19 14:31:07 +08:00
parent 6bd8cd90b3
commit 3452140a6c

View file

@ -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);