summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@amd.com>2023-02-17 13:02:53 -0600
committerBastien Nocera <hadess@hadess.net>2023-02-21 15:19:46 +0100
commit0b7d7cfc08bfb6ee4e783c8956fd7e0bd330d7a3 (patch)
tree64a01d7c09eab0a554080640a99b3e52f9dd8e9a
parent6b7ffaaa161d6bd3b087ab8812d8a850f71d1609 (diff)
downloadupower-0b7d7cfc08bfb6ee4e783c8956fd7e0bd330d7a3.tar.gz
linux: Fix is-present for devices at startup
As will be documented in the kernel through this patch: https://patchwork.kernel.org/project/linux-pm/patch/20230220131018.1708991-1-hadess@hadess.net/
-rw-r--r--src/linux/up-device-supply.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 604ff54..795018b 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -262,6 +262,10 @@ up_device_supply_refresh_device (UpDeviceSupply *supply,
if (!supply->priv->has_coldplug_values) {
gchar *model_name;
gchar *serial_number;
+ gboolean is_present = TRUE;
+
+ if (g_udev_device_has_sysfs_attr_uncached (native, "present"))
+ is_present = g_udev_device_get_sysfs_attr_as_boolean_uncached (native, "present");
/* get values which may be blank */
model_name = up_device_supply_get_string (native, "model_name");
@@ -272,7 +276,7 @@ up_device_supply_refresh_device (UpDeviceSupply *supply,
up_make_safe_string (serial_number);
g_object_set (device,
- "is-present", TRUE,
+ "is-present", is_present,
"model", model_name,
"serial", serial_number,
"is-rechargeable", TRUE,