huawei: handle whitespace in RSSI responses

This patch modifies the regular expressions for parsing ^RSSI, ^RSSILVL,
and ^HRSSILVL responses to handle any whitespace that is inserted
between the colon and the RSSI value.

The issue is identified by Dan Williams <dcbw@redhat.com>
This commit is contained in:
Ben Chan
2013-08-06 10:04:46 -07:00
committed by Dan Williams
parent f2fd4d8de0
commit 8ff3f6703a

View File

@@ -2881,11 +2881,11 @@ mm_broadband_modem_huawei_init (MMBroadbandModemHuawei *self)
MM_TYPE_BROADBAND_MODEM_HUAWEI,
MMBroadbandModemHuaweiPrivate);
/* Prepare regular expressions to setup */
self->priv->rssi_regex = g_regex_new ("\\r\\n\\^RSSI:(\\d+)\\r\\n",
self->priv->rssi_regex = g_regex_new ("\\r\\n\\^RSSI:\\s*(\\d+)\\r\\n",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
self->priv->rssilvl_regex = g_regex_new ("\\r\\n\\^RSSILVL:(\\d+)\\r\\n",
self->priv->rssilvl_regex = g_regex_new ("\\r\\n\\^RSSILVL:\\s*(\\d+)\\r\\n",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
self->priv->hrssilvl_regex = g_regex_new ("\\r\\n\\^HRSSILVL:(\\d+)\\r\\n",
self->priv->hrssilvl_regex = g_regex_new ("\\r\\n\\^HRSSILVL:\\s*(\\d+)\\r\\n",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
/* 3GPP: <cr><lf>^MODE:5<cr><lf>