From 5963a29e54a6dd0e4a96b35425d71a5fadd0b007 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 11 May 2010 15:57:05 +0300 Subject: Fix signal strength indicator on maemo6 driver Negative values should be interpreted as 0 since HFP does only support positive indicators from 0 to 5. --- audio/telephony-maemo6.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c index 142579c2f..e40d6e398 100644 --- a/audio/telephony-maemo6.c +++ b/audio/telephony-maemo6.c @@ -134,7 +134,7 @@ struct csd_call { static struct { char *operator_name; uint8_t status; - uint32_t signals_bar; + int32_t signals_bar; } net = { .operator_name = NULL, .status = NETWORK_REG_STATUS_UNKOWN, @@ -1226,11 +1226,13 @@ static void handle_registration_changed(DBusMessage *msg) update_registration_status(status); } -static void update_signal_strength(uint32_t signals_bar) +static void update_signal_strength(int32_t signals_bar) { int signal; - if (signals_bar > 100) { + if (signals_bar < 0) + signals_bar = 0; + else if (signals_bar > 100) { debug("signals_bar greater than expected: %u", signals_bar); signals_bar = 100; } @@ -1250,7 +1252,7 @@ static void update_signal_strength(uint32_t signals_bar) static void handle_signal_strength_changed(DBusMessage *msg) { - uint8_t signals_bar, rssi_in_dbm; + int32_t signals_bar, rssi_in_dbm; if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &signals_bar, -- cgit v1.2.1