diff options
author | Eric Shienbrood <ers@google.com> | 2011-06-13 10:30:11 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-06-13 10:31:35 -0500 |
commit | a35fc3a583e507d3c59e0d53a3f71aa8a6e59bb9 (patch) | |
tree | 8a174e40fabbab7b666a97095751303d2751eeff | |
parent | 6657e45a1e7d836f8fee6610b225c59249a07c98 (diff) |
icera: report connected access technology when connected
The NWSTATE field reports both available access technology and the
actual access technology in-use when a PS connection is active, so
report the actual access tech when it's available.
-rw-r--r-- | plugins/mm-modem-icera.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/mm-modem-icera.c b/plugins/mm-modem-icera.c index 46592260..89331429 100644 --- a/plugins/mm-modem-icera.c +++ b/plugins/mm-modem-icera.c @@ -221,7 +221,15 @@ nwstate_changed (MMAtSerialPort *port, g_free (str); } - str = g_match_info_fetch (info, 3); + /* Check the <connection state> field first for the connected access + * technology, otherwise if not connected (ie, "-") use the available + * access technology from the <tech> field. + */ + str = g_match_info_fetch (info, 4); + if (!str || (strcmp (str, "-") == 0)) { + g_free (str); + str = g_match_info_fetch (info, 3); + } if (str) { act = nwstate_to_act (str); g_free (str); @@ -753,7 +761,11 @@ mm_modem_icera_register_unsolicted_handlers (MMModemIcera *self, { GRegex *regex; - /* %NWSTATE: <rssi>,<mccmnc>,<tech>,<connected>,<regulation> */ + /* %NWSTATE: <rssi>,<mccmnc>,<tech>,<connection state>,<regulation> + * + * <connection state> shows the actual access technology in-use when a + * PS connection is active. + */ regex = g_regex_new ("\\r\\n%NWSTATE:\\s*(-?\\d+),(\\d+),([^,]*),([^,]*),(\\d+)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL); mm_at_serial_port_add_unsolicited_msg_handler (port, regex, nwstate_changed, self, NULL); g_regex_unref (regex); |