[laptop-mode] about laptop-mode

Ritesh Raj Sarraf rrs at researchut.com
Mon May 4 13:08:54 CEST 2009


--nextPart3671241.qXkyx8XLyz
Content-Type: text/plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Does this look good.

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

 . /lib/lsb/init-functions

+check_acpid()
+{
+    # Check if acpid is running
+    run=3D`pidof acpid`;
+
+    # Check if it is installed
+    if [ -f /etc/init.d/acpid ]; then
+        if [ -z $run ]; then
+            log_daemon_msg "laptop-mode: Starting acpid"
+            /etc/init.d/acpid start;
+        else
+            log_daemon_msg "laptop-mode: Reloading acpid"
+            /etc/init.d/acpid reload;
+        fi
+    else
+        log_failure_msg "laptop-mode: acpid not available"
+    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 +61,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



On Monday 04 May 2009 15:54:59 Ritesh Raj Sarraf wrote:
> On Sunday 03 May 2009 18:44:14 Bart Samwel wrote:
> > Hi Guido,
> >
> > Wido wrote:
> > > Hi! my name is Guido (but you may call mi wido). I'm a debian user for
> > > a while and I've recently installed laptop-mode-tools (right now, I'm
> > > with testing). I'm a laptop user since a couple years, having now a
> > > thinkpad t61 (this is since last august).
> > > After I installed laptop-mode, I started to check all conf files and
> > > set it as I like (btw, cool files, very completes and clean), and as
> > > soon as i get all that working, I restarted the laptop mode and tried
> > > it.......nothing happened. I started digging and digging with the
> > > scripts and the acpi calls....nothing. Then, I started reading the FAQ
> > > and I got the light. I've been using hibernate for a while, so I'm not
> > > used to reboot my laptop. Actually, I tend to not reboot it at all (in
> > > case something doesn't work fine).
> > > Quick answer, the ACPI daemon script needed to be restarted in order
> > > to take the new scripts, otherwise it didn't work (trying to do some
> > > black magic, i symlinked the lm-events to the original acpi events,
> > > but that didn't worked either). After restarting acpi, everything
> > > worked fine
> >
> > Hmmm, this sounds like acpid could use a SIGHUP at the end of the
> > installation script. Ritesh, is this something you can try and add? I'm
> > not even sure if the Debian package does that in postinst, and it does
> > sound necessary...
>
> You mean the package's postinst script ?
> That'd solve only part of it.
> IIUC, the user reports that after customizing and restarting LMT, the
> changes weren't reflected. In that case, we'll have to reload acpid also.
> Good thing is that acpid already has a reload command in its init file
> which sends a HUP.
>
>
> Ritesh

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


--nextPart3671241.qXkyx8XLyz
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/34dc1cc7/attachment-0001.pgp 

--nextPart3671241.qXkyx8XLyz--


More information about the laptop-mode mailing list