From 50638657cc87d1c114af59f83b543943dd9c4b77 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 22 Jun 2020 20:33:41 -0500 Subject: [PATCH] modem-manager: read the vendor ID directly from sysfs attribute Fixes: #2209 --- plugins/modem-manager/fu-mm-device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/modem-manager/fu-mm-device.c b/plugins/modem-manager/fu-mm-device.c index 8d8af9b5f..b8a6dedfc 100644 --- a/plugins/modem-manager/fu-mm-device.c +++ b/plugins/modem-manager/fu-mm-device.c @@ -243,6 +243,18 @@ fu_mm_device_probe_default (FuDevice *device, GError **error) fu_device_set_version (device, version); for (guint i = 0; device_ids[i] != NULL; i++) fu_device_add_instance_id (device, device_ids[i]); + if (fu_device_get_vendor_id (device) == NULL) { + g_autofree gchar *path = g_build_filename (device_sysfs_path, "idVendor", NULL); + g_autofree gchar *value = NULL; + g_autoptr(GError) error_local = NULL; + + if (!g_file_get_contents (path, &value, NULL, &error_local)) { + g_warning ("failed to set vendor ID: %s", error_local->message); + } else { + g_autofree gchar *vendor_id = g_strdup_printf ("USB:0x%s", value); + fu_device_set_vendor_id (device, vendor_id); + } + } /* convert the instance IDs to GUIDs */ fu_device_convert_instance_ids (device);