From patchwork Thu Sep 24 09:20:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Schurig X-Patchwork-Id: 49765 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8O9L2Zo028790 for ; Thu, 24 Sep 2009 09:21:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752746AbZIXJU5 (ORCPT ); Thu, 24 Sep 2009 05:20:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752744AbZIXJU5 (ORCPT ); Thu, 24 Sep 2009 05:20:57 -0400 Received: from mx51.mymxserver.com ([85.199.173.110]:63754 "EHLO mx51.mymxserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656AbZIXJU4 (ORCPT ); Thu, 24 Sep 2009 05:20:56 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost.mx51.mymxserver.com (Postfix) with ESMTP id E484250004; Thu, 24 Sep 2009 11:20:59 +0200 (CEST) X-Virus-Scanned: by Mittwald Mailscanner Received: from mx51.mymxserver.com ([127.0.0.1]) by localhost (mx51.mymxserver.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bZBI0DB5OtXP; Thu, 24 Sep 2009 11:20:59 +0200 (CEST) Received: from lin01.mn-solutions.de (pD95F9103.dip0.t-ipconnect.de [217.95.145.3]) by mx51.mymxserver.com (Postfix) with ESMTP id 4E5975001D; Thu, 24 Sep 2009 11:20:59 +0200 (CEST) Received: by lin01.mn-solutions.de (Postfix, from userid 116) id D97511E0036; Thu, 24 Sep 2009 11:20:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.1.7-deb3 (2006-10-05) on lin01.mn-logistik.de X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.7-deb3 Received: from mnz66.mn-solutions.de (mnz66.mn-solutions.de [192.168.233.66]) by lin01.mn-solutions.de (Postfix) with ESMTP id B15B41E0010; Thu, 24 Sep 2009 11:20:49 +0200 (CEST) From: Holger Schurig To: Johannes Berg Subject: [PATCH] iw: show age of last scan Date: Thu, 24 Sep 2009 11:20:47 +0200 User-Agent: KMail/1.9.7 Cc: linux-wireless MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200909241120.47534.hs4233@mail.mn-solutions.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This shows how old a scan result entry is. --- Example: # ./iw eth1 scan trigger freq 2412 # sleep 1 # ./iw eth1 scan dump | grep seen last seen: 832 ms ago last seen: 852 ms ago last seen: 852 ms ago # sleep 1 # ./iw eth1 scan dump | grep seen last seen: 1836 ms ago last seen: 1856 ms ago last seen: 1856 ms ago Index: iw/scan.c =================================================================== --- iw.orig/scan.c 2009-09-21 14:06:47.000000000 +0200 +++ iw/scan.c 2009-09-24 09:57:02.000000000 +0200 @@ -754,6 +754,7 @@ static int print_bss_handler(struct nl_m [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 }, [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 }, [NL80211_BSS_STATUS] = { .type = NLA_U32 }, + [NL80211_BSS_AGE_MS] = { .type = NLA_U32 }, }; struct scan_params *params = arg; @@ -845,6 +846,10 @@ static int print_bss_handler(struct nl_m unsigned char s = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]); printf("\tsignal: %d/100\n", s); } + if (bss[NL80211_BSS_AGE_MS]) { + int age = nla_get_u32(bss[NL80211_BSS_AGE_MS]); + printf("\tlast seen: %d ms ago\n", age); + } if (bss[NL80211_BSS_INFORMATION_ELEMENTS]) print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]), nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]), Index: iw/nl80211.h =================================================================== --- iw.orig/nl80211.h 2009-09-24 09:55:57.000000000 +0200 +++ iw/nl80211.h 2009-09-24 09:56:29.000000000 +0200 @@ -1261,6 +1261,7 @@ enum nl80211_channel_type { * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon * in unspecified units, scaled to 0..100 (u8) * @NL80211_BSS_STATUS: status, if this BSS is "used" + * @NL80211_BSS_AGE_MS: age of this BSS entry in ms * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ @@ -1275,6 +1276,7 @@ enum nl80211_bss { NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_STATUS, + NL80211_BSS_AGE_MS, /* keep last */ __NL80211_BSS_AFTER_LAST,