[email protected]
[Top] [All Lists]

PERFORCE change 113796 for review

Subject: PERFORCE change 113796 for review
From: Sam Leffler
Date: Wed, 31 Jan 2007 22:01:21 GMT
http://perforce.freebsd.org/chv.cgi?CH=113796

Change 113796 by [email protected]_ebb on 2007/01/31 22:00:21

        add list txpow

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#60 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#60 (text+ko) ====

@@ -1525,6 +1525,72 @@
 }
 
 static void
+print_txpow(const struct ieee80211_channel *c)
+{
+       printf("Channel %3u : %u Mhz %3.1f reg %2d  ",
+           c->ic_ieee, c->ic_freq,
+           c->ic_maxpower/2., c->ic_maxregpower);
+}
+
+static void
+print_txpow_verbose(const struct ieee80211_channel *c)
+{
+       print_chaninfo(c);
+       printf("min %4.1f dBm  max %3.1f dBm  reg %2d dBm",
+           c->ic_minpower/2., c->ic_maxpower/2., c->ic_maxregpower);
+       /* indicate where regulatory cap limits power use */
+       if (c->ic_maxpower > 2*c->ic_maxregpower)
+               printf(" <");
+}
+
+static void
+list_txpow(int s)
+{
+       struct ieee80211req_chaninfo achans;
+       uint8_t reported[IEEE80211_CHAN_BYTES];
+       struct ieee80211_channel *c, *prev;
+       int i, half;
+
+       getchaninfo(s);
+       memset(&achans, 0, sizeof(achans));
+       memset(reported, 0, sizeof(reported));
+       for (i = 0; i < chaninfo.ic_nchans; i++) {
+               c = &chaninfo.ic_chans[i];
+               /* suppress duplicates as above */
+               if (isset(reported, c->ic_ieee) && !verbose) {
+                       /* XXX we assume duplicates are adjacent */
+                       prev = &achans.ic_chans[achans.ic_nchans-1];
+                       /* display highest power on channel */
+                       if (c->ic_maxpower > prev->ic_maxpower)
+                               *prev = *c;
+               } else {
+                       achans.ic_chans[achans.ic_nchans++] = *c;
+                       setbit(reported, c->ic_ieee);
+               }
+       }
+       if (!verbose) {
+               half = achans.ic_nchans / 2;
+               if (achans.ic_nchans % 2)
+                       half++;
+
+               for (i = 0; i < achans.ic_nchans / 2; i++) {
+                       print_txpow(&achans.ic_chans[i]);
+                       print_txpow(&achans.ic_chans[half+i]);
+                       printf("\n");
+               }
+               if (achans.ic_nchans % 2) {
+                       print_txpow(&achans.ic_chans[i]);
+                       printf("\n");
+               }
+       } else {
+               for (i = 0; i < achans.ic_nchans; i++) {
+                       print_txpow_verbose(&achans.ic_chans[i]);
+                       printf("\n");
+               }
+       }
+}
+
+static void
 list_keys(int s)
 {
 }
@@ -1686,6 +1752,8 @@
                list_wme(s);
        else if (iseq(arg, "mac"))
                list_mac(s);
+       else if (iseq(arg, "txpow"))
+               list_txpow(s);
        else
                errx(1, "Don't know how to list %s for %s", arg, name);
 #undef iseq
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "[email protected]"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 113796 for review, Sam Leffler <=