From: Gilad Itzkovitch <gilad.itzkovitch@xxxxxxxxxxxxxx> In this changeset S1G frequencies are displayed for any S1G band with their relevant properties. Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@xxxxxxxxxxxxxx> --- info.c | 15 ++++++++++++++- util.c | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/info.c b/info.c index 5229d44..7d649b8 100644 --- a/info.c +++ b/info.c @@ -297,6 +297,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) struct nlattr *tb_freq[NL80211_FREQUENCY_ATTR_MAX + 1]; static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { [NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 }, + [NL80211_FREQUENCY_ATTR_OFFSET] = { .type = NLA_U32 }, [NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG }, [NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG }, [__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, @@ -392,12 +393,24 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) } nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) { uint32_t freq; + uint32_t offset = 0; + nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq), nla_len(nl_freq), freq_policy); if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ]) continue; freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]); - printf("\t\t\t* %d MHz [%d]", freq, ieee80211_frequency_to_channel(freq)); + if (tb_freq[NL80211_FREQUENCY_ATTR_OFFSET]) + offset = nla_get_u32( + tb_freq[NL80211_FREQUENCY_ATTR_OFFSET]); + + if (tb_freq[NL80211_FREQUENCY_ATTR_OFFSET]) + printf("\t\t\t* %d.%d MHz", freq, offset); + else + printf("\t\t\t* %d MHz", freq); + + if (ieee80211_frequency_to_channel(freq)) + printf(" [%d]", ieee80211_frequency_to_channel(freq)); if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] && !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) diff --git a/util.c b/util.c index 8a2ba10..ba7dc26 100644 --- a/util.c +++ b/util.c @@ -199,6 +199,8 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) int ieee80211_frequency_to_channel(int freq) { + if (freq < 1000) + return 0; /* see 802.11-2007 17.3.8.3.2 and Annex J */ if (freq == 2484) return 14; base-commit: d6fd2757f7aab638022ffa635e32e21594ec382d -- 2.25.1