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.
This commit is contained in:
@@ -49,6 +49,7 @@ full_functionality_status_ready (MMBaseModem *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
const gchar **drivers;
|
const gchar **drivers;
|
||||||
|
gboolean is_new_sierra = FALSE;
|
||||||
|
|
||||||
if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error)) {
|
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_take_error (simple, error);
|
||||||
@@ -57,23 +58,21 @@ full_functionality_status_ready (MMBaseModem *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Old Sierra devices (like the PCMCIA-based 860) return OK on +CFUN=1 right
|
/* Most Sierra devices return OK immediately in response to CFUN=1 but
|
||||||
* away but need some time to finish initialization. Anything driven by
|
* need some time to finish powering up. Give more time for older devices
|
||||||
* 'sierra' is new enough to need no delay.
|
* like the AC860, which aren't driven by the 'sierra' driver.
|
||||||
*/
|
*/
|
||||||
drivers = mm_base_modem_get_drivers (MM_BASE_MODEM (self));
|
drivers = mm_base_modem_get_drivers (MM_BASE_MODEM (self));
|
||||||
for (i = 0; drivers[i]; i++) {
|
for (i = 0; drivers[i]; i++) {
|
||||||
if (g_str_equal (drivers[i], "sierra")) {
|
if (g_str_equal (drivers[i], "sierra")) {
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
is_new_sierra = TRUE;
|
||||||
g_simple_async_result_complete (simple);
|
break;
|
||||||
g_object_unref (simple);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The modem object will be valid in the callback as 'result' keeps a
|
/* The modem object will be valid in the callback as 'result' keeps a
|
||||||
* reference to it. */
|
* 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
|
static void
|
||||||
|
Reference in New Issue
Block a user