From a35fc3a583e507d3c59e0d53a3f71aa8a6e59bb9 Mon Sep 17 00:00:00 2001 From: Eric Shienbrood Date: Mon, 13 Jun 2011 10:30:11 -0500 Subject: [PATCH] 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. --- plugins/mm-modem-icera.c | 16 ++++++++++++++-- 1 file 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 field first for the connected access + * technology, otherwise if not connected (ie, "-") use the available + * access technology from the 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: ,,,, */ + /* %NWSTATE: ,,,, + * + * 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);