Posts: 604
thriftee
Joined: 27 Feb 2009
#1
I'm running 386 Full with IceWm desktop on laptops, and I've been trying to figure it out how to change the power button to make the system go to sleep or better yet, pop-up the logout menu window, but don't see what happens when the button is pressed to be able to change the action. I also wish I could see the code for the logout menu, but haven't been able to find it.

I was partially successful changing the / etc/acpi/events/powerbtn-acpi-support action to point to / etc/acpi/sleep_suspend.sh sleep and it does go to sleep, but it goes to xlock and when I type the password, it says it is invalid so it doesn't want to come back when I wake it up.

Also, when it wakes up the mouse cursor is invisible. This happens when I suspend from the logout menu, too.

Did I go about this wrong? I just couldn't handle spending 20mb of memory for the xfce power manager just to change the button.

Any ideas would be appreciated...
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#2
several reputed fixes for"invisible mouse cursor after resume" posted here:

========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://bugs.launchpad.net/ubuntu/+bug/552214"
linktext was:"https://bugs.launchpad.net/ubuntu/+bug/552214"
====================================


xl
Posts: 604
thriftee
Joined: 27 Feb 2009
#3
Thanks, skidoo, I didn't find the answer there, per se, but that led me to one which works, at least on my HP so far.

From:
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://ubuntuforums.org/showthread.php?t=2320013&s=902bd954b63ceb3e8e4cafcf25705403&p=13472993#post13472993"
linktext was:"https://ubuntuforums.org/showthread.php ... st13472993"
====================================


Add a script to /lib/systemd/system-sleep

Code: Select all

#!/bin/bash                                                                                                                                                   
# fix-mouse-cursor.sh - fix invisible cursor after suspend/resume                                                                                             
if ["$1" ="post" ]; then                                                                                                                                    
    modprobe -r psmouse                                                                                                                                       
    modprobe psmouse                                                                                                                                          
fi;                                                                                                                                                           
exit 0
Thanks again... So much for the invisible cursor after suspend/resume bug.

Any ideas on the power button? I did it again twice today. On my work PC I hit the button to suspend, and again to resume, and I keep doing that by mistake on antiX. On puppy, it popped up a window asking me if I wanted to cancel, suspend or shutdown, so it wasn't a problem there.
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#4
Frankly, I don't use xlock so would just"sudo apt remove xlockmore"
Posts: 604
thriftee
Joined: 27 Feb 2009
#5
skidoo, yes, You certainly have good ideas. I did that but then had no password to protect the system on resume

I noticed sucless tools has a program called slock, but unsure how that could be implemented in place of xlockmore.

I installed xscreensaver (huge) and that fixes the xlockmore issue.

One issue remains. I suspend,, then i press a key to wake it up, then I need to wait for it to resume and sleep again, then press a key again, and then finally it asks for the password, but at least now it accepts it and resumes, mouse cursor and all. Very odd!

PS: I deinstalled xscreensaver and am trying xautolock and xtrlock. slock isn't pretty at all as you can't even tell you typed a key or not, etc. I'm not sure that's very important for me, but it wouldn't be a good solution on a distro as a result. Yeah, this is good enough.

I had to install xautolock and xtrlock
I had to edit desktop-session/startup
added 2 lines to blank the screen and lock it after 20 min:
# setup sceen lock timeout
xautolock -time 25 -locker"xtrlock -b" &

It still takes 2 tries to resume. I think its doing a 2nd suspend, but don't know why or how to tell it not to. I don't understand that part.

I don't understand the"dbus" thing at all and wonder if the reason I need to resume twice has something to do with it or the"upower" program which I also don't understand. Maybe one of those is calling the acpi 'ssuspend program more than once? I can see from my debug output that it gets called twice each time I suspend and try to resume.

I found that the logout option runs desktop-session-exit and that the shutdown and suspend options run:

Code: Select all

                                                                                                                                          
-s|--shutdown)                                                                                                                                              
if [ -e / etc/live/config/save-persist -o -e /live/config/persist-save.conf ] && which persist-config &> /dev/null; then                             
        sudo persist-config --shutdown --command poweroff                                                                                                   else                                                                                                                                                
        sync                                                                                                                                                    sudo chvt 1                                                                                                                                     
        sudo poweroff                                                                                                                                       fi                                                                                                                                                  
    ;;                                                                                                                                                  -S|--suspend)                                                                                                                                           
    dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend                                 ;;                         
 
Any ideas why the acpi suspend program gets called again when I try to resume?
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#6
"I think its doing a 2nd suspend, but don't know why or how to tell it not to."

I'm not convinced"suspend gets called again" during resume. dbus serves as a conduit for interprocess communication.
The"dbus-send" command is just delivering a message to be received by any listeners registered for that (suspend/shutdown) event.

On the affected machine, check your logfiles for lines mentioning acpi or power -related errors. Also, look in your bios setup screen(s) for mention of"C states" or power management. IIRC, several levels/states exist. _Possibly_, the linux suspend is commanding"low, low, super low" state... but your bios (or your particular CPU) doesn't support that level. Analogy: the first resume command signals"upshift to second gear". Oops your machine's drivetrain only provides low and high gear, so ignores. After timeout, ACPI signals again"upshift to high gear" and that's when machine proceeds with the resume. I've little knowledge of acpi workings; docs might instruct how to config so that a specific Cstate is is requested for suspend event vs powernap vs hibernate...
Posts: 604
thriftee
Joined: 27 Feb 2009
#7
Thanks for the reply, skidoo. I added and echo to a log file each time the acpi suspend script is called and its timestamped so I can see the 2nd time it ran was 5 minutes later when I tried to resume. I don't know how the suspend script actually gets called though or from where