aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-10-30 16:16:25 -0500
committerDan Williams <dcbw@redhat.com>2012-10-30 16:16:25 -0500
commit814febe1fd9baacdb33c79f11c140187df36c4f1 (patch)
tree49fa754bda1d12d254a9acb2345e895ddb8f03cb
parentbee7f0b83fff0c86ae994c75892eef6a4a9584ab (diff)
sierra: fix CFUN power up delay handling
1) all Sierra devices appear to require short delay after powering up, otherwise subsequent commands may return errors. Older devices need longer so ensure new devices are penalized just for being new. 2) When the modem is already in full functionality status and no power up command was sent, there's no need to delay, which was happening regardless of what state the modem was already in. Detect whether the power up was actually executed (response and error will be NULL) and only delay if it was executed.
-rw-r--r--plugins/mm-modem-sierra-gsm.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index 3737bf5e..67369542 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -582,6 +582,7 @@ real_do_enable_power_up_done (MMGenericGsm *gsm,
{
MMModemSierraGsmPrivate *priv = MM_MODEM_SIERRA_GSM_GET_PRIVATE (gsm);
char *driver = NULL;
+ guint seconds = 5;
if (error) {
/* Chain up to parent */
@@ -589,17 +590,28 @@ real_do_enable_power_up_done (MMGenericGsm *gsm,
return;
}
- /* Old Sierra devices (like the PCMCIA-based 860) return OK on +CFUN=1 right
- * away but need some time to finish initialization. Anything driven by
- * 'sierra' is new enough to need no delay.
+ if (response == NULL) {
+ /* If both error and response are NULL, that means the modem was already
+ * powered up and the power-up command was skipped. So we don't need to
+ * wait for the modem to settle after CFUN=1 is sent.
+ */
+ sierra_enabled (info);
+ return;
+ }
+
+ /* Most Sierra devices return OK immediately in response to CFUN=1 but
+ * need some time to finish powering up.
*/
+ g_warn_if_fail (priv->enable_wait_id == 0);
g_object_get (G_OBJECT (gsm), MM_MODEM_DRIVER, &driver, NULL);
- if (g_strcmp0 (driver, "sierra") == 0)
- sierra_enabled (info);
- else {
- g_warn_if_fail (priv->enable_wait_id == 0);
- priv->enable_wait_id = g_timeout_add_seconds (10, sierra_enabled, info);
+ if (g_strcmp0 (driver, "sierra") != 0) {
+ /* more time for older devices like the AC860, which aren't driven
+ * by the 'sierra' driver.
+ */
+ seconds = 10;
}
+
+ priv->enable_wait_id = g_timeout_add_seconds (seconds, sierra_enabled, info);
}
static void