Page 1 of 2

acpid-1.0.8-i486 pet package for Puppy 4.1.x

Posted: Fri 30 Jan 2009, 02:28
by Patriot
Hmmm .....

I was wondering why puppy doesn't react to the power button ... instead power just gets cut-off ... woops ...

Hmm, ok ACPI module isn't loaded ... now ACPI loaded with acpi=force ... but, still no reaction to power button ... looked for clues and found acpid ... Right, went off to grab the source, had a look and made a binary ... Configured and loaded acpid ... woops ... still no reaction to power button ...

Ok, after more reading and more checking, I understand now how it works ... Made a simple script to turn on power button support and set the config for puppy ... Walla ... press power button and puppy will now shutdown-and-poweroff ...

I did a search for a pet but found a pup ... Figured that a pet could make life easier for some ... This pet package contains acpid & acpi_listen daemon compiled from latest source 1.0.8 ... The /etc/acpi/events/acpid.conf file has the settings to shutdown and poweroff puppy which can be expanded to cover other acpi events ... A small script rc.acpi will be placed into init.d to turn on button and start acpid daemon ...

This pet package was tested with a LiveCD/Frugal & full hdd install on an old pentium II pc with a pre-2001 bios where ACPI needs to be turned on by acpi=force ...

Anyone who's willing to give this a try, please let me know how it goes ...

Rgds

Added: Updated acpid package with revised script.

Posted: Fri 30 Jan 2009, 05:17
by big_bass
This pet package contains acpid & acpi_listen daemon compiled from latest source 1.0.8 ..
Patriot

I was reading about that today also and downloaded the 1.0.4

it gave a compile error so I am glad to see that you got 1.0.8
working

I'll give it a try on live cd tomorrow *its late now

I'll keep ya posted



have you seen this post ?
http://www.murga-linux.com/puppy/viewtopic.php?t=38072

welcome to puppy :D
big_bass

Posted: Fri 30 Jan 2009, 09:56
by Patriot
Hmmm .....

Hey there big_bass !

Been using puppy for quite a while actually ... Definitely grew on me by each day ... :)
it gave a compile error so I am glad to see that you got 1.0.8
working
Went straight to sourceforge and found an updated source ... compiled sucesssfully on first try ... figuring how to get it to work took a bit while longer ...
I just did ... wowzer ... for fun, I did try recompiling the kernel myself and screwed up something ... haha ... need more time to experiment on that one ...

And could you try this one out for me ? I don't have a problematic system poweroff and it's only just a hunch .... Just to observe if there's anything different ... (it's supposedly do a forced shutdown bypassing init ... since init is busybox itself...)

- Edit /sbin/poweroff and add -f switch at the end, like this
exec /sbin/busybox poweroff -f

I'm also interested to know on what system config would such problematic poweroff occurs ...

And finally, I've revised the rc.acpi script to handle start/stop/restart ... I just noticed the acpid exit msg on shutdown and it bugs me, so I did a proper script ... I hope it is satisfactory ...

Rgds

Edit:
I've found a bug that prevents acpid to poweroff if you exit to terminal prompt. This should be the last fix for the week as I ran this pet over and over again until I get it right ... The new pet can be cleanly installed over the previous pet.

Please let me know how it goes ... Thanks ...
.

Posted: Sat 31 Jan 2009, 06:34
by big_bass
Patriot

I did try your package on a live CD puppy 4.12
I was not able to correctly test your pet for these reasons:

1.) my computer's power button doesn't send an event so I cant trap it
this is no fault of your package but my keyboard

2.)/proc/acpi folder is not there either so I cant even remap another key to test with

but ....since I have a slackware install also that already comes with acpi version 1.0.4 on slackware 12.1 I can see if another key would work

I did compile the latest 1.08 on my slack box and made a slackware.tgz package


so I'll keep ya posted
I hope we get some more testers
this has a lot of potential for laptops :wink:
even though I have a desktop

big_bass

Posted: Sat 31 Jan 2009, 21:20
by WhoDo
big_bass wrote:I hope we get some more testers
this has a lot of potential for laptops :wink:
even though I have a desktop
I can help there. I have included this for Puppy-4.2alpha3 release, so you should get a plethora of testers from that! :wink:

