Add the serio->firmare_id for UDev devices

If set, it is a device-specified InstanceID specifying the firmware stream.
This commit is contained in:
Richard Hughes 2020-12-01 11:08:08 +00:00
parent 7a63a4c41c
commit 70aca476d7

View File

@ -244,6 +244,28 @@ fu_udev_device_probe_i2c_dev (FuUdevDevice *self, GError **error)
}
return TRUE;
}
static gboolean
fu_udev_device_probe_serio (FuUdevDevice *self, GError **error)
{
FuUdevDevicePrivate *priv = GET_PRIVATE (self);
const gchar *tmp;
/* firmware ID */
tmp = g_udev_device_get_property (priv->udev_device, "SERIO_FIRMWARE_ID");
if (tmp != NULL) {
g_autofree gchar *devid = NULL;
g_autofree gchar *id_safe = NULL;
/* this prefix is not useful */
if (g_str_has_prefix (tmp, "PNP: "))
tmp += 5;
id_safe = g_utf8_strup (tmp, -1);
g_strdelimit (id_safe, " /\\\"", '-');
devid = g_strdup_printf ("SERIO\\FWID_%s", id_safe);
fu_device_add_instance_id (FU_DEVICE (self), devid);
}
return TRUE;
}
#endif
static gboolean
@ -459,6 +481,12 @@ fu_udev_device_probe (FuDevice *device, GError **error)
return FALSE;
}
/* add firmware_id */
if (g_strcmp0 (g_udev_device_get_subsystem (priv->udev_device), "serio") == 0) {
if (!fu_udev_device_probe_serio (self, error))
return FALSE;
}
/* determine if we're wired internally */
parent_i2c = g_udev_device_get_parent_with_subsystem (priv->udev_device,
"i2c", NULL);