diff options
author | Dan Williams <dcbw@redhat.com> | 2012-11-05 16:29:30 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-11-05 16:30:33 -0600 |
commit | 11db2ea38093bc8d1bb1424cfca84abf3b66185c (patch) | |
tree | 599e91340c64b546d4a9b43f42f8acd680aeb091 | |
parent | 5a16f2aff10660bdf279a5ebbd0138f6aea6480a (diff) |
sierra: fix CFUN power up delay handling
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.
This is the port to git master of the following commit, for which we
don't need to do #2:
commit 814febe1fd9baacdb33c79f11c140187df36c4f1
Author: Dan Williams <dcbw@redhat.com>
Date: Tue Oct 30 16:16:25 2012 -0500
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/sierra/mm-common-sierra.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/sierra/mm-common-sierra.c b/plugins/sierra/mm-common-sierra.c index e76c3667..65c3c02b 100644 --- a/plugins/sierra/mm-common-sierra.c +++ b/plugins/sierra/mm-common-sierra.c @@ -46,37 +46,36 @@ full_functionality_status_ready (MMBaseModem *self, GAsyncResult *res, GSimpleAsyncResult *simple) { GError *error = NULL; guint i; const gchar **drivers; + gboolean is_new_sierra = FALSE; if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error)) { g_simple_async_result_take_error (simple, error); g_simple_async_result_complete (simple); g_object_unref (simple); 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. + /* Most Sierra devices return OK immediately in response to CFUN=1 but + * need some time to finish powering up. Give more time for older devices + * like the AC860, which aren't driven by the 'sierra' driver. */ drivers = mm_base_modem_get_drivers (MM_BASE_MODEM (self)); for (i = 0; drivers[i]; i++) { if (g_str_equal (drivers[i], "sierra")) { - g_simple_async_result_set_op_res_gboolean (simple, TRUE); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; + is_new_sierra = TRUE; + break; } } /* The modem object will be valid in the callback as 'result' keeps a * reference to it. */ - g_timeout_add_seconds (10, (GSourceFunc)sierra_power_up_wait_cb, simple); + g_timeout_add_seconds (is_new_sierra ? 5 : 10, (GSourceFunc)sierra_power_up_wait_cb, simple); } static void get_current_functionality_status_ready (MMBaseModem *self, GAsyncResult *res, GSimpleAsyncResult *simple) |