aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2013-02-13 17:00:16 -0600
committerDan Williams <dcbw@redhat.com>2013-02-14 14:52:23 -0600
commit594adc38ff5a6277d120b21856dba5cfcff2b3a1 (patch)
treeabba350f3f80bc7c2f47d905f1b508998b10d6c6
parent29c0560a9a40bd4ad0f864266dc754e0056d6bc5 (diff)
broadband-modem: don't try QCDM access technology checks for non-QCDM 3GPP devices
Result handling code mistakenly ran for these devices, when it shouldn't.
-rw-r--r--src/mm-broadband-modem.c109
-rw-r--r--src/mm-iface-modem.c4
2 files changed, 60 insertions, 53 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 3778b564..ba4ca9cf 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -1790,12 +1790,19 @@ typedef struct {
} AccessTechContext;
static void
-access_tech_context_complete_and_free (AccessTechContext *ctx, gboolean idle)
+access_tech_context_complete_and_free (AccessTechContext *ctx,
+ GError *error, /* takes ownership */
+ gboolean idle)
{
AccessTechAndMask *tech;
MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
guint mask = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
+ if (error) {
+ g_simple_async_result_take_error (ctx->result, error);
+ goto done;
+ }
+
if (ctx->fallback_mask) {
mm_dbg ("Fallback access technology: 0x%08x", ctx->fallback_act);
act = ctx->fallback_act;
@@ -1844,11 +1851,13 @@ access_tech_context_complete_and_free (AccessTechContext *ctx, gboolean idle)
}
done:
- tech = g_new0 (AccessTechAndMask, 1);
- tech->access_technologies = act;
- tech->mask = mask;
+ if (error == NULL) {
+ tech = g_new0 (AccessTechAndMask, 1);
+ tech->access_technologies = act;
+ tech->mask = mask;
+ g_simple_async_result_set_op_res_gpointer (ctx->result, tech, g_free);
+ }
- g_simple_async_result_set_op_res_gpointer (ctx->result, tech, g_free);
if (idle)
g_simple_async_result_complete_in_idle (ctx->result);
else
@@ -1872,8 +1881,7 @@ access_tech_qcdm_wcdma_ready (MMQcdmSerialPort *port,
guint8 l1;
if (error) {
- g_simple_async_result_set_from_error (ctx->result, error);
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, g_error_copy (error), FALSE);
return;
}
@@ -1891,7 +1899,7 @@ access_tech_qcdm_wcdma_ready (MMQcdmSerialPort *port,
ctx->wcdma_open = TRUE;
}
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, NULL, FALSE);
}
static void
@@ -1907,8 +1915,7 @@ access_tech_qcdm_gsm_ready (MMQcdmSerialPort *port,
guint8 sysmode = 0;
if (error) {
- g_simple_async_result_set_from_error (ctx->result, error);
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, g_error_copy (error), FALSE);
return;
}
@@ -1917,12 +1924,11 @@ access_tech_qcdm_gsm_ready (MMQcdmSerialPort *port,
response->len,
&err);
if (!result) {
- g_simple_async_result_set_error (ctx->result,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Failed to parse GSM subsys command result: %d",
- err);
- access_tech_context_complete_and_free (ctx, FALSE);
+ error = g_error_new (MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Failed to parse GSM subsys command result: %d",
+ err);
+ access_tech_context_complete_and_free (ctx, error, FALSE);
return;
}
@@ -1958,8 +1964,7 @@ access_tech_qcdm_hdr_ready (MMQcdmSerialPort *port,
guint8 almp = 0;
if (error) {
- g_simple_async_result_set_from_error (ctx->result, error);
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, g_error_copy (error), FALSE);
return;
}
@@ -1978,7 +1983,7 @@ access_tech_qcdm_hdr_ready (MMQcdmSerialPort *port,
ctx->evdo_open = TRUE;
}
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, NULL, FALSE);
}
static void
@@ -1993,8 +1998,7 @@ access_tech_qcdm_cdma_ready (MMQcdmSerialPort *port,
guint32 hybrid;
if (error) {
- g_simple_async_result_set_from_error (ctx->result, error);
- access_tech_context_complete_and_free (ctx, FALSE);
+ access_tech_context_complete_and_free (ctx, g_error_copy (error), FALSE);
return;
}
@@ -2003,12 +2007,11 @@ access_tech_qcdm_cdma_ready (MMQcdmSerialPort *port,
response->len,
&err);
if (!result) {
- g_simple_async_result_set_error (ctx->result,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Failed to parse CM subsys command result: %d",
- err);
- access_tech_context_complete_and_free (ctx, FALSE);
+ error = g_error_new (MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Failed to parse CM subsys command result: %d",
+ err);
+ access_tech_context_complete_and_free (ctx, error, FALSE);
return;
}
@@ -2056,8 +2059,6 @@ access_tech_from_cdma_registration_state (MMBroadbandModem *self,
mm_dbg ("EVDO registration: %d", self->priv->modem_cdma_evdo_registration_state);
mm_dbg ("CDMA1x registration: %d", self->priv->modem_cdma_cdma1x_registration_state);
mm_dbg ("Fallback access tech: 0x%08x", ctx->fallback_act);
-
- access_tech_context_complete_and_free (ctx, TRUE);
}
static void
@@ -2067,8 +2068,7 @@ modem_load_access_technologies (MMIfaceModem *self,
{
AccessTechContext *ctx;
GByteArray *cmd;
-
- mm_dbg ("loading access technologies via QCDM...");
+ GError *error = NULL;
/* For modems where only QCDM provides detailed information, try to
* get access technologies via the various QCDM subsystems or from
@@ -2082,16 +2082,28 @@ modem_load_access_technologies (MMIfaceModem *self,
user_data,
modem_load_access_technologies);
- if (!mm_iface_modem_is_cdma (self) && !ctx->port) {
- g_simple_async_result_set_error (ctx->result,
- MM_CORE_ERROR,
+ if (!ctx->port) {
+ if (mm_iface_modem_is_cdma (self)) {
+ /* If we don't have a QCDM port but the modem is CDMA-only, then
+ * guess access technologies from the registration information.
+ */
+ access_tech_from_cdma_registration_state (MM_BROADBAND_MODEM (self), ctx);
+ } else {
+ error = g_error_new_literal (MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED,
- "%s",
"Cannot get 3GPP access technology without a QCDM port");
- access_tech_context_complete_and_free (ctx, TRUE);
+ }
+ access_tech_context_complete_and_free (ctx, error, TRUE);
return;
}
+ mm_dbg ("loading access technologies via QCDM...");
+
+ /* FIXME: we may want to run both the CDMA and 3GPP in sequence to ensure
+ * that a multi-mode device that's in CDMA-mode but still has 3GPP capabilities
+ * will get the correct access tech, since the 3GPP check is run first.
+ */
+
if (mm_iface_modem_is_3gpp (self)) {
cmd = g_byte_array_sized_new (50);
cmd->len = qcdm_cmd_gsm_subsys_state_info_new ((char *) cmd->data, 50);
@@ -2104,23 +2116,16 @@ modem_load_access_technologies (MMIfaceModem *self,
(MMQcdmSerialResponseFn) access_tech_qcdm_gsm_ready,
ctx);
} else if (mm_iface_modem_is_cdma (self)) {
- /* If we don't have a QCDM port but the modem is CDMA-only, then
- * guess access technologies from the registration information.
- */
- if (!ctx->port)
- access_tech_from_cdma_registration_state (MM_BROADBAND_MODEM (self), ctx);
- else {
- cmd = g_byte_array_sized_new (50);
- cmd->len = qcdm_cmd_cm_subsys_state_info_new ((char *) cmd->data, 50);
- g_assert (cmd->len);
+ cmd = g_byte_array_sized_new (50);
+ cmd->len = qcdm_cmd_cm_subsys_state_info_new ((char *) cmd->data, 50);
+ g_assert (cmd->len);
- mm_qcdm_serial_port_queue_command (ctx->port,
- cmd,
- 3,
- NULL,
- (MMQcdmSerialResponseFn) access_tech_qcdm_cdma_ready,
- ctx);
- }
+ mm_qcdm_serial_port_queue_command (ctx->port,
+ cmd,
+ 3,
+ NULL,
+ (MMQcdmSerialResponseFn) access_tech_qcdm_cdma_ready,
+ ctx);
} else
g_assert_not_reached ();
}
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 722664cf..9faa7775 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -759,7 +759,9 @@ access_technologies_check_ready (MMIfaceModem *self,
&access_technologies,
&mask,
&error)) {
- mm_dbg ("Couldn't refresh access technologies: '%s'", error->message);
+ /* Ignore issues when the operation is unsupported, don't even log */
+ if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED))
+ mm_dbg ("Couldn't refresh access technologies: '%s'", error->message);
g_error_free (error);
} else
mm_iface_modem_update_access_technologies (self, access_technologies, mask);