diff options
author | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:14:34 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:14:34 -0500 |
commit | 7c410a8d08f146d983d360f7048f113aa8680cca (patch) | |
tree | 070351c0787d39d3e1414df125ab3fafc22b558f /src/mm-plugin-base.c | |
parent | 7ae8ffe21b9e3bb350dac2f2d34d0711b3255d26 (diff) |
core: strip "0x" off udev ID_VENDOR_ID and ID_MODEL_ID strings
Diffstat (limited to 'src/mm-plugin-base.c')
-rw-r--r-- | src/mm-plugin-base.c | 14 |
1 files changed, 12 insertions, 2 deletions
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; } |