aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-modem-huawei-cdma.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-04-05 18:46:53 -0700
committerDan Williams <dcbw@redhat.com>2010-04-05 18:46:53 -0700
commitf3dd034aadd16d42f93a682b15a7801537e89d7d (patch)
treed11b5cd62d2b20ccfd7e332463d860cd7429e171 /plugins/mm-modem-huawei-cdma.c
parent49c363d83af84021f74f04c8141313d21e75821b (diff)
cdma: fix subclass registration state checking in error paths (rh #569067)
The generic CDMA superclass already checks minimal registration state, and when some of the additional query_registration_state() subclass checks were being performed, if the device returned an error (if it didn't support the subclass' specific registration command like *STATE or ^SYSINFO) the superclass' registration state checks would be thrown away. Fix that by specifying the behavior of the subclass' query_registration_state() methods to ignore most errors and leave the superclass' registration state intact if a non-critical error occurs.
Diffstat (limited to 'plugins/mm-modem-huawei-cdma.c')
-rw-r--r--plugins/mm-modem-huawei-cdma.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/plugins/mm-modem-huawei-cdma.c b/plugins/mm-modem-huawei-cdma.c
index 7200f061..523578f1 100644
--- a/plugins/mm-modem-huawei-cdma.c
+++ b/plugins/mm-modem-huawei-cdma.c
@@ -161,12 +161,10 @@ sysinfo_done (MMAtSerialPort *port,
GRegex *r;
GMatchInfo *match_info;
const char *reply;
- gboolean success = FALSE;
if (error) {
- info->error = g_error_copy (error);
- mm_callback_info_schedule (info);
- return;
+ /* Leave superclass' reg state alone if AT^SYSINFO isn't supported */
+ goto done;
}
reply = strip_response (response->str, "^SYSINFO:");
@@ -175,9 +173,7 @@ sysinfo_done (MMAtSerialPort *port,
r = g_regex_new ("\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
if (!r) {
- info->error = g_error_new_literal (MM_MODEM_ERROR,
- MM_MODEM_ERROR_GENERAL,
- "Could not parse sysinfo results (regex creation failed).");
+ g_warning ("Huawei(%s): ^SYSINFO parse regex creation failed.", __func__);
goto done;
}
@@ -217,31 +213,27 @@ sysinfo_done (MMAtSerialPort *port,
/* Say we're registered to something even though sysmode parsing failed */
mm_generic_cdma_query_reg_state_set_callback_1x_state (info, reg_state);
}
- success = TRUE;
- }
+ } else
+ g_warning ("Huawei(%s): failed to parse ^SYSINFO response.", __func__);
-done:
g_match_info_free (match_info);
g_regex_unref (r);
-
- if (!success && !info->error) {
- info->error = g_error_new_literal (MM_MODEM_ERROR,
- MM_MODEM_ERROR_GENERAL,
- "Could not parse sysinfo results.");
- }
+done:
mm_callback_info_schedule (info);
}
static void
query_registration_state (MMGenericCdma *cdma,
+ MMModemCdmaRegistrationState cur_cdma_state,
+ MMModemCdmaRegistrationState cur_evdo_state,
MMModemCdmaRegistrationStateFn callback,
gpointer user_data)
{
MMCallbackInfo *info;
MMAtSerialPort *port;
- info = mm_generic_cdma_query_reg_state_callback_info_new (cdma, callback, user_data);
+ info = mm_generic_cdma_query_reg_state_callback_info_new (cdma, cur_cdma_state, cur_evdo_state, callback, user_data);
port = mm_generic_cdma_get_best_at_port (cdma, &info->error);
if (!port) {