Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2009 20:19:58 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r187645 - user/sam/wifi/sbin/ifconfig
Message-ID:  <200901232019.n0NKJwLP052259@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Fri Jan 23 20:19:58 2009
New Revision: 187645
URL: http://svn.freebsd.org/changeset/base/187645

Log:
  prioritize 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

Modified:
  user/sam/wifi/sbin/ifconfig/ifieee80211.c

Modified: user/sam/wifi/sbin/ifconfig/ifieee80211.c
==============================================================================
--- user/sam/wifi/sbin/ifconfig/ifieee80211.c	Fri Jan 23 20:03:25 2009	(r187644)
+++ user/sam/wifi/sbin/ifconfig/ifieee80211.c	Fri Jan 23 20:19:58 2009	(r187645)
@@ -3102,6 +3102,30 @@ print_chaninfo(const struct ieee80211_ch
 		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)
@@ -3145,7 +3169,10 @@ print_channels(int s, const struct ieee8
 			/* 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901232019.n0NKJwLP052259>