diff options
author | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:06:48 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-10-22 11:06:48 -0500 |
commit | 7ae8ffe21b9e3bb350dac2f2d34d0711b3255d26 (patch) | |
tree | 83ee2518d8e349d383a3d58f4e82cc2666800b3a /src/mm-plugin-base.c | |
parent | 328d2369a9dadfae786e4c524b5ff2fd0d1a9e17 (diff) |
core: use hardware IDs as part of DeviceIdentifier
Pass the device's hardware IDs through modem creation and use them
when calculating the device's identifier. Add a bunch of testcases
for real hardware to ensure we don't break the device ID in the
future unless we really want to.
Diffstat (limited to 'src/mm-plugin-base.c')
-rw-r--r-- | src/mm-plugin-base.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 80d0f904..b34ec50a 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -890,8 +890,8 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, guint16 *product) { MMPluginBasePrivate *priv; - GUdevDevice *device = NULL; - const char *vid, *pid; + GUdevDevice *device = NULL, *parent = NULL; + const char *vid, *pid, *parent_subsys; gboolean success = FALSE; g_return_val_if_fail (self != NULL, FALSE); @@ -909,6 +909,18 @@ 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; + } + } + vid = g_udev_device_get_property (device, "ID_VENDOR_ID"); if (!vid || (strlen (vid) != 4)) goto out; @@ -934,6 +946,8 @@ mm_plugin_base_get_device_ids (MMPluginBase *self, out: if (device) g_object_unref (device); + if (parent) + g_object_unref (parent); return success; } |