diff options
author | Dan Williams <dcbw@redhat.com> | 2009-12-11 10:48:23 -0800 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2009-12-11 10:48:23 -0800 |
commit | 41ea9a0e4bc3817fa060d54c7c7df7a8606eb9d1 (patch) | |
tree | 57fc838288fa97abfb5c2989b9ab2c3e1c44e782 | |
parent | 3d852435c6032cdae09659e103561a0ecac62b7e (diff) |
cdma: try +CSQ? if CSQ fails
Some modems want one, some modems want the other. Try both.
-rw-r--r-- | src/mm-generic-cdma.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index 9696bd62..5093d2b1 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -730,6 +730,8 @@ mm_generic_cdma_update_evdo_quality (MMGenericCdma *self, guint32 quality) } } +#define CSQ2_TRIED "csq?-tried" + static void get_signal_quality_done (MMSerialPort *port, GString *response, @@ -740,9 +742,19 @@ get_signal_quality_done (MMSerialPort *port, MMCallbackInfo *info = (MMCallbackInfo *) user_data; char *reply = response->str; - if (error) - info->error = g_error_copy (error); - else if (!strncmp (reply, "+CSQ: ", 6)) { + if (error) { + if (mm_callback_info_get_data (info, CSQ2_TRIED)) + info->error = g_error_copy (error); + else { + /* Some modems want +CSQ, others want +CSQ?, and some of both types + * will return ERROR if they don't get the command they want. So + * try the other command if the first one fails. + */ + mm_callback_info_set_data (info, CSQ2_TRIED, GUINT_TO_POINTER (1), NULL); + mm_serial_port_queue_command (port, "+CSQ?", 3, get_signal_quality_done, info); + return; + } + } else if (!strncmp (reply, "+CSQ: ", 6)) { /* Got valid reply */ int quality, ber; |