summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Shienbrood <ers@google.com>2011-06-09 16:44:10 -0500
committerDan Williams <dcbw@redhat.com>2011-06-09 16:55:57 -0500
commit98942441e36358d2ddf866c7a4be13faa936800f (patch)
tree8547857efeb3651fd0efba7e93cafcdf332681b0
parentd5cd66bb8fd4667303b3cd24c0e410968400f7d2 (diff)
downloadModemManager-98942441e36358d2ddf866c7a4be13faa936800f.tar.gz
icera: request specific network error codes on connect errors
For connection failures, get additional error detail. Currently, the only error codes that are mapped are the 3GPP TS 24.008 codes for "Unknown or missing access point name" and "Requested service option not subscribed" (which is sometimes returned for an invalid APN). (random fixes and cleanups by dcbw)
-rw-r--r--plugins/mm-modem-icera.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/plugins/mm-modem-icera.c b/plugins/mm-modem-icera.c
index 19718131c..465922601 100644
--- a/plugins/mm-modem-icera.c
+++ b/plugins/mm-modem-icera.c
@@ -359,13 +359,48 @@ icera_disconnect_done (MMModem *modem,
}
static void
+query_network_error_code_done (MMAtSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ MMModemIcera *self = MM_MODEM_ICERA (user_data);
+ MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self);
+ MMCallbackInfo *info = priv->connect_pending_data;
+ int nw_activation_err;
+
+ /* If the modem has already been removed, return without
+ * scheduling callback */
+ if (mm_callback_info_check_modem_removed (info))
+ return;
+
+ if ((error == NULL) && g_str_has_prefix (response->str, "%IER: ")) {
+ if (sscanf (response->str + 6, "%*d,%*d,%d", &nw_activation_err)) {
+ /* 3GPP TS 24.008 Annex G error codes:
+ * 27 - Unknown or missing access point name
+ * 33 - Requested service option not subscribed
+ */
+ if (nw_activation_err == 27 || nw_activation_err == 33)
+ info->error = mm_mobile_error_for_code (MM_MOBILE_ERROR_GPRS_NOT_SUBSCRIBED);
+ }
+ }
+
+ if (info->error == NULL) {
+ /* Generic error since parsing the specific one didn't work */
+ info->error = g_error_new_literal (MM_MODEM_ERROR,
+ MM_MODEM_ERROR_GENERAL,
+ "Call setup failed");
+ }
+ connect_pending_done (self);
+}
+
+static void
connection_enabled (MMAtSerialPort *port,
GMatchInfo *match_info,
gpointer user_data)
{
MMModemIcera *self = MM_MODEM_ICERA (user_data);
- MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self);
- MMCallbackInfo *info = priv->connect_pending_data;
+ MMAtSerialPort *primary;
char *str;
int status, cid, tmp;
@@ -402,12 +437,11 @@ connection_enabled (MMAtSerialPort *port,
break;
case 3:
/* Call setup failure? */
- if (info) {
- info->error = g_error_new_literal (MM_MODEM_ERROR,
- MM_MODEM_ERROR_GENERAL,
- "Call setup failed");
- }
- connect_pending_done (self);
+ primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM(self), MM_PORT_TYPE_PRIMARY);
+ g_assert (primary);
+ /* Get additional error details */
+ mm_at_serial_port_queue_command (primary, "AT%IER?", 3,
+ query_network_error_code_done, self);
break;
default:
mm_warn ("Unknown Icera connect status %d", status);
@@ -850,4 +884,3 @@ mm_modem_icera_get_type (void)
return icera_type;
}
-