According to Anton Vorontsov (Linux power supply maintainer) power supplies should not export a present property when they are not hotpluggable and users of the properties should handle supplies without present-property as always present.
This patch implements this feature using an additional sysfs_file_exists call before sysfs_get_bool. --- src/linux/up-device-supply.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index d272e36..9da4861 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -516,7 +516,11 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply) native_path = g_udev_device_get_sysfs_path (native); /* have we just been removed? */ - is_present = sysfs_get_bool (native_path, "present"); + if (sysfs_file_exists (native_path, "present")) + is_present = sysfs_get_bool (native_path, "present"); + else + /* when no present property exists, handle as present */ + is_present = 1; g_object_set (device, "is-present", is_present, NULL); if (!is_present) { up_device_supply_reset_values (supply); -- 1.7.2.3 _______________________________________________ devkit-devel mailing list devkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/devkit-devel