From 7c410a8d08f146d983d360f7048f113aa8680cca Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 22 Oct 2010 11:14:34 -0500 Subject: core: strip "0x" off udev ID_VENDOR_ID and ID_MODEL_ID strings --- src/mm-plugin-base.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/mm-plugin-base.c') diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index b34ec50a..fe239363 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -922,7 +922,11 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, } vid = g_udev_device_get_property (device, "ID_VENDOR_ID"); - if (!vid || (strlen (vid) != 4)) + if (!vid) + goto out; + if (strncmp (vid, "0x", 2) == 0) + vid += 2; + if (strlen (vid) != 4) goto out; if (vendor) { @@ -931,7 +935,13 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, } pid = g_udev_device_get_property (device, "ID_MODEL_ID"); - if (!pid || (strlen (pid) != 4)) { + if (!pid) { + *vendor = 0; + goto out; + } + if (strncmp (pid, "0x", 2) == 0) + pid += 2; + if (strlen (pid) != 4) { *vendor = 0; goto out; } -- cgit v1.2.3-70-g09d2