aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-07-06 15:36:18 -0500
committerDan Williams <dcbw@redhat.com>2011-07-06 15:50:08 -0500
commit1e1bfbf1d808e557441afdae44447af457dae7ff (patch)
tree004d788e3e26cbbadda25c9afb1408136c4a5d07
parent0f6d1b2b42afe48583c9c3e7c159be4353462d86 (diff)
cinterion: bail earlier if the plugin doesn't support the port
Caused a crash with the Sierra plugin due to an assertion failure; the Cinterion plugin shouldn't claim to possibly support ports it knows it won't support. In this case, it claimed to support Sierra modems, so it would try to run probing after Sierra had done so. Ideally this should work, but for now just make sure the Cinterion plugin doesn't claim to support these ports when it knows it doesn't.
-rw-r--r--plugins/mm-plugin-cinterion.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/mm-plugin-cinterion.c b/plugins/mm-plugin-cinterion.c
index 5c14722f..23a9ebbf 100644
--- a/plugins/mm-plugin-cinterion.c
+++ b/plugins/mm-plugin-cinterion.c
@@ -123,12 +123,29 @@ supports_port (MMPluginBase *base,
{
GUdevDevice *port;
guint32 cached = 0;
+ const char *subsys, *name;
+ guint16 vendor = 0;
/* Can't do anything with non-serial ports */
port = mm_plugin_base_supports_task_get_port (task);
if (strcmp (g_udev_device_get_subsystem (port), "tty"))
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+ /* If we can get the vendor ID from udev then we can short-circuit
+ * the vendor name checks.
+ */
+ subsys = g_udev_device_get_subsystem (port);
+ name = g_udev_device_get_name (port);
+ if (mm_plugin_base_get_device_ids (base, subsys, name, &vendor, NULL)) {
+ /* Vendors: Cinterion (0x1e2d)
+ * Siemens (0x0681)
+ * Also including 0 just in case the ports are platform serial ports
+ * which this plugin does need to check support for.
+ */
+ if (vendor != 0x1e2d && vendor != 0x0681 && vendor != 0)
+ return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
+ }
+
/* First thing to check in this plugin is if we got capabilities already.
* This is because we have a later check of the probed vendor, which is
* taken also during port probing.