Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Jul 2014, 05:09
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Suspend script (for laptops)
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: Sun 03 Dec 2006, 16:37    Post_subject:  Suspend script (for laptops)
Sub_title: - 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
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: 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 Smile

cheers

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send_private_message Visit_website 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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 Rolling Eyes
Back to top
View user's profile Send_private_message Visit_website 
Braden

Joined: 22 Sep 2006
Posts: 70
Location: Waterloo, Ontario, Canada

PostPosted: 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
View user's profile Send_private_message MSNM 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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 Very Happy

Now I have seen that this script works only with Xorg, but not Xvesa. Can you confirm?
Back to top
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Mon 04 Dec 2006, 14:49    Post_subject:  

I execute them with
Code:
sh /etc/wlan0mode


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** Embarassed 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

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
Braden

Joined: 22 Sep 2006
Posts: 70
Location: Waterloo, Ontario, Canada

PostPosted: 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
View user's profile Send_private_message MSNM 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: 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
View user's profile Send_private_message Visit_website 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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
View user's profile Send_private_message Visit_website 
Brian C

Joined: 09 Feb 2006
Posts: 168

PostPosted: 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
View user's profile Send_private_message 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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: Rolling Eyes hehehe I forgot you could do that in a gui-style by firing the Xorg video wizard and choosing the resolution changer

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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.
foto_schermo_320.jpg
 Description   
 Filesize   78.09 KB
 Viewed   5246 Time(s)

foto_schermo_320.jpg

Back to top
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: 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
View user's profile Send_private_message Visit_website 
emike

Joined: 23 Dec 2006
Posts: 6

PostPosted: Thu 28 Dec 2006, 19:45    Post_subject: Suspends put doesn't Resume
Sub_title: 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
View user's profile Send_private_message 
debernardis


Joined: 12 Nov 2005
Posts: 180

PostPosted: 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 Cool Cool Cool Cool
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0916s ][ Queries: 12 (0.0068s) ][ GZIP on ]