@@ -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])
@@ -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;