Posted: Fri 29 Jan 2010, 18:12
by Legeya
Patriot,
i installed your *.pet, rebooted and tried to shutdown computer by pressing the power-button. It switched off without any preparing procedures. Now puppy cannot boot, stops after "Recognising media devices".
What to do ?!!!!

P.S.
Forgot ! Puppy installed on HDD fully, and my computer is laptop Toshiba Satellite 4030CDT

Posted: Fri 29 Jan 2010, 20:12
by mikeb
http://www.murga-linux.com/puppy/viewtopic.php?t=36944
http://www.murga-linux.com/puppy/viewtopic.php?t=47668
http://www.murga-linux.com/puppy/viewtopic.php?t=45992
Now puppy cannot boot, stops after "Recognising media devices".
What to do ?!!!!
see the above links

mike

Posted: Fri 29 Jan 2010, 21:57
by afishe2000
I'm very new to linux but started out with an Apple IIe a long time ago and love all the things that can be done with scripting and such...

Got it working on a Dell Inspiron 2200 running Puppy 4.3.

Installed then rebooted.

Confirmed /usr/sbin/acpid was running as a process.

Edited /etc/acpi/events/acpid.conf to:

event=button/power*
action=/usr/bin/wmpoweroff

Momentary press of the power button preforms a normal shutdown.

Thanks...

Posted: Sat 30 Jan 2010, 14:13
by Patriot
Hmmm .....
Legeya wrote:..... my computer is laptop Toshiba Satellite 4030CDT
The 4030CDT is likely to have acpi disabled by the kernel if the bios predates 2001 ... If acpi is not working, acpid won't either ... You can try adding acpi=force on the kernel line on bootup to force acpi on ... If I'm not mistaken the bios dsdt should work for acpi on 4030CDT ... YMMV ...
afishe2000 wrote:..... Edited /etc/acpi/events/acpid.conf to:

event=button/power*
action=/usr/bin/wmpoweroff
Ok, I will update the packages in a couple of days to support all puppy >= 4.0 versions ...


Rgds

How Does It Work?

Posted: Sun 14 Feb 2010, 20:58
by bigpup
I added this to Puppy Stardust 009 and it works for me.
Push power button, Puppy does normal shutdown, and computer powers off.
Nice!

Note:

My power button is the kind that has to be pushed for 4 or 5 seconds to kill power. When using this program, I push it for 1 or 2 seconds and it does not shut off power, but starts Puppy shutdown. Power shuts off at the end of Puppy shutdown.

Posted: Sun 14 Feb 2010, 21:34
by DaveS
Patriot, this is so cool. I hated that this was missing from 4.3, but could not find how to implement it. Found this thread via the stardust thread, thanks so much.............

acpid-1.0.10-1.pet

Posted: Fri 26 Feb 2010, 02:28
by shinobar
Hi Partiot and to all,
Here you can find acpid-1.0.10-1.pet supports suspend with lid closing for notebooks.
it also offers shutdown dialog when the power button is pressed.

Re: acpid-1.0.10-1.pet

Posted: Thu 07 Oct 2010, 22:51
by george2002
shinobar wrote:Hi Partiot and to all,
Here you can find acpid-1.0.10-1.pet supports suspend with lid closing for notebooks.
it also offers shutdown dialog when the power button is pressed.
Thx for that nice program :) works like harm on puppy 5.1 and HP Thin Client T5520
I only reconfigured time that puppy wait for shuttdown to 5 seconds after key is pressed :)

Greetings 4 all
George2002

Posted: Tue 07 Dec 2010, 10:24
by Karl Godt
Here you can find acpid-1.0.10-1.pet supports suspend with lid closing for notebooks.
it also offers shutdown dialog when the power button is pressed.
Found one bug at least :
#!/bin/sh
# Patriot Jan 2009 for Puppy Linux 4.1.1 GPL
# Revision 0.0.2

