OK. I think I got it to work. My quick workaround-howto follows. (Warning: it really is a quick workaround - this includes the possibility of multiple errors/omissions in my instructions, as I was recreating them after getting LMT to work).
(You need to have pm-utils and acpi-support installed). "Install" (fortunately, it's just copying over a few scripts, I suppose) LMT from http://samwel.tk/laptop_mode/packages/tarball (nb: this is a newer version than the one available in the reps; it has one quite noticeable improvement):
Code:
wget http://samwel.tk/laptop_mode/tools/downloads/laptop-mode-tools_1.55.tar.gz
tar xzf laptop-mode-tools_1.55.tar.gz
su
cd laptop-mode-tools_1.55.tar.gz
./install.sh
This allows you to issue "laptop_mode" as root and have LMT automatically detect the AC-state and behave appropriately. If you want to automate this process (which you probably should, as it used to be done automatically in 10.04 with the repo's LMT version and config), you can use my approach. It is redundant, as I find it quite crucial for LMT to always kick in automatically - even if some of the soft fails. You can remvoe redundancy (or shorten the 2nd timeout), thus risking exposure to conflicts/overwrites resulting from pm-utils'/acpi-support's doing equivalent job as LMT.
Code:
su
nano /etc/acpi/power.sh
add
Code:
/root/power.sh.4sec
/root/power.sh.70sec
directly after
save with CRTL O and exit with CTRL X
Code:
nano /etc/pm/sleep.d/10_lm
insert
Code:
#!/bin/sh
sleep 4 && /usr/sbin/laptop_mode auto force > /root/4_pm_log_lm_reload &
Code:
chmod +x /etc/pm/sleep.d/10_lm
nano /etc/pm/sleep.d/10_lm70
insert
Code:
#!/bin/sh
sleep 70 && /usr/sbin/laptop_mode auto force > /root/70_pm_log_lm_reload &
Code:
chmod +x /etc/pm/sleep.d/10_lm70
ln -s /etc/pm/sleep.d/10_lm70 /etc/pm/power.d/10_lm70
ln -s /etc/pm/sleep.d/10_lm /etc/pm/power.d/10_lm
nano /root/power.sh.4sec
insert
Code:
#!/bin/sh
sleep 4 && /usr/sbin/laptop_mode auto force > /root/s4h_power_log_lm_reload &
Code:
nano /root/power.sh.70sec
insert
Code:
#!/bin/sh
sleep 70 && /usr/sbin/laptop_mode auto force > /root/s70h_power_log_lm_reload &
Code:
chmod +x /root/power.sh.*
This will force a LMT reload every time the PC changes it's power state (AC/bat) or goes to sleep/resumes. There are to delays: the first one of 4 s and the second one of 70 s, as I experienced LMT's settings' being overwritten after the initial (4 s) reload. Both of them are being executed by both PM and acpid, so there's 2x2x redundancy. After some testing or restricting PM-utils, it probably could be reduced significantly.
Go ahead and customise as you please. The humble "log" files in /root/ along with their timestamps are good for debugging. Check status with "laptop_mode status" (or a shortened version, e. g. "laptop_mode status|head -n 28|tail -n 10").
Let's hope to see a serious solution enter the repos soon...
EDIT:
After testing my workaround for some time, I concluded that it is enough to use pm only (no need for power.sh in acpi, so you can comment out the two lines) and that the second timeout can safely be lowered to 16 s. I'm looking into rerunning "laptop_mode" when the battery's state becomes critical in order to disable data-sensitive features - atm, it doesn't do that automatically.
Bookmarks