diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-08 15:59:12 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-12 09:39:20 +0100 |
commit | a9556289f0eea748e510edc3680e67395c876ed8 (patch) | |
tree | 2b99bddd3e791625e4fd532bd3106f12d2402990 | |
parent | 10745cb32c5fe3b77bfc95a2a1f51b0896435238 (diff) |
huawei: better detection of data port on some modems
Some devices (e173) appear to lie about NDIS support; GETPORTMODE reports NDIS
is enabled, but that port is actually the MDM port and responds to AT commands.
So, if we get a port reported as NDIS and none reported as MDM, use the one
reported as NDIS for PPP.
https://bugs.launchpad.net/ubuntu/+source/modemmanager/+bug/1057186
-rw-r--r-- | plugins/mm-plugin-huawei.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mm-plugin-huawei.c b/plugins/mm-plugin-huawei.c index fc1a23f1..534d1a3c 100644 --- a/plugins/mm-plugin-huawei.c +++ b/plugins/mm-plugin-huawei.c @@ -49,6 +49,7 @@ mm_plugin_create (void) #define TAG_HUAWEI_PCUI_PORT "huawei-pcui-port" #define TAG_HUAWEI_MODEM_PORT "huawei-modem-port" +#define TAG_HUAWEI_NDIS_PORT "huawei-ndis-port" #define TAG_HUAWEI_DIAG_PORT "huawei-diag-port" #define TAG_GETPORTMODE_SUPPORTED "getportmode-supported" @@ -114,7 +115,8 @@ getportmode_response_cb (MMPluginBaseSupportsTask *task, MMPlugin *plugin = mm_plugin_base_supports_task_get_plugin (task); cache_port_mode (plugin, response->str, "PCUI:", TAG_HUAWEI_PCUI_PORT); - cache_port_mode (plugin, response->str, "MDM:", TAG_HUAWEI_MODEM_PORT); + cache_port_mode (plugin, response->str, "MDM:", TAG_HUAWEI_MODEM_PORT); + cache_port_mode (plugin, response->str, "NDIS:", TAG_HUAWEI_NDIS_PORT); cache_port_mode (plugin, response->str, "DIAG:", TAG_HUAWEI_DIAG_PORT); g_object_set_data (G_OBJECT (plugin), TAG_GETPORTMODE_SUPPORTED, GUINT_TO_POINTER (1)); @@ -294,6 +296,10 @@ grab_port (MMPluginBase *base, pflags = MM_AT_PORT_FLAG_PRIMARY; else if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (base), TAG_HUAWEI_MODEM_PORT))) pflags = MM_AT_PORT_FLAG_PPP; + else if (!g_object_get_data (G_OBJECT (base), TAG_HUAWEI_MODEM_PORT) && + usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (base), TAG_HUAWEI_NDIS_PORT))) + /* If NDIS reported only instead of MDM, use it */ + pflags = MM_AT_PORT_FLAG_PPP; else if (!g_object_get_data (G_OBJECT (base), TAG_GETPORTMODE_SUPPORTED)) { /* If GETPORTMODE is not supported, we assume usbif 0 is the modem port */ if ((usbif == 0) && (ptype == MM_PORT_TYPE_AT)) { |