Subject: Re: PCMCIA cards and power control while suspending etc.
To: Lloyd Parkes <lloyd@must-have-coffee.gen.nz>
From: TAKEMURA Shin <takemura@netbsd.org>
List: tech-kern
Date: 09/24/2000 22:58:11
----- Original Message -----
From: "Lloyd Parkes" <lloyd@must-have-coffee.gen.nz>
To: <tech-kern@netbsd.org>
Sent: Wednesday, September 20, 2000 7:22 AM
Subject: PCMCIA cards and power control while suspending etc.


> So far so good. When the laptop suspends itself, the PCMCIA card (along
with
> everything else) is powered down. My problem is that the card doesn't
power
> back up when the laptop comes back to life. I have put some debugging
printfs
> in the code, and the activate function doesn't seem to be being called
either
> before or after the laptop is suspended.

I really think PCMCIA cards should be disabled before suspend and should be
enabled after resume automatically. But, currently, apm and pcmcia don't do
it.

You could write some scripts to enable/disable network interfaces. Please
see
man apmd(8). I've tried to write a script below. This seems to work well.

#!/bin/sh

case $0 in
*line)
        echo line > /dev/console
        ;;
*battery)
        echo battery > /dev/console
        ;;
*standby|*suspend)
        echo > /dev/console
        ifs=`ifconfig -l -u`
        echo $ifs > /etc/apm/interfaces
        for i in $ifs; do
                echo ifconfig $i down > /dev/console
                ifconfig $i down
        done
        ;;
*resume)
        ifs=`cat /etc/apm/interfaces`
        for i in $ifs; do
                echo ifconfig $i up > /dev/console
                ifconfig $i up
        done
        ;;
esac

Takemura