From owner-p4-projects@FreeBSD.ORG Sat Dec 4 00:57:31 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 32AAF16A4D0; Sat, 4 Dec 2004 00:57:31 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0EAF116A4CE for ; Sat, 4 Dec 2004 00:57:31 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E166543D41 for ; Sat, 4 Dec 2004 00:57:30 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iB40vUBm014147 for ; Sat, 4 Dec 2004 00:57:30 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iB40vUi1014144 for perforce@freebsd.org; Sat, 4 Dec 2004 00:57:30 GMT (envelope-from sam@freebsd.org) Date: Sat, 4 Dec 2004 00:57:30 GMT Message-Id: <200412040057.iB40vUi1014144@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 66380 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Dec 2004 00:57:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=66380 Change 66380 by sam@sam_ebb on 2004/12/04 00:57:02 suppress more meaningless status by default Affected files ... .. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#26 edit Differences ... ==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#26 (text+ko) ==== @@ -1178,6 +1178,31 @@ return 0; } +static const struct ieee80211_channel * +getchaninfo(int s, int chan) +{ + struct ieee80211req ireq; + static struct ieee80211req_chaninfo chans; + static struct ieee80211_channel undef; + const struct ieee80211_channel *c; + int i, freq; + + (void) memset(&ireq, 0, sizeof(ireq)); + (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name)); + ireq.i_type = IEEE80211_IOC_CHANINFO; + ireq.i_data = &chans; + ireq.i_len = sizeof(chans); + if (ioctl(s, SIOCG80211, &ireq) < 0) + errx(1, "unable to get channel information"); + freq = ieee80211_ieee2mhz(chan); + for (i = 0; i < chans.ic_nchans; i++) { + c = &chans.ic_chans[i]; + if (c->ic_freq == freq) + return c; + } + return &undef; +} + static void ieee80211_status(int s, const struct rt_addrinfo *info __unused) { @@ -1186,6 +1211,7 @@ int i, num, wpa, wme; struct ieee80211req ireq; u_int8_t data[32]; + const struct ieee80211_channel *c; char spacer; (void) memset(&ireq, 0, sizeof(ireq)); @@ -1219,10 +1245,11 @@ ireq.i_type = IEEE80211_IOC_CHANNEL; if (ioctl(s, SIOCG80211, &ireq) < 0) goto end; + c = getchaninfo(s, ireq.i_val); if (ireq.i_val != -1) { printf(" channel %d", ireq.i_val); if (verbose) - printf(" (%u)", ieee80211_ieee2mhz(ireq.i_val)); + printf(" (%u)", c->ic_freq); } else if (verbose) printf(" channel UNDEF"); @@ -1361,27 +1388,27 @@ ireq.i_type = IEEE80211_IOC_POWERSAVE; if (ioctl(s, SIOCG80211, &ireq) != -1 && ireq.i_val != IEEE80211_POWERSAVE_NOSUP ) { - printf("%cpowersavemode", spacer); - spacer = ' '; - switch (ireq.i_val) { - case IEEE80211_POWERSAVE_OFF: - printf(" OFF"); - break; - case IEEE80211_POWERSAVE_CAM: - printf(" CAM"); - break; - case IEEE80211_POWERSAVE_PSP: - printf(" PSP"); - break; - case IEEE80211_POWERSAVE_PSP_CAM: - printf(" PSP-CAM"); - break; - } - - ireq.i_type = IEEE80211_IOC_POWERSAVESLEEP; - if (ioctl(s, SIOCG80211, &ireq) != -1) { - if (ireq.i_val) + if (ireq.i_val != IEEE80211_POWERSAVE_OFF || verbose) { + printf("%cpowersavemode", spacer); + switch (ireq.i_val) { + case IEEE80211_POWERSAVE_OFF: + printf(" OFF"); + break; + case IEEE80211_POWERSAVE_CAM: + printf(" CAM"); + break; + case IEEE80211_POWERSAVE_PSP: + printf(" PSP"); + break; + case IEEE80211_POWERSAVE_PSP_CAM: + printf(" PSP-CAM"); + break; + } + ireq.i_type = IEEE80211_IOC_POWERSAVESLEEP; + if (ioctl(s, SIOCG80211, &ireq) != -1) { printf(" powersavesleep %d", ireq.i_val); + } + spacer = ' '; } } @@ -1409,24 +1436,26 @@ spacer = ' '; } - ireq.i_type = IEEE80211_IOC_PROTMODE; - if (ioctl(s, SIOCG80211, &ireq) != -1) { - printf("%cprotmode ", spacer); - switch (ireq.i_val) { - case IEEE80211_PROTMODE_OFF: - printf("OFF"); - break; - case IEEE80211_PROTMODE_CTS: - printf("CTS"); - break; - case IEEE80211_PROTMODE_RTSCTS: - printf("RTSCTS"); - break; - default: - printf("UNKNOWN (0x%x)", ireq.i_val); - break; + if (IEEE80211_IS_CHAN_G(c) || IEEE80211_IS_CHAN_PUREG(c) || verbose) { + ireq.i_type = IEEE80211_IOC_PROTMODE; + if (ioctl(s, SIOCG80211, &ireq) != -1) { + printf("%cprotmode ", spacer); + switch (ireq.i_val) { + case IEEE80211_PROTMODE_OFF: + printf("OFF"); + break; + case IEEE80211_PROTMODE_CTS: + printf("CTS"); + break; + case IEEE80211_PROTMODE_RTSCTS: + printf("RTSCTS"); + break; + default: + printf("UNKNOWN (0x%x)", ireq.i_val); + break; + } + spacer = ' '; } - spacer = ' '; } ireq.i_type = IEEE80211_IOC_WME; @@ -1473,22 +1502,24 @@ } else { ireq.i_type = IEEE80211_IOC_ROAMING; if (ioctl(s, SIOCG80211, &ireq) != -1) { - printf("%croaming ", spacer); - switch (ireq.i_val) { - case IEEE80211_ROAMING_DEVICE: - printf("DEVICE"); - break; - case IEEE80211_ROAMING_AUTO: - printf("AUTO"); - break; - case IEEE80211_ROAMING_MANUAL: - printf("MANUAL"); - break; - default: - printf("UNKNOWN (0x%x)", ireq.i_val); - break; + if (ireq.i_val != IEEE80211_ROAMING_AUTO || verbose) { + printf("%croaming ", spacer); + switch (ireq.i_val) { + case IEEE80211_ROAMING_DEVICE: + printf("DEVICE"); + break; + case IEEE80211_ROAMING_AUTO: + printf("AUTO"); + break; + case IEEE80211_ROAMING_MANUAL: + printf("MANUAL"); + break; + default: + printf("UNKNOWN (0x%x)", ireq.i_val); + break; + } + spacer = ' '; } - spacer = ' '; } } ireq.i_type = IEEE80211_IOC_BEACON_INTERVAL;