### ACPI : Power Button ###
acpi_start() {
if [ -f proc/acpi/button/power/PWRF/info ]; then
echo "Power Button module already loaded."
should be
if [ -f /proc/acpi/button/power/PWRF/info ]; then

Changed acpid_poweroff

Posted: Thu 10 Feb 2011, 19:47
by soliver
Hello there and many thanks (Patriot and shinobar) for the prog.

I made some changes to get standby working (and some other little things). Don't know if it's working for all comuters, but for my Asus, Sony and Dell notebooks it is.
Here's the code of the acpi_poweroff.sh. Please have a look at it and sorry for playing so "bad" with the script. I'm a rookie :wink:

Code: Select all

#!/bin/sh
# Patriot Jan 2009 for Puppy Linux 4.1.1 GPL
# Revision 0.0.6
# 13sep09 dialogbox by shinobar
# 4nov09 TIMELIMIT 30sec
# 26dec09 wmpoweroff, adjustable less than 10sec.
# 12feb10 stop acpid before powroff
# little mods and german locale by soliver for veggie-pupp THANKS to Patriot and shinobar

TIMELIMIT=30	# sec, no dialog if 0(zero).

#_farewell="Power button is pushed, and about to shut down..."
_press="Press"
_ok="'OK'"
_shutdown="to shutdown right now,"
_standby="'Standby'"
_standbymodus="to go to standby modus (be careful!),"
_standbycomment="(will TRY to unmount all drives)"
_cancel="'Cancel'"
_or="or"
_continue="to continue with puppy."
_ten_sec="Shutting down in 10 seconds."
_limit1="Shutting down in"
_limit2="seconds."

#echo $0 > /root/acpi.log
#date >> /root/acpi.log

#changed sound ;-)
#SOUND="/usr/share/audio/leave.wav"
#PLAY="aplay"
#[ -f "$SOUND" ] && which $(basename $PLAY) >/dev/null && $(basename $PLAY) "$SOUND" 

#echo "DISPLAY=$DISPLAY" >> /root/acpi.log
X_pid=`ps ax | awk '{if (match($5, "X$") || $5 == "X") print $1}'`
if [ "$X_pid" != "" ]; then
#if [ "$DISPLAY" != "" ]; then
 [ -f /etc/rc.d/PUPSTATE ] && source /etc/rc.d/PUPSTATE
 [ -f /etc/rc.d/pupsave.conf ] && source /etc/rc.d/pupsave.conf
 GTKDIALOG=$(which gtkdialog3)
 PUPSAVECONFIG=$(which pupsaveconfig)
 [ "$PUPSAVECONFIG" = "" ] && PUPSAVECONFIG=$(which pupsave)
 [ "$TIMELIMIT" = "" ] && TIMELIMIT=0
 if [ $TIMELIMIT -gt 0 ] && [ "$GTKDIALOG" != "" ] && \
  [ "$PUPMODE" != "5" -o "$PRECHOICE" != "" -o "$PUPSAVECONFIG" = "" ]; then

   mo=acpi.mo
   # set locale
   for lng in C $(echo $LANGUAGE|cut -d':' -f1) $LC_ALL $LANG;do :;done   # ex.    ja_JP.UTF-8
   # search locale file
   lng1=$(echo $lng|cut -d'.' -f1)      # ex.   ja_JP
   lng2=$(echo $lng|cut -d'_' -f1)   # ex.   ja
   LOCALEDIR=/usr/share/locale
   [ "$mo" ] || mo=$(basename $0).mo
   for D in en C $lng2 $lng1 $lng
   do
     F="$LOCALEDIR/$D/LC_MESSAGES/$mo"
     [ -f "$F" ] && . "$F"
   done
   DIV=10
   [ $TIMELIMIT -le 20 ] && DIV=5
   [ $TIMELIMIT -le 10 ] && DIV=$TIMELIMIT
   STEP=$(($TIMELIMIT / $DIV))
   TIMELIMIT=$(($STEP * $DIV))
   PITCH=$((100 / $DIV))
   export DIALOG="<window title=\"acpid_poweroff\">
	 <vbox>
		<pixmap><input file>/usr/share/themes/Yattacier2/gtk-2.0/gtk-stop.png</input></pixmap>
			<text use-markup=\"true\">
			 <label>\"$_press <b><i>$_ok</i></b> $_shutdown\"</label>
			</text>
			<text use-markup=\"true\">
			 <label>\"<b><i>$_standby</i></b> $_standbymodus\"</label>
			</text>
			<text use-markup=\"true\">
			 <label>\"<b><small>$_standbycomment</small></b>\"</label>
			</text>
			<text use-markup=\"true\">
			 <label>\"$_or <b><i>$_cancel</i></b> $_continue\"</label>
			</text>
			<progressbar>
			 <label>$_limit1 $TIMELIMIT $_limit2</label>
			 <input>for i in \$(seq 0 $PITCH 100); do echo \$i; sleep $STEP; done</input>
			 <action type=\"exit\">OK</action>
			</progressbar>
		<hbox>
			<button>
			 <label>Standby</label>
			 <input file>/usr/local/lib/X11/mini-icons/mini-monitor3.xpm</input>
			 <action>ls /mnt | while read m;do  umount -a -f "/mnt/$m" 2>/dev/null ; done</action>
			 <action>sleep 2</action>
			 <action>echo 3 > /proc/acpi/sleep &</action>
			 <action type=\"exit\">Cancel</action>
			</button>
			<button cancel></button>
			<button ok></button>
		</hbox>
	 </vbox>
	</window>"
 #echo "$DIALOG"
	eval $($GTKDIALOG -p DIALOG -c)
	[ "$EXIT" = "Cancel" ] && exit
 fi
#doesn't work for my eeepc but for my dell (it's even working without this)
# P=wmpoweroff
#else
# P=poweroff
fi
#doesn't work for my eeepc but for my dell (it's even working without this)
#/etc/init.d/rc.acpi stop
#exec $P

#sound now here
SOUND="/usr/share/audio/leave.wav"
PLAY="aplay"
[ -f "$SOUND" ] && which $(basename $PLAY) >/dev/null && $(basename $PLAY) "$SOUND" 

#poweroff
/etc/init.d/rc.acpi stop
rxvt +sb -fn 7x14 -geometry 30x1 -bg lightblue -title acpi_poweroff -e wmpoweroff
Made with puppy 4.1.2
If someone is interested I can upload the prog as a pet.
Thanks and Greets
sOliver

Re: Changed acpid_poweroff

Posted: Wed 16 Feb 2011, 09:26
by shinobar
soliver wrote:I made some changes to get standby working (and some other little things).
Great, soliver!

I suggest to place the 'Cancel' button at the left end, so that we can just press 'Enter' key to continue Puppy.
This is for the sake if we press the power button by mistake seeing the screen blacked out with the screen saver.

Posted: Wed 13 Jul 2011, 03:00
by ahoppin
I just loaded acpid-1.0.10-1.pet on my Thinkpad T23 with Lucid Puppy 5.2.5. The shutdown on power button press doesn't work for me (though that does work in Lighthouse Puppy 5.0.3), but the suspend function seems to work great. Since that's what I'm mainly interested in, I call this script a success. Thanks!

Posted: Wed 13 Jul 2011, 05:29
by ahoppin
Guess I spoke too soon. Audio is muted after a suspend/restore cycle. However I found that issuing the following commands restores the audio:

amixer PCM mute
amixer PCM unmute
amixer Master mute
amixer Master unmute

It seems as if all of them are required.

I put these in a shell script so they're easy to run on resuming, but is there any way to make this automatic? (Apologies for my ignorance.)

Posted: Fri 15 Jul 2011, 09:46
by chiron
You can add all actions you want done after wakeup in your suspend script ...

You find the script /etc/acpi/actions/suspend.sh

In the script, find the line

Code: Select all

# process at recovery from suspend
following that line, you can put in the commands you want executed after wakeup. I suggest you also add

Code: Select all

/etc/rc.d/rc.network restart
since the network might also be down after the siesta ;)

Posted: Sat 16 Jul 2011, 17:55
by ahoppin
That worked perfectly! Many thanks!