diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:23 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:23 +0100 |
commit | 7fbee6ce27176bfc7ae9b34a4de9452cf5f6fa43 (patch) | |
tree | 5cabb0ab457846912d99ef675160be0dce4fbe6f /plugins/mm-plugin-sierra.c | |
parent | dc645b92b9a7db3076ae34986ac219d01677d124 (diff) |
Imported Upstream version 0.4+git.20110124t203624.00b6cceupstream/0.4+git.20110124t203624.00b6cce
Diffstat (limited to 'plugins/mm-plugin-sierra.c')
-rw-r--r-- | plugins/mm-plugin-sierra.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/plugins/mm-plugin-sierra.c b/plugins/mm-plugin-sierra.c index 8ace653..b7367ab 100644 --- a/plugins/mm-plugin-sierra.c +++ b/plugins/mm-plugin-sierra.c @@ -90,17 +90,28 @@ supports_port (MMPluginBase *base, { GUdevDevice *port; guint32 cached = 0, level; - const char *driver; + const char *driver, *subsys; /* 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")) + if (!port) return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED; driver = mm_plugin_base_supports_task_get_driver (task); - if (!driver || strcmp (driver, "sierra")) + if (!driver || (strcmp (driver, "sierra") && strcmp (driver, "sierra_net"))) return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED; + subsys = g_udev_device_get_subsystem (port); + g_assert (subsys); + if (!strcmp (subsys, "net")) { + /* Can't grab the net port until we know whether this is a CDMA or GSM device */ + if (!existing) + return MM_PLUGIN_SUPPORTS_PORT_DEFER; + + mm_plugin_base_supports_task_complete (task, 10); + return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS; + } + if (mm_plugin_base_get_cached_port_capabilities (base, port, &cached)) { level = get_level_for_capabilities (cached); if (level) { @@ -125,19 +136,14 @@ grab_port (MMPluginBase *base, { GUdevDevice *port = NULL; MMModem *modem = NULL; - const char *name, *subsys, *devfile, *sysfs_path; + const char *name, *subsys, *sysfs_path; guint32 caps; MMPortType ptype = MM_PORT_TYPE_UNKNOWN; + guint16 vendor = 0, product = 0; port = mm_plugin_base_supports_task_get_port (task); g_assert (port); - devfile = g_udev_device_get_device_file (port); - if (!devfile) { - g_set_error (error, 0, 0, "Could not get port's sysfs file."); - return NULL; - } - subsys = g_udev_device_get_subsystem (port); name = g_udev_device_get_name (port); @@ -145,19 +151,28 @@ grab_port (MMPluginBase *base, if (g_object_get_data (G_OBJECT (task), TAG_SIERRA_SECONDARY_PORT)) ptype = MM_PORT_TYPE_SECONDARY; + 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) { if ((caps & MM_PLUGIN_BASE_PORT_CAP_GSM) || (ptype != MM_PORT_TYPE_UNKNOWN)) { modem = mm_modem_sierra_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); } else if (caps & CAP_CDMA) { modem = mm_modem_sierra_cdma_new (sysfs_path, 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); } if (modem) { @@ -166,7 +181,16 @@ grab_port (MMPluginBase *base, return NULL; } } - } else if (get_level_for_capabilities (caps) || (ptype != MM_PORT_TYPE_UNKNOWN)) { + } else if ( get_level_for_capabilities (caps) + || (ptype != MM_PORT_TYPE_UNKNOWN) + || (strcmp (subsys, "net") == 0)) { + + /* FIXME: we don't yet know how to activate IP on CDMA devices using + * pseudo-ethernet ports. + */ + if (strcmp (subsys, "net") == 0 && MM_IS_MODEM_SIERRA_CDMA (modem)) + return modem; + modem = existing; if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error)) return NULL; |