diff mbox

iw dev link: print channel number as well

Message ID 1419335948.29925.33.camel@gmx.de (mailing list archive)
State Rejected
Delegated to: Johannes Berg
Headers show

Commit Message

Recursive Madman Dec. 23, 2014, 11:59 a.m. UTC
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.
diff mbox

Patch

From 0e167018fbc95580ba2cb94128452a18463cbde2 Mon Sep 17 00:00:00 2001
From: Recursive Madman <recursive.madman@gmx.de>
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@gmx.de>
---
 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