diff options
author | Benjamin Berg <benjamin@sipsolutions.net> | 2022-09-08 21:09:22 +0200 |
---|---|---|
committer | Benjamin Berg <benjamin@sipsolutions.net> | 2022-09-09 16:28:11 +0200 |
commit | c2e48aa9c29cff92bda60607266dbe4da10b95fd (patch) | |
tree | 4cc7bc537cadfed767d5370386cb07089313bcd2 | |
parent | b1edcc7cbb2b90cc1cfebce7dcca0b92cf66c164 (diff) | |
download | upower-c2e48aa9c29cff92bda60607266dbe4da10b95fd.tar.gz |
supply-battery: Assume battery is present if the attr is missing
Fixes: #208
-rw-r--r-- | src/linux/up-device-supply-battery.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/linux/up-device-supply-battery.c b/src/linux/up-device-supply-battery.c index bef5857..f37c8a4 100644 --- a/src/linux/up-device-supply-battery.c +++ b/src/linux/up-device-supply-battery.c @@ -145,7 +145,9 @@ up_device_supply_battery_refresh (UpDevice *device, * we can restrict this to updates other than UP_REFRESH_POLL. * NOTE: Only energy.full and cycle_count can change for a battery. */ - info.present = g_udev_device_get_sysfs_attr_as_boolean_uncached (native, "present"); + info.present = TRUE; + if (g_udev_device_has_sysfs_attr (native, "present")) + info.present = g_udev_device_get_sysfs_attr_as_boolean_uncached (native, "present"); if (!info.present) { up_device_battery_update_info (battery, &info); return TRUE; |