diff options
author | Dan Williams <dcbw@redhat.com> | 2011-01-04 14:06:03 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-01-04 14:06:03 -0600 |
commit | b0cd9288c260a821003a6259c78397d3ab7846a1 (patch) | |
tree | bb88e85ca476b951b39a667302aacc188f36f67d | |
parent | 63cb7f29a97719acd0810b42b42e09dbab461284 (diff) |
cdma: fix CDMA registration state retrieval on single AT port devices
If the device only has one AT port that's being used for data and
thus we can't do more specific registration checking in MMGenericCdma
using AT commands, but generic registration checking was successful,
just use the less specific state.
Previously, an error would be returned when no AT port was available
even though less specific QCDM registration checking worked. That
was just stupid.
-rw-r--r-- | src/mm-generic-cdma.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index f3e99d1a..e453d1d8 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -1584,6 +1584,12 @@ real_query_registration_state (MMGenericCdma *self, port = mm_generic_cdma_get_best_at_port (self, &info->error); if (!port) { + /* If we can't get an AT port, but less specific registration checks + * were successful, just use that and don't return an error. + */ + if ( cur_cdma_state != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN + || cur_evdo_state != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) + g_clear_error (&info->error); mm_callback_info_schedule (info); return; } @@ -1722,7 +1728,7 @@ reg_hdrstate_cb (MMQcdmSerialPort *port, /* Get HDR subsystem state to determine EVDO registration when in 1X mode */ result = qcdm_cmd_hdr_subsys_state_info_result ((const char *) response->data, response->len, - &info->error); + NULL); if (result) { guint8 session_state = QCDM_CMD_HDR_SUBSYS_STATE_INFO_SESSION_STATE_CLOSED; guint8 almp_state = QCDM_CMD_HDR_SUBSYS_STATE_INFO_ALMP_STATE_INACTIVE; @@ -1801,19 +1807,24 @@ reg_cmstate_cb (MMQcdmSerialPort *port, MMAtSerialPort *at_port = NULL; QCDMResult *result = NULL; guint32 opmode = 0, sysmode = 0; + GError *qcdm_error = NULL; /* Parse the response */ if (!error) - result = qcdm_cmd_cm_subsys_state_info_result ((const char *) response->data, response->len, &info->error); + result = qcdm_cmd_cm_subsys_state_info_result ((const char *) response->data, response->len, &qcdm_error); if (!result) { /* If there was some error, fall back to use +CAD like we did before QCDM */ if (info->modem) at_port = mm_generic_cdma_get_best_at_port (MM_GENERIC_CDMA (info->modem), &info->error); + else + info->error = g_error_copy (qcdm_error); + if (at_port) mm_at_serial_port_queue_command (at_port, "+CAD?", 3, get_analog_digital_done, info); else mm_callback_info_schedule (info); + g_clear_error (&qcdm_error); return; } |