[laptop-mode] about laptop-mode

Ritesh Raj Sarraf rrs at researchut.com
Mon May 4 13:22:23 CEST 2009


--nextPart1279851.aOnMgGJDj4
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Monday 04 May 2009 16:42:53 Bart Samwel wrote:
> Yup, I meant that we need to signal acpid. For Debian the postinst
> script should call the init file for acpid to do it (that's the clean
> way, I guess), but for other distros (install.sh) it should probably be
> a killall -HUP acpid or something like that, because invoking init
> scripts in a distro independent way is close to impossible in my
> experience. :-/

Shouldn't acpid be HUPed every time LMT is restarted ?

rrs at champaran:~/devel/Laptop-Mode-Tools/LMT-Debian$ bzr diff               =
   =20
=3D=3D=3D modified file 'etc/init.d/laptop-mode'
=2D-- etc/init.d/laptop-mode      2008-06-22 14:13:34 +0000
+++ etc/init.d/laptop-mode      2009-05-04 11:20:08 +0000
@@ -22,10 +22,26 @@

 . /lib/lsb/init-functions

+check_acpid()
+{
+    # Check if acpid is running
+    run=3D`pidof acpid`;
+
+    # Check if it is installed
+    if [ -z $run ]; then
+        log_daemon_msg "laptop-mode depends on acpid. acpid is not running"
+    else
+        log_action_begin_msg "laptop-mode: Reloading acpid"
+        killall -HUP acpid;
+        log_action_end_msg $?
+    fi
+}
+
 # Enable laptop mode when the system is booted when running on battery.

 case $1 in
   start)
+    check_acpid;
     log_action_begin_msg "Enabling laptop mode"
     mkdir -p /var/run/laptop-mode-tools
     touch /var/run/laptop-mode-tools/enabled
@@ -41,6 +57,9 @@
     RESULT=3D`/usr/sbin/laptop_mode init stop`
     log_action_end_msg $? "$RESULT"

+    # Run acpid check
+    check_acpid;
+
     # Now remove files containing stored status, re-enable, and start it u=
p=20
again.
     log_action_begin_msg "Enabling laptop mode"
     rm -f /var/run/laptop-mode-tools/*

Ritesh
=2D-=20
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."


--nextPart1279851.aOnMgGJDj4
Content-Description: This is a digitally signed message part.
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.samwel.tk/pipermail/laptop-mode/attachments/20090504/80e4fd35/attachment.pgp 

--nextPart1279851.aOnMgGJDj4--


More information about the laptop-mode mailing list