aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-08-27 18:20:33 -0500
committerDan Williams <dcbw@redhat.com>2012-08-27 18:26:08 -0500
commitf4cce13a22ef436616121423d32513623b928340 (patch)
tree5173ca534493841c3860346dc51ea2dad871b98d
parentf3a33ecc452d47647ed19a763ba4915f1e356d3c (diff)
gsm: if the generic CNMI request fails, try a Qualcomm-compatible one
Many devices based on Qualcomm chipsets don't support a <ds> value of '1', despite saying they do in the AT+CNMI=? response. But they do accept '2'. Since we're not doing much with delivery status reports yet, if we get a CME 303 (not supported) error when setting the message indication parameters via CNMI, fall back to the Qualcomm-compatible CNMI parameters. If we don't do this, we don't get SMS indications on these devices, because the original CNMI failed. Tested on Huawei E1550, Huawei E160G, ZTE MF622, and Novatel XU870.
-rw-r--r--src/mm-generic-gsm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index a1a4af35..2da73976 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -1885,6 +1885,21 @@ sms_get_format_cb (MMAtSerialPort *port,
g_regex_unref (r);
}
+static void
+sms_ind_enable_cb (MMAtSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ if (g_error_matches (error, MM_MSG_ERROR, MM_MSG_ERROR_NOT_SUPPORTED)) {
+ /* If the device doesn't like the +CNMI we gave it (which could be
+ * plugin-specific) try a fallback. Many devices based on Qualcomm
+ * chipsets don't like '1' for the <ds> parameter for some reason.
+ */
+ mm_at_serial_port_queue_command (port, "+CNMI=2,1,2,2,0", 3, NULL, NULL);
+ }
+}
+
void
mm_generic_gsm_enable_complete (MMGenericGsm *self,
GError *error,
@@ -1932,7 +1947,7 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self,
/* Enable SMS notifications */
g_object_get (G_OBJECT (info->modem), MM_GENERIC_GSM_SMS_INDICATION_ENABLE_CMD, &cmd, NULL);
if (cmd && strlen (cmd))
- mm_at_serial_port_queue_command (priv->primary, cmd, 3, NULL, NULL);
+ mm_at_serial_port_queue_command (priv->primary, cmd, 3, sms_ind_enable_cb, NULL);
g_free (cmd);
/* Check and enable the right SMS mode */