pritize the channel we display with list chans so that, among other

things, 1/2 and 1/4 width channels are hidden behind the full width
channel; this is needed because they are ordered such that they
appear after in the channel table
This commit is contained in:
Sam Leffler 2009-01-28 19:23:12 +00:00
parent 2da7e03a99
commit fa46e75db6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=187844

View File

@ -3156,6 +3156,30 @@ print_chaninfo(const struct ieee80211_channel *c, int verb)
get_chaninfo(c, verb, buf, sizeof(buf)));
}
static int
chanpref(const struct ieee80211_channel *c)
{
if (IEEE80211_IS_CHAN_HT40(c))
return 40;
if (IEEE80211_IS_CHAN_HT20(c))
return 30;
if (IEEE80211_IS_CHAN_HALF(c))
return 10;
if (IEEE80211_IS_CHAN_QUARTER(c))
return 5;
if (IEEE80211_IS_CHAN_TURBO(c))
return 25;
if (IEEE80211_IS_CHAN_A(c))
return 20;
if (IEEE80211_IS_CHAN_G(c))
return 20;
if (IEEE80211_IS_CHAN_B(c))
return 15;
if (IEEE80211_IS_CHAN_PUREG(c))
return 15;
return 0;
}
static void
print_channels(int s, const struct ieee80211req_chaninfo *chans,
int allchans, int verb)
@ -3199,7 +3223,10 @@ print_channels(int s, const struct ieee80211req_chaninfo *chans,
/* suppress duplicates as above */
if (isset(reported, c->ic_ieee) && !verb) {
/* XXX we assume duplicates are adjacent */
achans->ic_chans[achans->ic_nchans-1] = *c;
struct ieee80211_channel *a =
&achans->ic_chans[achans->ic_nchans-1];
if (chanpref(c) > chanpref(a))
*a = *c;
} else {
achans->ic_chans[achans->ic_nchans++] = *c;
setbit(reported, c->ic_ieee);