aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-plugin-generic.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-10-22 11:06:48 -0500
committerDan Williams <dcbw@redhat.com>2010-10-22 11:06:48 -0500
commit7ae8ffe21b9e3bb350dac2f2d34d0711b3255d26 (patch)
tree83ee2518d8e349d383a3d58f4e82cc2666800b3a /plugins/mm-plugin-generic.c
parent328d2369a9dadfae786e4c524b5ff2fd0d1a9e17 (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 'plugins/mm-plugin-generic.c')
-rw-r--r--plugins/mm-plugin-generic.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/mm-plugin-generic.c b/plugins/mm-plugin-generic.c
index d6847fd7..9704ae84 100644
--- a/plugins/mm-plugin-generic.c
+++ b/plugins/mm-plugin-generic.c
@@ -112,6 +112,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path, *driver;
guint32 caps;
+ guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -133,6 +134,11 @@ grab_port (MMPluginBase *base,
}
}
+ if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
+ g_set_error (error, 0, 0, "Could not get modem product ID.");
+ return NULL;
+ }
+
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
@@ -141,11 +147,15 @@ grab_port (MMPluginBase *base,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)),
!!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856),
- !!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856_A));
+ !!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856_A),
+ vendor,
+ product);
} else if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_generic_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
- mm_plugin_get_name (MM_PLUGIN (base)));
+ mm_plugin_get_name (MM_PLUGIN (base)),
+ vendor,
+ product);
}
if (modem) {