From owner-freebsd-mobile@FreeBSD.ORG Thu Jun 19 15:12:16 2003 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 66AA237B401 for ; Thu, 19 Jun 2003 15:12:16 -0700 (PDT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D30343FB1 for ; Thu, 19 Jun 2003 15:12:15 -0700 (PDT) (envelope-from freebsd-mobile@m.gmane.org) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19T7dY-0002sa-00 for ; Fri, 20 Jun 2003 00:12:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-mobile@freebsd.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19T7dV-0002sG-00 for ; Fri, 20 Jun 2003 00:12:05 +0200 From: Jesse Guardiani Date: Thu, 19 Jun 2003 18:12:10 -0400 Organization: WingNET Lines: 82 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@main.gmane.org User-Agent: KNode/0.7.2 X-Mail-Copies-To: never Sender: news Subject: Re: automatic wireless powersave X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jesse@wingnet.net List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2003 22:12:16 -0000 Jesse Guardiani wrote: > Jesse Guardiani wrote: > > Check this out. > > I threw a quick little script together that > does this pretty well. See attached. Ah. Apparently application/x-shellscript isn't a support MIME type on this list (or between GMANE and this list). See below for shell script: ---------------------------------------------------- #!/bin/sh # # Copyright (c) 2003 Jesse D. Guardiani # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # sample run command file for APM POWERSTATECHANGE Event WI_INTERFACE="wi0" # If we are on mains power... if [ `apm -a` -eq 1 ]; then logger -p user.notice "rc.powerstatechange: Running on Mains..." # attempt to turn OFF powersave mode ifconfig $WI_INTERFACE -powersave if [ $? -eq 0 ]; then logger -p user.notice "rc.powerstatechange: powersave OFF for interface $WI_INTERFACE!" else logger -p user.notice "rc.powerstatechange: WARNING!! 'ifconfig $WI_INTERFACE -powersave' FAILED!" fi else logger -p user.notice "Running on Battery..." # attempt to turn ON powersave mode ifconfig $WI_INTERFACE powersave if [ $? -eq 0 ]; then logger -p user.notice "rc.powerstatechange: powersave ON for interface $WI_INTERFACE!" else logger -p user.notice "rc.powerstatechange: WARNING!! 'ifconfig $WI_INTERFACE powersave' FAILED!" fi fi exit 0 -- Jesse Guardiani, Systems Administrator WingNET Internet Services, P.O. Box 2605 // Cleveland, TN 37320-2605 423-559-LINK (v) 423-559-5145 (f) http://www.wingnet.net