trivial: Add fu_udev_device_get_number()

This commit is contained in:
Richard Hughes 2020-09-25 20:04:44 +01:00
parent 44ae2a75e4
commit 496fb826f1
3 changed files with 25 additions and 0 deletions

View File

@ -743,6 +743,29 @@ fu_udev_device_get_sysfs_path (FuUdevDevice *self)
return NULL;
}
/**
* fu_udev_device_get_number:
* @self: A #FuUdevDevice
*
* Gets the device number, if any.
*
* Returns: integer, 0 if the data is unavailable, or %G_MAXUINT64 if the
* feature is not available
*
* Since: 1.5.0
**/
guint64
fu_udev_device_get_number (FuUdevDevice *self)
{
#ifdef HAVE_GUDEV
FuUdevDevicePrivate *priv = GET_PRIVATE (self);
g_return_val_if_fail (FU_IS_UDEV_DEVICE (self), 0);
if (priv->udev_device != NULL)
return fu_common_strtoull (g_udev_device_get_number (priv->udev_device));
#endif
return G_MAXUINT64;
}
/**
* fu_udev_device_get_vendor:
* @self: A #FuUdevDevice

View File

@ -66,6 +66,7 @@ guint32 fu_udev_device_get_model (FuUdevDevice *self);
guint32 fu_udev_device_get_subsystem_vendor (FuUdevDevice *self);
guint32 fu_udev_device_get_subsystem_model (FuUdevDevice *self);
guint8 fu_udev_device_get_revision (FuUdevDevice *self);
guint64 fu_udev_device_get_number (FuUdevDevice *self);
guint fu_udev_device_get_slot_depth (FuUdevDevice *self,
const gchar *subsystem);
gboolean fu_udev_device_set_physical_id (FuUdevDevice *self,

View File

@ -652,6 +652,7 @@ LIBFWUPDPLUGIN_1.5.0 {
fu_security_attrs_new;
fu_security_attrs_remove_all;
fu_security_attrs_to_variant;
fu_udev_device_get_number;
fu_udev_device_get_subsystem_model;
fu_udev_device_get_subsystem_vendor;
local: *;