diff options
author | Dan Williams <dcbw@redhat.com> | 2012-12-17 12:28:06 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-12-17 12:28:06 -0600 |
commit | 3f3987e09ee762e48c1d53cb42a1288ce9f332cb (patch) | |
tree | 309898825b5a09596b90ac2192ca8f337a18fff8 | |
parent | 38f9f1ce670748a359cbab16d9f8540573760afb (diff) |
sierra: always mark APPx ports as secondary
Some devices have more than one APP port with limited AT parsing. The
sierra plugin handled the first one fine, but depending on probing order
and other delays, the additional APP2 or APP3 ports could get selected
as the primary port, which just doesn't work. So ensure that APP
ports are always marked secondary no matter which one they are.
-rw-r--r-- | plugins/mm-plugin-sierra.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/plugins/mm-plugin-sierra.c b/plugins/mm-plugin-sierra.c index 277e03eb..bd8cb457 100644 --- a/plugins/mm-plugin-sierra.c +++ b/plugins/mm-plugin-sierra.c @@ -38,8 +38,8 @@ mm_plugin_create (void) /*****************************************************************************/ -#define TAG_SIERRA_APP1_PORT "sierra-app1-port" -#define TAG_SIERRA_APP_PPP_OK "sierra-app-ppp-ok" +#define TAG_SIERRA_APP_PORT "sierra-app-port" +#define TAG_SIERRA_APP1_PPP_OK "sierra-app1-ppp-ok" #define CAP_CDMA (MM_PLUGIN_BASE_PORT_CAP_IS707_A | \ MM_PLUGIN_BASE_PORT_CAP_IS707_P | \ @@ -69,25 +69,32 @@ handle_probe_response (MMPluginBase *self, } if (strstr (response, "APP1")) { - g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP1_PORT, GUINT_TO_POINTER (TRUE)); + g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP_PORT, GUINT_TO_POINTER (TRUE)); /* 885 can handle PPP on the APP ports, leaving the primary port open * for command and status while connected. Older modems (ie 8775) say * they can but fail during PPP. */ if (strstr (response, "C885") || strstr (response, "USB 306")) - g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP_PPP_OK, GUINT_TO_POINTER (TRUE)); + g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP1_PPP_OK, GUINT_TO_POINTER (TRUE)); /* For debugging: let users figure out if their device supports it or not */ if (getenv ("MM_SIERRA_APP1_PPP_OK")) { mm_dbg ("Sierra: APP1 PPP OK '%s'", response); - g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP_PPP_OK, GUINT_TO_POINTER (TRUE)); + g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP1_PPP_OK, GUINT_TO_POINTER (TRUE)); } mm_plugin_base_supports_task_complete (task, 10); return; } + if (strstr (response, "APP2") || strstr (response, "APP3") || strstr (response, "APP4")) { + /* Ensure the other APP ports don't get used as primary */ + g_object_set_data (G_OBJECT (task), TAG_SIERRA_APP_PORT, GUINT_TO_POINTER (TRUE)); + mm_plugin_base_supports_task_complete (task, 10); + return; + } + /* Not an app port, let the superclass handle the response */ MM_PLUGIN_BASE_CLASS (mm_plugin_sierra_parent_class)->handle_probe_response (self, task, cmd, response, error); } @@ -162,7 +169,7 @@ grab_port (MMPluginBase *base, MMPortType ptype; guint16 vendor = 0, product = 0; MMAtPortFlags pflags = MM_AT_PORT_FLAG_NONE; - gboolean sierra_app1_port; + gboolean sierra_app_port; port = mm_plugin_base_supports_task_get_port (task); g_assert (port); @@ -174,9 +181,9 @@ grab_port (MMPluginBase *base, ptype = mm_plugin_base_probed_capabilities_to_port_type (caps); /* Is it a GSM secondary port? */ - sierra_app1_port = !!g_object_get_data (G_OBJECT (task), TAG_SIERRA_APP1_PORT); - if (sierra_app1_port) { - if (g_object_get_data (G_OBJECT (task), TAG_SIERRA_APP_PPP_OK)) + sierra_app_port = !!g_object_get_data (G_OBJECT (task), TAG_SIERRA_APP_PORT); + if (sierra_app_port) { + if (g_object_get_data (G_OBJECT (task), TAG_SIERRA_APP1_PPP_OK)) pflags = MM_AT_PORT_FLAG_PPP; else pflags = MM_AT_PORT_FLAG_SECONDARY; @@ -196,7 +203,7 @@ grab_port (MMPluginBase *base, sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task); if (!existing) { - if ((caps & MM_PLUGIN_BASE_PORT_CAP_GSM) || sierra_app1_port) { + if ((caps & MM_PLUGIN_BASE_PORT_CAP_GSM) || sierra_app_port) { modem = mm_modem_sierra_gsm_new (sysfs_path, mm_plugin_base_supports_task_get_driver (task), mm_plugin_get_name (MM_PLUGIN (base)), |