Public bug reported:

Binary package hint: laptop-mode-tools

Laptop-mode scripts can be added to turn on power management features in
intel wifi cards: ipw2200 and ipw3945.

This is the procedure to create the appropriate scripts:

For both intel 3945 (ipw3945 driver) and 2200 (ipw2200 driver) cards:

First, create the helper function file (taken from largecat's post on
page 2 of this thread):

Code:

sudo gedit /etc/acpi/intelWifiPwr.sh

copy & paste this code in the editor, save and exit.

Code:

#!/bin/bash
# Power saving setting for the Intel 3945 and 2200 wireless adaptor
#
# This script relies upon the name of the driver.

I3945_DRIVERNAME=ipw3945
I2200_DRIVERNAME=ipw2200

IWPRIV=/sbin/iwpriv
IWCONFIG=/sbin/iwconfig

SET_I3945_AC_PARMS="set_power 6"
SET_I3945_BAT_PARMS="set_power 7"

SET_I2200_AC_PARMS="power off"
SET_I2200_BAT_PARMS="power on"

#
# Find all the wireless devices using the supplied driver names.
# Place the interface names on the list WIFI_IFNAMES.
#
function findWifiIfsByDriver {
    local DEVICE;
    local LINK_TARGET;
    WIFI_IFNAMES=""

    for DEVICE in /sys/class/net/*; do
        if [ -d $DEVICE/wireless ]; then
# See if the driver for $DEVICE matches the supplied one by checking the link to
# the driver.
            if [ -h $DEVICE/device/driver ]; then
                LINK_TARGET=`readlink $DEVICE/device/driver | sed 's/.*\///'`

                if [ $LINK_TARGET == $1 ]; then

# add the interface name to the list
                    WIFI_IFNAMES=$WIFI_IFNAMES" "`echo -n $DEVICE | sed 
's/.*\///'`
                fi
            fi
        fi
    done
}


#
# Set all the adaptors using the supplied driver into the supplied
# power saving mode
#
# $1 - driver name
# $2 - power command
# $3 - power command arguments
#
function setWifiPwrSave {
    local DEVICE;
    findWifiIfsByDriver $1;

    for DEVICE in $WIFI_IFNAMES; do
#       echo "Would execute $2 $DEVICE $3"
        $2 $DEVICE $3
    done
}

function intel3945_BatPwrSave {
    setWifiPwrSave "$I3945_DRIVERNAME" "$IWPRIV" "$SET_I3945_BAT_PARMS"
}

function intel3945_AcPwrSave {
    setWifiPwrSave "$I3945_DRIVERNAME" "$IWPRIV" "$SET_I3945_AC_PARMS"
}

function intel2200_BatPwrSave {
    setWifiPwrSave "$I2200_DRIVERNAME" "$IWCONFIG" "$SET_I2200_BAT_PARMS"
}

function intel2200_AcPwrSave {
    setWifiPwrSave "$I2200_DRIVERNAME" "$IWCONFIG" "$SET_I2200_AC_PARMS"
}


Then we will create 2 scripts. The first will run when the laptop is unplugged, 
the later when it runs on AC.

On battery:

Code:

sudo gedit /etc/laptop-mode/batt-start/20-wireless-battery.sh

Then copy and paste this code into the editor, save and exit:

Code:

#!/bin/bash

# source the helper script
. /etc/acpi/intelWifiPwr.sh

# set Battery power saving
intel3945_BatPwrSave
intel2200_BatPwrSave

Make it executable:

Code:

sudo chmod +x /etc/laptop-mode/batt-start/20-wireless-battery.sh

On AC:

Code:

sudo gedit /etc/laptop-mode/batt-stop/20-wireless-ac.sh

Then copy and paste this code into the editor, save and exit:

Code:

#!/bin/bash

# source the helper script
. /etc/acpi/intelWifiPwr.sh

# set Battery power saving
intel3945_AcPwrSave
intel2200_AcPwrSave

Make it executable:

Code:

sudo chmod +x /etc/laptop-mode/batt-stop/20-wireless-ac.sh

** Affects: laptop-mode-tools (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Power management for intel wifi cards: ipw2200 and ipw3945 (fix included)
https://bugs.launchpad.net/bugs/136545
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to