Search Linux Wireless

[PATCH] iw dev link: print channel number as well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
  dev <devname> link
prints the SSID and frequency, when connected.
To figure out the channel however (if you don't
know it by heart), you need to use
  dev <devname> info
which will print the channel along with the
frequency (though not the current SSID).

With attached patch,
  dev <devname> link
prints the channel along with the frequency, e.g. as:
	freq: 2442
	channel: 7
.

I find it more convenient this way.

-- madman.
From 0e167018fbc95580ba2cb94128452a18463cbde2 Mon Sep 17 00:00:00 2001
From: Recursive Madman <recursive.madman@xxxxxx>
Date: Mon, 22 Dec 2014 15:21:07 +0100
Subject: [PATCH] dev link: print channel number as well

Signed-off-by: Recursive Madman <recursive.madman@xxxxxx>
---
 link.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/link.c b/link.c
index f7818f5..629b2ba 100644
--- a/link.c
+++ b/link.c
@@ -84,9 +84,12 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)
 			  nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
 			  false, PRINT_LINK);
 
-	if (bss[NL80211_BSS_FREQUENCY])
+	if (bss[NL80211_BSS_FREQUENCY]) {
 		printf("\tfreq: %d\n",
 			nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+		printf("\tchannel: %d\n",
+           ieee80211_frequency_to_channel(nla_get_u32(bss[NL80211_BSS_FREQUENCY])));
+  }
 
 	if (nla_get_u32(bss[NL80211_BSS_STATUS]) != NL80211_BSS_STATUS_ASSOCIATED)
 		return NL_SKIP;
-- 
2.1.3


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux