Author |
Message |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Sun 03 Dec 2006, 16:37 Post subject:
Suspend script (for laptops) Subject description: - experimental, please test |
|
I modified the script suggested by Lobster (here) as follows:
Code: | #!/bin/sh
# this script was adapted for Puppy 2.12 by EdB, from the original in
# http://www.linux.com/article.pl?sid=06/05/24/1716222
# discover video card's ID
ID=`lspci -i /usr/share/pci-usb-pcmcia.ids | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`
# securely create a temporary file
TMP_FILE=`mktemp /var/tmp/video_state.XXXXXX`
# trap 'rm -f $TMP_FILE' 0 1 15
# switch to virtual terminal 2 to avoid graphics
# corruption in X
chvt 2
# write all unwritten data (just in case)
sync
# dump current data from the video card to the
# temporary file
cat /proc/bus/pci/$ID > $TMP_FILE
# suspend
echo -n mem > /sys/power/state
# restore video card data from the temporary file
# on resume
cat $TMP_FILE > /proc/bus/pci/$ID
# switch back to virtual terminal 3 (running X)
chvt 3
# remove temporary file
rm -f $TMP_FILE
# needed by my wlan internal card!
iwconfig wlan0 essid any |
This works on my 2.12-based rudypuppy, on an hp pavilion zv6278ea.
Please test it on your laptops and let me know... I plan to include it in my next puplet
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Mon 04 Dec 2006, 01:02 Post subject:
|
|
Jutst a comment on this part:
Code: | # needed by my wlan internal card!
iwconfig wlan0 essid any |
The network wizard creates the scripts /etc/wlan0wireless and /etc/wlan0mode
It may be preferrable to execute those files when waking up instead of adding custom code to your script.
I will test tomorrow
cheers
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Mon 04 Dec 2006, 07:33 Post subject:
|
|
rarsa wrote: |
The network wizard creates the scripts /etc/wlan0wireless and /etc/wlan0mode
It may be preferrable to execute those files when waking up instead of adding custom code to your script. |
Unfortunately those files are not executable in my puppy.
Why?
I'll see now if in a plain puppy it's like that too.
EDIT: also in a plain 2.12 puppy those files are not executable.
EDIT EDIT: is this the right way to do that?
Code: | cat /etc/wlan0wireless|sh
cat /etc/wlan0mode|sh |
It works indeed
|
Back to top
|
|
 |
Braden
Joined: 22 Sep 2006 Posts: 70 Location: Waterloo, Ontario, Canada
|
Posted: Mon 04 Dec 2006, 12:27 Post subject:
|
|
That works, but the canonical technique is to use the source command:
Code: | source /etc/wlan0wireless
source /etc/wlan0mode |
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Mon 04 Dec 2006, 13:45 Post subject:
|
|
Braden wrote: | That works, but the canonical technique is to use the source command |
Thanks, that works too, and I have learned one other thing
Now I have seen that this script works only with Xorg, but not Xvesa. Can you confirm?
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Mon 04 Dec 2006, 14:49 Post subject:
|
|
I execute them with
The scripts are independent of the X driver you are using. I don't see a reason why Xorg or XVesa would have anything to do with these scripts.
**EDIT** Oh, you mean the suspend script.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Last edited by rarsa on Tue 05 Dec 2006, 01:04; edited 1 time in total
|
Back to top
|
|
 |
Braden
Joined: 22 Sep 2006 Posts: 70 Location: Waterloo, Ontario, Canada
|
Posted: Mon 04 Dec 2006, 15:33 Post subject:
|
|
Does Xvesa react badly to having its proc entries accessed (less likely) or modified (more likely)? Are they formatted the same?
When it doesn't work with Xvesa, does it refuse to suspend, refuse to resume? Crash? When?
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Tue 05 Dec 2006, 01:31 Post subject:
|
|
Well, It worked for me! No problems, no freezes.
Dell Latitude D610.
I made a small change to the script to make it 100% generic.
I've revised my advice and at the end of the script instead of Code: | # needed by my wlan internal card!
iwconfig wlan0 essid any | I am advising to do Code: | # needed to restart network connections!
source /etc/rc.d/rc.network | To start the network connections as if the computer was just booting.
Of course, that will only work if the user used the network wizard to setup the network and saved his/her configuration. But as that is the recommended way of setting a connection then I guess is the best we can do.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Tue 05 Dec 2006, 03:24 Post subject:
|
|
OK, Rarsa's call to rc.network works for me, too.
Now, the problems:
1. in XORG, when I am back from the suspend script, I find that the consoles #1 and #2 (ctrl-alt-f1 and ctrl-alt-f2) do not show the normal 640x480 video mode any more. Console #1 has an abnormal video mode with expanded chars, and console #2 sports some grey and black stripes. In console #2, the "reset" command restores an expanded char mode like in console #1.
I don't know how to restore the normal 640x480, 80x25 text mode.
X in console #3 (ctrl-alt-f3) has no problems.
This is quite a problem when, i.e., you exit from X to prompt in console #1, because you won't be able to see console output except for the leftmost chars of each line.
2. in XVESA, I do confirm that the script suspends my machine but does not restore X. Interestingly, even before you even start the suspend script, XVESA seems unable to change to console with ctrl-alt-f2 and back to X with ctrl-alt-f3, because X gets corrupted, so maybe there is a bug in console switching under Xvesa.
This seems to be already known: http://www.murga-linux.com/puppy/viewtopic.php?highlight=xvesa+console&t=5580
|
Back to top
|
|
 |
