diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/77-mm-ericsson-mbm.rules | 3 | ||||
-rw-r--r-- | plugins/mm-modem-huawei-cdma.c | 10 | ||||
-rw-r--r-- | plugins/mm-modem-sierra-gsm.c | 9 | ||||
-rw-r--r-- | plugins/mm-modem-zte.c | 66 |
4 files changed, 86 insertions, 2 deletions
diff --git a/plugins/77-mm-ericsson-mbm.rules b/plugins/77-mm-ericsson-mbm.rules index 71dc6b87..4c60a7a3 100644 --- a/plugins/77-mm-ericsson-mbm.rules +++ b/plugins/77-mm-ericsson-mbm.rules @@ -20,6 +20,9 @@ ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1909", ENV{ID_MM_ERICSSON_MBM}="1" # Ericsson C3607w ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1049", ENV{ID_MM_ERICSSON_MBM}="1" +# Ericsson C3607w v2 +ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="190b", ENV{ID_MM_ERICSSON_MBM}="1" + # Sony-Ericsson MD300 ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="d0cf", ENV{ID_MM_ERICSSON_MBM}="1" diff --git a/plugins/mm-modem-huawei-cdma.c b/plugins/mm-modem-huawei-cdma.c index 3b63a486..19b731a8 100644 --- a/plugins/mm-modem-huawei-cdma.c +++ b/plugins/mm-modem-huawei-cdma.c @@ -41,16 +41,26 @@ mm_modem_huawei_cdma_new (const char *device, gboolean evdo_rev0, gboolean evdo_revA) { + gboolean try_css = TRUE; + g_return_val_if_fail (device != NULL, NULL); g_return_val_if_fail (driver != NULL, NULL); g_return_val_if_fail (plugin != NULL, NULL); + /* Don't use AT+CSS on EVDO-capable hardware for determining registration + * status, because often the device will have only an EVDO connection and + * AT+CSS won't necessarily report EVDO registration status, only 1X. + */ + if (evdo_rev0 || evdo_revA) + try_css = FALSE; + return MM_MODEM (g_object_new (MM_TYPE_MODEM_HUAWEI_CDMA, MM_MODEM_MASTER_DEVICE, device, MM_MODEM_DRIVER, driver, MM_MODEM_PLUGIN, plugin, MM_GENERIC_CDMA_EVDO_REV0, evdo_rev0, MM_GENERIC_CDMA_EVDO_REVA, evdo_revA, + MM_GENERIC_CDMA_REGISTRATION_TRY_CSS, try_css, NULL)); } diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c index ee82234a..c2240908 100644 --- a/plugins/mm-modem-sierra-gsm.c +++ b/plugins/mm-modem-sierra-gsm.c @@ -117,9 +117,16 @@ grab_port (MMModem *modem, port = mm_generic_gsm_grab_port (gsm, subsys, name, ptype, error); - if (port && MM_IS_SERIAL_PORT (port)) + if (port && MM_IS_SERIAL_PORT (port)) { + GRegex *regex; + g_object_set (G_OBJECT (port), MM_PORT_CARRIER_DETECT, FALSE, NULL); + regex = g_regex_new ("\\r\\n\\+PACSP0\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); + mm_serial_port_add_unsolicited_msg_handler (MM_SERIAL_PORT (port), regex, NULL, NULL, NULL); + g_regex_unref (regex); + } + return !!port; } diff --git a/plugins/mm-modem-zte.c b/plugins/mm-modem-zte.c index 92c23aeb..6198a60b 100644 --- a/plugins/mm-modem-zte.c +++ b/plugins/mm-modem-zte.c @@ -32,6 +32,8 @@ G_DEFINE_TYPE_EXTENDED (MMModemZte, mm_modem_zte, MM_TYPE_GENERIC_GSM, 0, typedef struct { gboolean init_retried; + guint32 cpms_tries; + guint cpms_timeout; } MMModemZtePrivate; MMModem * @@ -54,6 +56,52 @@ mm_modem_zte_new (const char *device, /* Modem class override functions */ /*****************************************************************************/ +static void cpms_try_done (MMSerialPort *port, + GString *response, + GError *error, + gpointer user_data); + +static gboolean +cpms_timeout_cb (gpointer user_data) +{ + MMCallbackInfo *info = user_data; + MMModem *modem = info->modem; + MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (modem); + MMSerialPort *primary; + + priv->cpms_timeout = 0; + + primary = mm_generic_gsm_get_port (MM_GENERIC_GSM (modem), MM_PORT_TYPE_PRIMARY); + mm_serial_port_queue_command (primary, "+CPMS?", 10, cpms_try_done, info); + return FALSE; +} + +static void +cpms_try_done (MMSerialPort *port, + GString *response, + GError *error, + gpointer user_data) +{ + MMCallbackInfo *info = user_data; + MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (info->modem); + + if (error && g_error_matches (error, MM_MOBILE_ERROR, MM_MOBILE_ERROR_SIM_BUSY)) { + if (priv->cpms_tries++ < 4) { + if (priv->cpms_timeout) + g_source_remove (priv->cpms_timeout); + + /* Have to try a few times; sometimes the SIM is busy */ + priv->cpms_timeout = g_timeout_add_seconds (2, cpms_timeout_cb, info); + return; + } else { + /* oh well, proceed... */ + error = NULL; + } + } + + mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info); +} + static void init_modem_done (MMSerialPort *port, GString *response, @@ -62,7 +110,12 @@ init_modem_done (MMSerialPort *port, { MMCallbackInfo *info = (MMCallbackInfo *) user_data; - mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info); + /* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that + * eventually fill up the device's buffers and make it crash. Normally + * done during probing, but if the device has a PIN enabled it won't + * accept the +CPMS? during the probe and we have to do it here. + */ + mm_serial_port_queue_command (port, "+CPMS?", 10, cpms_try_done, info); } static void @@ -222,6 +275,16 @@ mm_modem_zte_init (MMModemZte *self) } static void +dispose (GObject *object) +{ + MMModemZte *self = MM_MODEM_ZTE (object); + MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (self); + + if (priv->cpms_timeout) + g_source_remove (priv->cpms_timeout); +} + +static void mm_modem_zte_class_init (MMModemZteClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -230,6 +293,7 @@ mm_modem_zte_class_init (MMModemZteClass *klass) mm_modem_zte_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (object_class, sizeof (MMModemZtePrivate)); + object_class->dispose = dispose; gsm_class->do_enable = do_enable; } |