From 6a480bb861f9a83c46368a2ee50a23f062edc207 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 7 Jun 2010 19:06:36 -0500 Subject: netreg: Add Huawei RSSI unsolicited callback --- drivers/atmodem/network-registration.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c index 0d54cefa..db3b0c4f 100644 --- a/drivers/atmodem/network-registration.c +++ b/drivers/atmodem/network-registration.c @@ -640,6 +640,24 @@ static void option_ossysi_notify(GAtResult *result, gpointer user_data) ofono_info("OSSYSI mode: %d", mode); } +static void huawei_rssi_notify(GAtResult *result, gpointer user_data) +{ + struct ofono_netreg *netreg = user_data; + GAtResultIter iter; + int strength; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "^RSSI:")) + return; + + if (!g_at_result_iter_next_number(&iter, &strength)) + return; + + ofono_netreg_strength_notify(netreg, + at_util_convert_signal_strength(strength)); +} + static void csq_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct cb_data *cbd = user_data; @@ -933,10 +951,8 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data) FALSE, netreg, NULL); break; case OFONO_VENDOR_HUAWEI: - /* - * Huawei doesn't support CIND, signal strength reported - * in the modem driver - */ + g_at_chat_register(nd->chat, "^RSSI:", huawei_rssi_notify, + FALSE, netreg, NULL); break; default: g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix, -- cgit v1.2.3