[PATCH] huawei: handle unquoted strings in ^SYSINFOEX response
Ben Chan
benchan at chromium.org
Fri Oct 11 10:44:24 PDT 2013
The patch modifies sysinfoex_parse() in MMBroadbandModemHuawei to handle
unquoted <sysmode_name> and <submode_name> fields in ^SYSINFOEX
responses, which are seen on some Huawei modems (e.g. E303).
---
After applying this patch, here's what I observed on E303 and MU736:
E303:
[mm-at-serial-port.c:436] debug_log(): (ttyUSB2): --> 'AT^SYSINFOEX<CR>'
[mm-at-serial-port.c:436] debug_log(): (ttyUSB2): <-- '<CR><LF>^SYSINFOEX:2,3,0,1,,1,GSM,3,EDGE<CR><LF><CR><LF>OK<CR><LF>'
[huawei/mm-broadband-modem-huawei.c:674] load_access_technologies_finish(): Access Technology: 'edge'
MU736:
[mm-at-serial-port.c:436] debug_log(): (ttyUSB0): --> 'AT^SYSINFOEX<CR>'
[mm-at-serial-port.c:436] debug_log(): (ttyUSB0): <-- '<CR><LF>^SYSINFOEX:2,3,0,1,0,3,"WCDMA",44,"HSPA"<CR><LF><CR><LF>OK<CR><LF>'
[huawei/mm-broadband-modem-huawei.c:674] load_access_technologies_finish(): Access Technology: 'hspa'
plugins/huawei/mm-broadband-modem-huawei.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index 4f231df..1629b58 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -202,11 +202,13 @@ sysinfoex_parse (const char *reply,
/* Format:
*
* ^SYSINFOEX: <srv_status>,<srv_domain>,<roam_status>,<sim_state>,<reserved>,<sysmode>,<sysmode_name>,<submode>,<submode_name>
+ *
+ * <sysmode_name> and <submode_name> may not be quoted on some Huawei modems (e.g. E303).
*/
/* ^SYSINFOEX:2,3,0,1,,3,"WCDMA",41,"HSPA+" */
- r = g_regex_new ("\\^SYSINFOEX:\\s*(\\d+),(\\d+),(\\d+),(\\d+),?(\\d*),(\\d+),\"(.*)\",(\\d+),\"(.*)\"$", 0, 0, NULL);
+ r = g_regex_new ("\\^SYSINFOEX:\\s*(\\d+),(\\d+),(\\d+),(\\d+),?(\\d*),(\\d+),\"?([^\"]*)\"?,(\\d+),\"?([^\"]*)\"?$", 0, 0, NULL);
g_assert (r != NULL);
matched = g_regex_match_full (r, reply, -1, 0, 0, &match_info, &match_error);
--
1.8.4
More information about the ModemManager-devel
mailing list