aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-10-04 15:43:55 -0500
committerDan Williams <dcbw@redhat.com>2016-10-05 09:14:44 -0500
commit14ccde2b5f7f1770950c70b03a0b9ccecc54d692 (patch)
treed248dfe794a790da4bd5ad50b9e4d56042b7c574
parent9548192985ad68601b069a1f267fcbdc652a5ba2 (diff)
huawei: handle some weird SYSCFG acquisition orders
<debug> (ttyUSB2): --> 'AT^SYSCFG?<CR>' <debug> (ttyUSB2): <-- '<CR><LF>^SYSCFG:14,2,400380,1,2<CR><LF><CR><LF>OK<CR><LF>' <warn> couldn't load current allowed/preferred modes: 'No SYSCFG combination found matching the current one (14,2)' 14,2 means "WCDMA-only; acquire WCDMA then GSM" which is somewhat non-sensical. The supported modes parsing doesn't generate this combination because it doesn't really make sense, so current mode matching failed. Just fix up the non-sensical acquisition order to 0 (automatic).
-rw-r--r--plugins/huawei/mm-modem-helpers-huawei.c6
-rw-r--r--plugins/huawei/tests/test-modem-helpers-huawei.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/plugins/huawei/mm-modem-helpers-huawei.c b/plugins/huawei/mm-modem-helpers-huawei.c
index d3f13c23..fde1c791 100644
--- a/plugins/huawei/mm-modem-helpers-huawei.c
+++ b/plugins/huawei/mm-modem-helpers-huawei.c
@@ -904,6 +904,12 @@ mm_huawei_parse_syscfg_response (const gchar *response,
return NULL;
}
+ /* Fix invalid modes with non-sensical acquisition orders */
+ if (mode == 14 && acqorder != 0) /* WCDMA only but acqorder != "Automatic" */
+ acqorder = 0;
+ else if (mode == 13 && acqorder != 0) /* GSM only but acqorder != "Automatic" */
+ acqorder = 0;
+
/* Look for current modes among the supported ones */
for (i = 0; i < supported_mode_combinations->len; i++) {
const MMHuaweiSyscfgCombination *combination;
diff --git a/plugins/huawei/tests/test-modem-helpers-huawei.c b/plugins/huawei/tests/test-modem-helpers-huawei.c
index 13601c47..7044582d 100644
--- a/plugins/huawei/tests/test-modem-helpers-huawei.c
+++ b/plugins/huawei/tests/test-modem-helpers-huawei.c
@@ -707,6 +707,20 @@ static const SyscfgResponseTest syscfg_response_tests[] = {
.format = "^SYSCFG:(2,13,14,16),(0-3),((400000,\"WCDMA2100\")),(0-2),(0-4)\r\n",
.allowed = MM_MODEM_MODE_3G,
.preferred = MM_MODEM_MODE_NONE
+ },
+ {
+ /* Non-sensical acquisition order (WCDMA-only but acquire WCDMA-then-GSM */
+ .str = "^SYSCFG: 14,2,400000,0,3\r\n",
+ .format = "^SYSCFG:(2,13,14,16),(0-3),((400000,\"WCDMA2100\")),(0-2),(0-4)\r\n",
+ .allowed = MM_MODEM_MODE_3G,
+ .preferred = MM_MODEM_MODE_NONE
+ },
+ {
+ /* Non-sensical acquisition order (GSM-only but acquire GSM-then-WCDMA */
+ .str = "^SYSCFG: 13,1,400000,0,3\r\n",
+ .format = "^SYSCFG:(2,13,14,16),(0-3),((400000,\"WCDMA2100\")),(0-2),(0-4)\r\n",
+ .allowed = MM_MODEM_MODE_2G,
+ .preferred = MM_MODEM_MODE_NONE
}
};