summaryrefslogtreecommitdiff
path: root/src/linux/up-device-supply.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linux/up-device-supply.c')
-rw-r--r--src/linux/up-device-supply.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 3ebbd88..4236ce4 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -682,8 +682,9 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
state = up_device_supply_get_state (native);
/* this is the new value in uW */
- energy_rate = fabs (g_udev_device_get_sysfs_attr_as_double_uncached (native, "power_now") / 1000000.0);
- if (energy_rate < 0.01) {
+ if (g_udev_device_has_sysfs_attr (native, "power_now")) {
+ energy_rate = fabs (g_udev_device_get_sysfs_attr_as_double_uncached (native, "power_now") / 1000000.0);
+ } else {
gdouble charge_full;
/* convert charge to energy */