summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-09-15 13:09:50 +0200
committerBastien Nocera <hadess@hadess.net>2021-06-17 12:00:18 +0200
commitfe9332cbe47ac2abbefb601ebf912fcd53e3fe50 (patch)
tree9364af8d32a7242e6854e0b9c38a0811a932fc88
parent2ab63bd81bde6b2265f531b0e65cdfe828996423 (diff)
downloadupower-fe9332cbe47ac2abbefb601ebf912fcd53e3fe50.tar.gz
linux: Use existing gudev functions in Watts-Up driver
-rw-r--r--src/linux/up-device-wup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/linux/up-device-wup.c b/src/linux/up-device-wup.c
index a7b00c1..a5e0d4c 100644
--- a/src/linux/up-device-wup.c
+++ b/src/linux/up-device-wup.c
@@ -296,10 +296,10 @@ up_device_wup_coldplug (UpDevice *device)
gboolean ret = FALSE;
const gchar *device_file;
const gchar *type;
- const gchar *native_path;
gchar *data;
const gchar *vendor;
const gchar *product;
+ g_autofree char *serial = NULL;
/* detect what kind of device we are */
native = G_UDEV_DEVICE (up_device_get_native (device));
@@ -358,7 +358,9 @@ up_device_wup_coldplug (UpDevice *device)
product = g_udev_device_get_property (native, "ID_PRODUCT");
/* hardcode some values */
- native_path = g_udev_device_get_sysfs_path (native);
+ serial = g_strdup (g_udev_device_get_sysfs_attr (native, "serial"));
+ if (serial)
+ g_strstrip (serial);
g_object_set (device,
"type", UP_DEVICE_KIND_MONITOR,
"is-rechargeable", FALSE,
@@ -366,7 +368,7 @@ up_device_wup_coldplug (UpDevice *device)
"is-present", FALSE,
"vendor", vendor,
"model", product,
- "serial", g_strstrip (sysfs_get_string (native_path, "serial")),
+ "serial", serial,
"has-history", TRUE,
"state", UP_DEVICE_STATE_DISCHARGING,
NULL);