diff options
author | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:20:16 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:20:16 -0500 |
commit | 91a58bbe3d6194abb3a92ba2e936c405ddc4ecdc (patch) | |
tree | 0722cdb2e3efbf6795764c34d961f193763eb9d0 | |
parent | 7c410a8d08f146d983d360f7048f113aa8680cca (diff) |
core: detect PCMCIA manfid and cardid
These aren't added to the udev device database by anything yet
(though they should be) so grab them manually.
-rw-r--r-- | src/mm-plugin-base.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index fe239363..e9000519 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -891,7 +891,7 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, { MMPluginBasePrivate *priv; GUdevDevice *device = NULL, *parent = NULL; - const char *vid, *pid, *parent_subsys; + const char *vid = NULL, *pid = NULL, *parent_subsys; gboolean success = FALSE; g_return_val_if_fail (self != NULL, FALSE); @@ -909,21 +909,34 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, if (!device) goto out; - /* Bluetooth devices report the VID/PID of the BT adapter here, which - * isn't really what we want. Just return null IDs instead. - */ parent = g_udev_device_get_parent (device); if (parent) { parent_subsys = g_udev_device_get_subsystem (parent); - if (parent_subsys && !strcmp (parent_subsys, "bluetooth")) { - success = TRUE; - goto out; + if (parent_subsys) { + if (!strcmp (parent_subsys, "bluetooth")) { + /* Bluetooth devices report the VID/PID of the BT adapter here, + * which isn't really what we want. Just return null IDs instead. + */ + success = TRUE; + goto out; + } else if (!strcmp (parent_subsys, "pcmcia")) { + /* For PCMCIA devices we need to grab the PCMCIA subsystem's + * manfid and cardid, since any IDs on the tty device itself + * may be from PCMCIA controller or something else. + */ + vid = g_udev_device_get_sysfs_attr (parent, "manf_id"); + pid = g_udev_device_get_sysfs_attr (parent, "card_id"); + if (!vid || !pid) + goto out; + } } } - vid = g_udev_device_get_property (device, "ID_VENDOR_ID"); + if (!vid) + vid = g_udev_device_get_property (device, "ID_VENDOR_ID"); if (!vid) goto out; + if (strncmp (vid, "0x", 2) == 0) vid += 2; if (strlen (vid) != 4) @@ -934,11 +947,13 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, *vendor |= (guint16) ((utils_hex2byte (vid) & 0xFF) << 8); } - pid = g_udev_device_get_property (device, "ID_MODEL_ID"); + if (!pid) + pid = g_udev_device_get_property (device, "ID_MODEL_ID"); if (!pid) { *vendor = 0; goto out; } + if (strncmp (pid, "0x", 2) == 0) pid += 2; if (strlen (pid) != 4) { |