summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-11-22 09:55:06 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2023-01-20 17:26:58 +0100
commitbbe424f394b8a3956887cfbad0601d2bdd7f5592 (patch)
treef143dbcbda8010819fa5e35c8e6d74810dd92e2c
parentafa147c45ad35a036600bc737b6b39cf1d33ccd4 (diff)
downloadiwinfo-bbe424f394b8a3956887cfbad0601d2bdd7f5592.tar.gz
cli: print the band on the frequency list
Provide band info on frequency list dump. Signed-off-by: Andre Heider <a.heider@gmail.com>
-rw-r--r--iwinfo_cli.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 3bce96e..02296ac 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -44,6 +44,17 @@ static char * format_ssid(char *ssid)
return buf;
}
+static const char *format_band(int band)
+{
+ const char *name;
+
+ name = iwinfo_band_name(band);
+ if (name)
+ return name;
+
+ return "unknown";
+}
+
static char * format_channel(int ch)
{
static char buf[16];
@@ -729,9 +740,10 @@ static void print_freqlist(const struct iwinfo_ops *iw, const char *ifname)
{
e = (struct iwinfo_freqlist_entry *) &buf[i];
- printf("%s %s (Channel %s)%s\n",
+ printf("%s %s (Band: %s, Channel %s)%s\n",
(freq == e->mhz) ? "*" : " ",
format_frequency(e->mhz),
+ format_band(e->band),
format_channel(e->channel),
e->restricted ? " [restricted]" : "");
}