Providing the channel alone isn't clear as there're overlapping channels
on e.g. band 2 and 6.
Note: This changes the ABI.
Signed-off-by: Andre Heider <a.heider@gmail.com>
uint8_t mac[6];
char ssid[IWINFO_ESSID_MAX_SIZE+1];
enum iwinfo_opmode mode;
uint8_t mac[6];
char ssid[IWINFO_ESSID_MAX_SIZE+1];
enum iwinfo_opmode mode;
uint8_t signal;
uint8_t quality;
uint8_t quality_max;
uint8_t signal;
uint8_t quality;
uint8_t quality_max;
+static uint8_t nl80211_freq2band(int freq)
+{
+ if (freq >= 2412 && freq <= 2484)
+ return IWINFO_BAND_24;
+ else if (freq >= 5160 && freq <= 5885)
+ return IWINFO_BAND_5;
+ else if (freq >= 5925 && freq <= 7125)
+ return IWINFO_BAND_6;
+ else if (freq >= 58320 && freq <= 69120)
+ return IWINFO_BAND_60;
+
+ return 0;
+}
+
static int nl80211_phyname_cb(struct nl_msg *msg, void *arg)
{
char *buf = arg;
static int nl80211_phyname_cb(struct nl_msg *msg, void *arg)
{
char *buf = arg;
sl->e->crypto.enabled = 1;
if (bss[NL80211_BSS_FREQUENCY])
sl->e->crypto.enabled = 1;
if (bss[NL80211_BSS_FREQUENCY])
- sl->e->channel = nl80211_freq2channel(nla_get_u32(
- bss[NL80211_BSS_FREQUENCY]));
+ {
+ sl->e->mhz = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
+ sl->e->band = nl80211_freq2band(sl->e->mhz);
+ sl->e->channel = nl80211_freq2channel(sl->e->mhz);
+ }
if (bss[NL80211_BSS_INFORMATION_ELEMENTS])
nl80211_get_scanlist_ie(bss, sl->e);
if (bss[NL80211_BSS_INFORMATION_ELEMENTS])
nl80211_get_scanlist_ie(bss, sl->e);
e->mode = IWINFO_OPMODE_MASTER;
/* Channel */
e->mode = IWINFO_OPMODE_MASTER;
/* Channel */
- e->channel = nl80211_freq2channel(atoi(freq));
+ e->mhz = atoi(freq);
+ e->band = nl80211_freq2band(e->mhz);
+ e->channel = nl80211_freq2channel(e->mhz);
/* Signal */
rssi = atoi(signal);
/* Signal */
rssi = atoi(signal);