From 7a9444f4dea5e4c72b660c15e5b27916a99f8f27 Mon Sep 17 00:00:00 2001 From: wpaul Date: Fri, 7 May 1999 03:28:54 +0000 Subject: Add support to wicontrol(8) and wi(4) for enabling and configuring power management. This will only work on newer firmware revisions; older firmware will silently ignore the attempts to turn power management on. Patches supplied by: Brad Karp --- usr.sbin/wicontrol/wicontrol.8 | 20 ++++++++++++++++++++ usr.sbin/wicontrol/wicontrol.c | 20 +++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) (limited to 'usr.sbin/wicontrol') diff --git a/usr.sbin/wicontrol/wicontrol.8 b/usr.sbin/wicontrol/wicontrol.8 index 03a96ee..dfdb328 100644 --- a/usr.sbin/wicontrol/wicontrol.8 +++ b/usr.sbin/wicontrol/wicontrol.8 @@ -61,6 +61,10 @@ .Fl i Ar iface Fl r Ar RTS threshold .Nm wicontrol .Fl i Ar iface Fl f Ar frequency +.Nm wicontrol +.Fl i Ar iface Fl P Ar 0|1 +.Nm wicontrol +.Fl i Ar iface Fl S Ar max_sleep_duration .Sh DESCRIPTION The .Nm @@ -175,6 +179,22 @@ channel number between 0 and 14. If an illegal channel is specified, the NIC will revert to its default channel. For NIC sold in the United States, the default channel is 3. Note that two stations must be set to the same channel in order to communicate. +.It Fl i Ar iface Fl P Ar 0|1 +Enable or disable power management on a given interface. Enabling +power management uses an alternating sleep/wake protocol to help +conserve power on mobile stations, at the cost of some increased +receive latency. Power management is off by default. Note that power +management requires the cooperation of an access point in order to +function; it is not functional in ad-hoc mode. Also, power management +is only implemented in Lucent WavePOINT firmware version 2.03 or +later, and in WaveLAN PCMCIA adapter firmware 2.00 or later. Older +revisions will silently ignore the power management setting. Legal +values for this parameter are 0 (off) and 1 (on). +.It Fl i Ar iface Fl S Ar max sleep interval +Specify the sleep interval to use when power management is enabled. +The +.Are max sleep interval +is specified in milliseconds. The default is 100. .El .Sh SEE ALSO .Xr wi 4 , diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c index 4bd0200..33a0855 100644 --- a/usr.sbin/wicontrol/wicontrol.c +++ b/usr.sbin/wicontrol/wicontrol.c @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $ + * $Id: wicontrol.c,v 1.17 1999/05/07 03:14:21 wpaul Exp $ */ #include @@ -56,7 +56,7 @@ static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\ Bill Paul. All rights reserved."; static const char rcsid[] = - "@(#) $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $"; + "@(#) $Id: wicontrol.c,v 1.17 1999/05/07 03:14:21 wpaul Exp $"; #endif static void wi_getval __P((char *, struct wi_req *)); @@ -308,6 +308,8 @@ static struct wi_table wi_table[] = { { WI_RID_RTS_THRESH, WI_WORDS, "RTS/CTS handshake threshold:\t\t"}, { WI_RID_CREATE_IBSS, WI_BOOL, "Create IBSS:\t\t\t\t" }, { WI_RID_SYSTEM_SCALE, WI_WORDS, "Access point density:\t\t\t" }, + { WI_RID_PM_ENABLED, WI_WORDS, "Power Mgmt (1=on, 0=off):\t\t" }, + { WI_RID_MAX_SLEEP, WI_WORDS, "Max sleep time:\t\t\t\t" }, { 0, NULL } }; @@ -426,6 +428,9 @@ static void usage(p) fprintf(stderr, "\t%s -i iface -m mac address\n", p); fprintf(stderr, "\t%s -i iface -d max data length\n", p); fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p); + fprintf(stderr, "\t%s -i iface -f frequenct\n", p); + fprintf(stderr, "\t%s -i iface -P power mgmt\n", p); + fprintf(stderr, "\t%s -i iface -S max sleep duration\n", p); exit(1); } @@ -438,7 +443,8 @@ int main(argc, argv) char *iface = NULL; char *p = argv[0]; - while((ch = getopt(argc, argv, "hoc:d:f:i:p:r:q:t:n:s:m:")) != -1) { + while((ch = getopt(argc, argv, + "hoc:d:f:i:p:r:q:t:n:s:m:P:S:")) != -1) { switch(ch) { case 'o': wi_dumpstats(iface); @@ -487,6 +493,14 @@ int main(argc, argv) wi_setstr(iface, WI_RID_OWN_SSID, optarg); exit(0); break; + case 'S': + wi_setword(iface, WI_RID_MAX_SLEEP, atoi(optarg)); + exit(0); + break; + case 'P': + wi_setword(iface, WI_RID_PM_ENABLED, atoi(optarg)); + exit(0); + break; case 'h': default: usage(p); -- cgit v1.1