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.
This commit is contained in:
Dan Williams
2010-10-22 11:06:48 -05:00
parent 328d2369a9
commit 7ae8ffe21b
60 changed files with 716 additions and 94 deletions
+16 -2
View File
@@ -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;
}