mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 06:33:49 +00:00
trivial: Add fu_udev_device_get_sysfs_attr_uint64() for future code
This commit is contained in:
parent
5dd2453012
commit
fe180cbf5d
@ -1594,6 +1594,41 @@ fu_udev_device_get_sysfs_attr(FuUdevDevice *self, const gchar *attr, GError **er
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_udev_device_get_sysfs_attr_uint64:
|
||||
* @self: a #FuUdevDevice
|
||||
* @attr: name of attribute to get
|
||||
* @value: (out) (optional): value to return
|
||||
* @error: (nullable): optional return location for an error
|
||||
*
|
||||
* Reads an arbitrary sysfs attribute 'attr' associated with UDEV device as a uint64.
|
||||
*
|
||||
* Returns: %TRUE for success
|
||||
*
|
||||
* Since: 1.7.2
|
||||
**/
|
||||
gboolean
|
||||
fu_udev_device_get_sysfs_attr_uint64(FuUdevDevice *self,
|
||||
const gchar *attr,
|
||||
guint64 *value,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *tmp;
|
||||
guint64 tmp64;
|
||||
|
||||
g_return_val_if_fail(FU_IS_UDEV_DEVICE(self), FALSE);
|
||||
g_return_val_if_fail(attr != NULL, FALSE);
|
||||
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
|
||||
|
||||
tmp = fu_udev_device_get_sysfs_attr(self, attr, error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
tmp64 = fu_common_strtoull(tmp);
|
||||
if (value != NULL)
|
||||
*value = tmp64;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_udev_device_pread:
|
||||
* @self: a #FuUdevDevice
|
||||
|
@ -115,6 +115,11 @@ fu_udev_device_pread_full(FuUdevDevice *self,
|
||||
GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const gchar *
|
||||
fu_udev_device_get_sysfs_attr(FuUdevDevice *self, const gchar *attr, GError **error);
|
||||
gboolean
|
||||
fu_udev_device_get_sysfs_attr_uint64(FuUdevDevice *self,
|
||||
const gchar *attr,
|
||||
guint64 *value,
|
||||
GError **error);
|
||||
gchar *
|
||||
fu_udev_device_get_parent_name(FuUdevDevice *self);
|
||||
|
||||
|
@ -949,5 +949,6 @@ LIBFWUPDPLUGIN_1.7.1 {
|
||||
LIBFWUPDPLUGIN_1.7.2 {
|
||||
global:
|
||||
fu_context_has_hwid_flag;
|
||||
fu_udev_device_get_sysfs_attr_uint64;
|
||||
local: *;
|
||||
} LIBFWUPDPLUGIN_1.7.1;
|
||||
|
Loading…
Reference in New Issue
Block a user