mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 19:18:11 +02:00
up-device-battery: show support status for battery charging threshold
If the charging threshold is supported, the ChargeThresholdSupported will be True. Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
parent
3df2599629
commit
a955bae8c4
3 changed files with 8 additions and 3 deletions
|
|
@ -224,10 +224,13 @@ up_device_supply_battery_refresh (UpDevice *device,
|
|||
}
|
||||
info.technology = up_convert_device_technology (get_sysfs_attr_uncached (native, "technology"));
|
||||
|
||||
if (up_device_supply_battery_get_charge_control_limits (native, &info))
|
||||
info.charge_control_enabled = TRUE;
|
||||
else
|
||||
if (up_device_supply_battery_get_charge_control_limits (native, &info)) {
|
||||
info.charge_control_supported = TRUE;
|
||||
info.charge_control_enabled = FALSE;
|
||||
} else {
|
||||
info.charge_control_enabled = FALSE;
|
||||
info.charge_control_supported = FALSE;
|
||||
}
|
||||
|
||||
/* NOTE: We used to warn about full > design, but really that is prefectly fine to happen. */
|
||||
|
||||
|
|
|
|||
|
|
@ -445,6 +445,7 @@ up_device_battery_update_info (UpDeviceBattery *self, UpBatteryInfo *info)
|
|||
"technology", info->technology,
|
||||
"has-history", TRUE,
|
||||
"has-statistics", TRUE,
|
||||
"charge-threshold-supported", info->charge_control_supported,
|
||||
NULL);
|
||||
|
||||
priv->present = TRUE;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ typedef struct {
|
|||
|
||||
/* battery charging threshold */
|
||||
gboolean charge_control_enabled;
|
||||
gboolean charge_control_supported;
|
||||
guint charge_control_start_threshold;
|
||||
guint charge_control_end_threshold;
|
||||
} UpBatteryInfo;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue