diff options
Diffstat (limited to 'src/mm-generic-cdma.c')
-rw-r--r-- | src/mm-generic-cdma.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index f3e99d1a..0a95e7b1 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -30,6 +30,7 @@ #include "mm-serial-parsers.h" #include "mm-modem-helpers.h" #include "libqcdm/src/commands.h" +#include "mm-log.h" #define MM_GENERIC_CDMA_PREV_STATE_TAG "prev-state" @@ -68,6 +69,8 @@ typedef struct { guint poll_id; + char *meid; + MMModemCdmaRegistrationState cdma_1x_reg_state; MMModemCdmaRegistrationState evdo_reg_state; @@ -1045,7 +1048,7 @@ get_signal_quality (MMModemCdma *modem, at_port = mm_generic_cdma_get_best_at_port (MM_GENERIC_CDMA (modem), &info->error); if (!at_port && !priv->qcdm) { - g_message ("Returning saved signal quality %d", priv->cdma1x_quality); + mm_dbg ("Returning saved signal quality %d", priv->cdma1x_quality); mm_callback_info_set_result (info, GUINT_TO_POINTER (priv->cdma1x_quality), NULL); mm_callback_info_schedule (info); return; @@ -1524,15 +1527,22 @@ reg_query_speri_done (MMAtSerialPort *port, if (!p || !mm_cdma_parse_eri (p, &roam, NULL, NULL)) goto done; - /* Change the 1x and EVDO registration states to roaming if they were - * anything other than UNKNOWN. - */ if (roam) { + /* Change the 1x and EVDO registration states to roaming if they were + * anything other than UNKNOWN. + */ if (mm_generic_cdma_query_reg_state_get_callback_1x_state (info)) mm_generic_cdma_query_reg_state_set_callback_1x_state (info, MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING); if (mm_generic_cdma_query_reg_state_get_callback_evdo_state (info)) mm_generic_cdma_query_reg_state_set_callback_evdo_state (info, MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING); + } else { + /* Change 1x and/or EVDO registration state to home if home/roaming wasn't previously known */ + if (mm_generic_cdma_query_reg_state_get_callback_1x_state (info) == MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED) + mm_generic_cdma_query_reg_state_set_callback_1x_state (info, MM_MODEM_CDMA_REGISTRATION_STATE_HOME); + + if (mm_generic_cdma_query_reg_state_get_callback_evdo_state (info) == MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED) + mm_generic_cdma_query_reg_state_set_callback_evdo_state (info, MM_MODEM_CDMA_REGISTRATION_STATE_HOME); } done: @@ -1584,6 +1594,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 +1738,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 +1817,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; } @@ -1856,8 +1877,8 @@ get_registration_state (MMModemCdma *modem, port = mm_generic_cdma_get_best_at_port (MM_GENERIC_CDMA (modem), &info->error); if (!port && !priv->qcdm) { - g_message ("Returning saved registration states: 1x: %d EVDO: %d", - priv->cdma_1x_reg_state, priv->evdo_reg_state); + mm_dbg ("Returning saved registration states: 1x: %d EVDO: %d", + priv->cdma_1x_reg_state, priv->evdo_reg_state); mm_generic_cdma_query_reg_state_set_callback_1x_state (info, priv->cdma_1x_reg_state); mm_generic_cdma_query_reg_state_set_callback_evdo_state (info, priv->evdo_reg_state); mm_callback_info_schedule (info); @@ -2268,6 +2289,9 @@ get_property (GObject *object, guint prop_id, case MM_MODEM_PROP_TYPE: g_value_set_uint (value, MM_MODEM_TYPE_CDMA); break; + case MM_MODEM_CDMA_PROP_MEID: + g_value_set_string (value, priv->meid); + break; case PROP_EVDO_REV0: g_value_set_boolean (value, priv->evdo_rev0); break; @@ -2320,6 +2344,10 @@ mm_generic_cdma_class_init (MMGenericCdmaClass *klass) MM_MODEM_PROP_TYPE, MM_MODEM_TYPE); + g_object_class_override_property (object_class, + MM_MODEM_CDMA_PROP_MEID, + MM_MODEM_CDMA_MEID); + g_object_class_install_property (object_class, PROP_EVDO_REV0, g_param_spec_boolean (MM_GENERIC_CDMA_EVDO_REV0, "EVDO rev0", |