Commit 0a247484 authored by Christian Kellner's avatar Christian Kellner
Browse files

sysfs: helper to get the uid for a device

Add a new helper to get the unique id (uid) for a device. It uses
the new define in bolt-names.h for the sysfs attribute.
parent 81312ba5
......@@ -32,6 +32,30 @@
#include <libudev.h>
#include <sys/stat.h>
const char *
bolt_sysfs_device_get_unique_id (struct udev_device *dev,
GError **error)
const char *uid;
g_return_val_if_fail (dev != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
uid = udev_device_get_sysattr_value (dev, BOLT_SYSFS_UNIQUE_ID);
if (uid == NULL)
const char *path = udev_device_get_syspath (dev);
g_set_error (error, BOLT_ERROR, BOLT_ERROR_UDEV,
"could not get unique_id for %s",
return NULL;
return uid;
bolt_sysfs_device_get_time (struct udev_device *udev,
BoltStatTime st)
......@@ -31,6 +31,9 @@ struct udev_device;
const char * bolt_sysfs_device_get_unique_id (struct udev_device *dev,
GError **error);
typedef enum BoltStatTime {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment