# laptop suspend and pcmcia card stays on

## antrod

I have the oddest problem when I put my Sony Z505RX Vaio to sleep. The computer suspends/resumes correctly, but my lucent Wavelan card stays on after the computer is suspended until I manually yank the card out of the socket. I wouldnt mind except for the fact that this is likely to drain the battery while the computer is suspended. 

I used to have Debian on this laptop and this worked well. Does this have to do with apmd (which I don't have installed due to the emerge compile error) or is it some setting in the pcmcia confs? 

I have apm compiled into my kernel which is why I think suspend/resume works.

Thanks, 

Antonio

----------

## smckown

Most distributions use apmd and have scripting in place to deal with suspend and resume events.  Usually, upon receipt of a suspend event, a script is ran that issues 'cardctl suspend' to power down pcmcia cards.  Other actions are also often taken to deal with sound, networking, X, and so on.  Remember that built-in devices and not just PCMCIA may need to be massaged to properly handle suspend/resume cycles.

You may want to:

emerge apmd

Then you can add a script to /etc/apm/event.d to suspend and resume the pcmcia subsystem on APM suspend/resume events.  You may want to grab scripts from another distribution to use as a starting point.

----------

## TomorrowPlusX

Is there any command line call I could put into a script which would force X to "wake up" the video card?

When I suspend my thinkpad and close the lid, on restarting the machine wakes up, but the display is just noise and doesn't respond (it's not actually noice, it's a corrupted weird glimpse of whatever was in the video memory when I suspended the laptop)

I can usually get the machine to wake up the video card by forcing a graphics mode shift, usually by hitting ctrl-alt-f2 (or something) to get to the framebuffer console. Then I switch back to X and all's well. 

But if there were a cleaner approach I'd love to hear it. Doing what I describe above feels... well, cheezy. It doesn't instiall me with confidnce. I'd rather have a wakeup script for apmd to run which would call something which would wake up X. 

And ideas?

----------

## smckown

You've got the classic symptom of graphics hardware that doesn't like to resume directly into a graphics mode.  The conventional solution is to place the display into a text mode upon suspend, then after resume restore it to graphics mode.

X11 typically runs as virtual terminal (vt) 7.  You can switch to a text console by pressing ctrl-alt-F1.  You can return to X by pressing ctrl-alt-F7.  The correct script will automate these steps, toggling to vt1 on suspend and returning to vt7 on resume.

Place the following code snippet into /etc/apm/event.d/X

--start of script--

#!/bin/bash

# APM event script for X11

#

case "$1" in

    suspend|standby)

        [ -n "`pidof X`" ] && chvt 1

        ;;

    resume)

        [ -n "`pidof X`" ] && chvt 7

        ;;

esac

exit 0

--end of script--

Don't forget to make the script executable:

chmod 755 X

You are then ready to try it out.  If for some reason your screen goes haywire and you can't restore it, you can probably get it to restart by pressing ctrl-alt-delete.

----------

