From patchwork Thu Jun 6 06:12:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 249298 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 35A702C029D for ; Thu, 6 Jun 2013 17:11:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C972A9C176; Thu, 6 Jun 2013 03:10:57 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0Df4BrmqmGH; Thu, 6 Jun 2013 03:10:57 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 151BE9C17D; Thu, 6 Jun 2013 03:10:53 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9B9159C176 for ; Thu, 6 Jun 2013 03:10:51 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z2wNANDXleWs for ; Thu, 6 Jun 2013 03:10:46 -0400 (EDT) Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 677DF9C174 for ; Thu, 6 Jun 2013 03:10:46 -0400 (EDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 06 Jun 2013 00:10:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,813,1363158000"; d="scan'208";a="313088553" Received: from ipeer-e6430-1.jer.intel.com ([10.12.217.147]) by azsmga001.ch.intel.com with ESMTP; 06 Jun 2013 00:10:44 -0700 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH] wpa_supplicant: Add AVG_RSSI report in signal_poll Date: Thu, 6 Jun 2013 09:12:18 +0300 Message-Id: <1370499138-21257-1-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 Cc: Andrei Otcheretianski X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Andrei Otcheretianski Add AVG_RSSI report to the signal_poll command. This will work if kernel supports NL80211_STA_INFO_SIGNAL_AVG, otherwise a default value (0) will be returned. Change-Id: I02a9e28bb22c54646e8ed76c6032a7a877ce842a Signed-off-by: Andrei Otcheretianski Signed-hostap: Andrei Otcheretianski Reviewed-by: Ilan Peer --- src/drivers/driver.h | 1 + src/drivers/driver_nl80211.c | 8 ++++++++ wpa_supplicant/ctrl_iface.c | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 07cc1d2..e18ee65 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1108,6 +1108,7 @@ struct wpa_signal_info { u32 frequency; int above_threshold; int current_signal; + int avg_signal; int current_noise; int current_txrate; enum chan_width chanwidth; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5484d87..ac3c6bc 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1765,6 +1765,7 @@ static int get_link_signal(struct nl_msg *msg, void *arg) struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1]; static struct nla_policy policy[NL80211_STA_INFO_MAX + 1] = { [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 }, + [NL80211_STA_INFO_SIGNAL_AVG] = { .type = NLA_U8 }, }; struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1]; static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { @@ -1787,6 +1788,13 @@ static int get_link_signal(struct nl_msg *msg, void *arg) sig_change->current_signal = (s8) nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]); + + if (sinfo[NL80211_STA_INFO_SIGNAL_AVG]) + sig_change->avg_signal = + (s8) nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]); + else + sig_change->avg_signal = 0; + if (sinfo[NL80211_STA_INFO_TX_BITRATE]) { if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX, sinfo[NL80211_STA_INFO_TX_BITRATE], diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 7b26493..cd7843e 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5029,10 +5029,12 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf, if (ret) return -1; - ret = os_snprintf(buf, buflen, "RSSI=%d\nLINKSPEED=%d\n" + ret = os_snprintf(buf, buflen, "RSSI=%d\n" + "AVG_RSSI=%d\nLINKSPEED=%d\n" "NOISE=%d\nFREQUENCY=%u\nWIDTH=%s\n" "CENTER_FRQ1=%d\nCENTER_FRQ2=%d\n", - si.current_signal, si.current_txrate / 1000, + si.current_signal, si.avg_signal, + si.current_txrate / 1000, si.current_noise, si.frequency, channel_width_name(si.chanwidth), si.center_frq1, si.center_frq2);