summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem/network-registration.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-02-16 08:20:29 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-02-16 08:20:29 +0100
commit04ab1b28637d207e0b02840164ade4ac5f78298c (patch)
treec03850818da32fe15fa9c88c4caaeda9e90b3719 /drivers/atmodem/network-registration.c
parentbba5a1a00026068ba42430b8b45d92925b87dfbc (diff)
downloadofono-04ab1b28637d207e0b02840164ade4ac5f78298c.tar.bz2
atmodem: Use CSQ based notification for IFX signal strength
Since the XCIEV notifications are unclear, use XCSQ notifcations to report signal strength updates.
Diffstat (limited to 'drivers/atmodem/network-registration.c')
-rw-r--r--drivers/atmodem/network-registration.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 5cf1a021..0ec66087 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -702,6 +702,33 @@ static void ifx_xciev_notify(GAtResult *result, gpointer user_data)
*/
}
+static void ifx_xcsq_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ int rssi, ber, strength;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XCSQ:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &rssi))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &ber))
+ return;
+
+ DBG("rssi %d ber %d", rssi, ber);
+
+ if (rssi == 99)
+ strength = -1;
+ else
+ strength = (rssi * 100) / 31;
+
+ ofono_netreg_strength_notify(netreg, strength);
+}
+
static void ciev_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
@@ -1470,6 +1497,10 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Register for specific signal strength reports */
g_at_chat_register(nd->chat, "+XCIEV:", ifx_xciev_notify,
FALSE, netreg, NULL);
+ g_at_chat_register(nd->chat, "+XCSQ:", ifx_xcsq_notify,
+ FALSE, netreg, NULL);
+ g_at_chat_send(nd->chat, "AT+XCSQ=1", none_prefix,
+ NULL, NULL, NULL);
g_at_chat_send(nd->chat, "AT+XMER=1", none_prefix,
NULL, NULL, NULL);