diff options
author | Dan Williams <dcbw@redhat.com> | 2012-08-27 18:20:33 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-08-29 08:53:35 -0500 |
commit | 1d9164ec90788d1be134482ff88c501e3c5d623c (patch) | |
tree | 51f231fcc7edb039243ab9a87c2b3399b69d5d6d | |
parent | 1c29ce5999d11dee2898e7bf41c00995a00c71d0 (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.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index cdcf1aab..10db6a06 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -1776,6 +1776,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, @@ -1818,7 +1833,7 @@ mm_generic_gsm_enable_complete (MMGenericGsm *self, mm_at_serial_port_queue_command (priv->primary, "+CPMS=\"ME\",\"ME\",\"ME\"", 3, NULL, NULL); /* Enable SMS notifications */ - mm_at_serial_port_queue_command (priv->primary, "+CNMI=2,1,2,1,0", 3, NULL, NULL); + mm_at_serial_port_queue_command (priv->primary, "+CNMI=2,1,2,1,0", 3, sms_ind_enable_cb, NULL); /* Check and enable the right SMS mode */ mm_at_serial_port_queue_command (priv->primary, "AT+CMGF=?", 3, sms_get_format_cb, self); |