On a related note, I made some minor changes to /usr/sbin/laptop_mode a while back, to improve status reporting when running service laptop-mode status Attached patch
On Wed, Oct 17, 2012 at 2:31 PM, Jasmine Hassan <[email protected]> wrote: > On Wed, Oct 17, 2012 at 2:08 PM, Ritesh Raj Sarraf <[email protected]> > wrote: >> On Wednesday 17 October 2012 02:37 PM, Jasmine Hassan wrote: >>> though, from the logic you propose, yes. that's one way to go. I was >>> thinking even something like: >>> if [ "`cat /proc/sys/vm/laptop_mode`" = "$LM_SECONDS_BEFORE_SYNC" ] ... >>> for laptop-mode status >> No. That won't help. It is not just about setting the kernel knob. We do >> a lot more than that. > > Of course. It's just that: > set_sysctl /proc/sys/vm/laptop_mode 0 > is hardcoded in /usr/share/laptop-mode-tools/modules/laptop-mode , > when deactivating. > > So if I do `service start laptop-mode`m edit config file to disable > LMT, I can still do `service stop laptop-mode` without it enabled. > > As it stands: > /usr/sbin/laptop_mode > > # If the init script has not been run or has been run with the "stop" > # argument, then we should never start laptop mode. > if [ ! -f /var/run/laptop-mode-tools/enabled ] ; then > log "VERBOSE" "Laptop mode disabled because > /var/run/laptop-mode-tools/enabled is missing." > STATE=disabled > fi > ... > if [ "$STATE" = "disabled" ] ; then > ACTIVATE=0 > fi > ... > if [ "$ACTIVATE" -eq 0 ] ; then > ACTIVATE_WITH_POSSIBLE_DATA_LOSS=0 > ... > # WAS_ACTIVE is used later on. If there is no > /var/run/laptop-mode-tools/state, then > # we know that laptop mode wasn't active before. > WAS_ACTIVE=0 > ... > > > I fail to see how it would be stopped, when service was started but > user disabled in config. > It's been a while since I looked at /usr/sbin/laptop_mode :) > >> >> >> -- >> Ritesh Raj Sarraf >> RESEARCHUT - http://www.researchut.com >> "Necessity is the mother of invention." >> >>
status_fix.patch
Description: Binary data