Brian C
Joined: 09 Feb 2006 Posts: 168
|
Posted: Tue 05 Dec 2006, 19:35 Post subject:
|
|
The script from your first post works almost PERFECTLY on my Dell Inspiron e1405. The only thing I've noticed is that when I come back, my screen is stretched to the full display (I only have it set for 1280x800, still working on making 1440x900 work) instead of being 1-1 pixels. Thanks so much!
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Wed 06 Dec 2006, 02:04 Post subject:
|
|
Brian C wrote: | The only thing I've noticed is that when I come back, my screen is stretched to the full display |
I don't know if it may help you, but try to open a console terminal and give the command xrandr. You will see several video modes like those:
Code: | sh-3.00# xrandr
SZ: Pixels Physical Refresh
*0 1280 x 800 ( 433mm x 271mm ) *60
1 640 x 350 ( 433mm x 271mm ) 60
2 640 x 400 ( 433mm x 271mm ) 60
3 720 x 400 ( 433mm x 271mm ) 60
4 640 x 480 ( 433mm x 271mm ) 60
5 800 x 600 ( 433mm x 271mm ) 60
6 1024 x 768 ( 433mm x 271mm ) 60
7 832 x 624 ( 433mm x 271mm ) 60
8 1152 x 768 ( 433mm x 271mm ) 60
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none |
Next, choose the one you like (suppose is #6, 1024x768) and give xrandr -s 6... your screen resolution should change accordingly.
Maybe this can restore your optimal resolution.
EDIT: hehehe I forgot you could do that in a gui-style by firing the Xorg video wizard and choosing the resolution changer
Last edited by debernardis on Wed 06 Dec 2006, 02:40; edited 1 time in total
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Wed 06 Dec 2006, 02:10 Post subject:
|
|
To better understand the screen problems in virtual console #2 that I get after running the suspend script, here's a photo.
I tried to reset the video mode of the text console by running a program, SVGATextMode, which according to its Authors should reset or modify the video mode of virtual consoles, but with no joy.
This problem is quite annoying and I hope that somebody helps me fixing.
Description |
|
Filesize |
78.09 KB |
Viewed |
7155 Time(s) |

|
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Sat 09 Dec 2006, 23:34 Post subject:
|
|
I didn't find that problem. I was able to restart the computer and switch virtual consoles with no problem.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
emike
Joined: 23 Dec 2006 Posts: 6
|
Posted: Thu 28 Dec 2006, 19:45 Post subject:
Suspends put doesn't Resume Subject description: Get a blank screen after resuming |
|
Hey guys (and gals if appropriate),
Kudos for working on this project! I would come close to Puppy Nirvana if I could get it to Suspend and Resume like Windoze on my NC4010 Compaq Laptop. I am an admitted linux and Puppy noob so please excuse me if I ask or say something stupid.
The script powers down my laptop without a problem, but when I power back up, I get a blank screen without even a blinking cursor. Ctrl-Alt-Backspace has no effect and attempting to change consoles with the Ctrl-Alt-F1 to F4 also has no effect. I am running IceWm if that makes a difference although I went back to JVM just to see the script would work there and it did the exact same thing.
Any help at all would be most appreciated. Thanks a million from a grateful and very happy Puppy user.
|
Back to top
|
|
 |
debernardis

Joined: 12 Nov 2005 Posts: 180
|
Posted: Fri 29 Dec 2006, 01:25 Post subject:
|
|
It is difficult to spot the problem. One point is that in my experience the script works,in Xorg, but fails in Xvesa. Could this be the culprit? If you have enabled Xvesa, you can turn to Xorg (among other methods) by exiting to prompt and running 'xorgwizard'.
Otherwise, that might be something specific to your graphics adapter. You could google for 'suspend + the name of your adapter' on google linux ( http://www.google.com/linux ) to see if there are known issues.
In each case, please post your experiences here, so that you can contribute to the development of the suspend feature
|
Back to top
|
|
 |
|