mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 19:08:34 +00:00
fu-udev-device: add fu_udev_device_get_parent_name
This will fetch the name from parent device
This commit is contained in:
parent
224b685fae
commit
0d207d8dea
@ -943,6 +943,32 @@ fu_udev_device_pwrite (FuUdevDevice *self, goffset port, guint8 data, GError **e
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_udev_device_get_parent_name
|
||||||
|
* @self: A #FuUdevDevice
|
||||||
|
*
|
||||||
|
* Returns the name of the direct ancestor of this device
|
||||||
|
*
|
||||||
|
* Returns: string or NULL if unset or invalid
|
||||||
|
*
|
||||||
|
* Since: 1.4.2
|
||||||
|
**/
|
||||||
|
gchar *
|
||||||
|
fu_udev_device_get_parent_name (FuUdevDevice *self)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_GUDEV
|
||||||
|
FuUdevDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
|
g_autoptr(GUdevDevice) parent = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (FU_IS_UDEV_DEVICE (self), NULL);
|
||||||
|
|
||||||
|
parent = g_udev_device_get_parent (priv->udev_device);
|
||||||
|
return parent == NULL ? NULL : g_strdup (g_udev_device_get_name (parent));
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_udev_device_get_sysfs_attr:
|
* fu_udev_device_get_sysfs_attr:
|
||||||
* @self: A #FuUdevDevice
|
* @self: A #FuUdevDevice
|
||||||
|
@ -88,3 +88,4 @@ gboolean fu_udev_device_pread (FuUdevDevice *self,
|
|||||||
const gchar *fu_udev_device_get_sysfs_attr (FuUdevDevice *self,
|
const gchar *fu_udev_device_get_sysfs_attr (FuUdevDevice *self,
|
||||||
const gchar *attr,
|
const gchar *attr,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
gchar *fu_udev_device_get_parent_name (FuUdevDevice *self);
|
||||||
|
@ -583,6 +583,7 @@ LIBFWUPDPLUGIN_1.4.1 {
|
|||||||
|
|
||||||
LIBFWUPDPLUGIN_1.4.2 {
|
LIBFWUPDPLUGIN_1.4.2 {
|
||||||
global:
|
global:
|
||||||
|
fu_udev_device_get_parent_name;
|
||||||
fu_udev_device_get_sysfs_attr;
|
fu_udev_device_get_sysfs_attr;
|
||||||
local: *;
|
local: *;
|
||||||
} LIBFWUPDPLUGIN_1.4.1;
|
} LIBFWUPDPLUGIN_1.4.1;
|
||||||
|
Loading…
Reference in New Issue
Block a user