You are not logged in.

#1 2009-01-08 21:53:25

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

laptop-mode-tools fixes and improvements

I have been in contact with the autor of laptop-mode-tools and new version is coming some time next month or maybe even in March. So I decided to share my tweaks because some things are broken right now and some need improvements.

There are some modules I don't use and so didn't notice any problems with them, if there are any (lcd-brightness, video-out and those for which I don't have suitable hardware like cpufreq, iwl/ipw and sched-mc).

Alright then, first is the problem with systems where the battery doesn't report events and has no alarm support on which the auto-hibernate module depends. There is a script from gentoo-wiki which is quite popular among people with lousy batteries. It would be great if the package manager would take care of it for us. Author of laptop-mode-tools also said (on debian lists) that such script could be included in future versions, for now the common "solution" is to create a cronjob that calls /usr/sbin/laptop_mode every few minutes. I don't quite like it compared to the gentoo script. For now I include the script in the package as /usr/sbin/battery_mode and call it from rc.local on boot.

Currently there is a module called ac97-powersave that controls power management on those sound cards. Intel HDA sound cards also support this and in the future versions a module them will probably be included. For now I patch the ac97-powersave module to include the support for Intel HDA.

Bluetooth module removes bluetooth and hci_usb modules when disabling the device. However on my system it's not enough to completly turn it off. For now I patch the bluetooth module to include rfkill support. Only then the system reports a USB disconnect and the LED goes off. The default path in the patch is for my acer system with acer-wmi rfkill support.

Due to w differences the dpms-standby module is broken on many systems. The module uses xset and arguments are piped from the command w -hs where the third field is supposed to be DPMS_SCREEN but it's actually IDLE time, so xset command fails because the argument passed to xset -d is something like 4:54. On Debian/Ubuntu they went around this by including this in their acpi-support package. I didn't bother to see what they actually did, to backport it. It should be done in future laptop-mode-tools anyway. For now I just hardcode the display value for my single-user/one-X-screen system in the dpms-standby module.

Due to a simple mistake LM_VERBOSE was broken. Meaning that none of those informative status messages from laptop-mode-tools were logged when VERBOSE LOGGING was enabled. Only the output of called commands was logged. For now I fix this in the build process.

Speaking of logging, default output for verbose is /dev/stdout, and I would like to log everything to a file. So I modify it in the build process to log everything to /var/log/laptop-mode.log, and also include a logrotate script in the package. With the above fix I have a complete and informative log file.

It's not a bad idea to stop/restart laptop-mode-tools when suspending, so a pm-utils hook is helpful. Arch PKGBUILD already includes installing pm-utils support but it's actually pbbuttonsd/pmud support and not pm-utils. Such a script/hook could one day be included in laptop-mode-tools however there is/was a debate going if it's their job to provide it. I read somewhere that Ubuntu already provides such script/hook but I'm not sure if it's provided by acpi-support or laptop-mode-tools package. For now I wrote my own pm-utils hook and I include it in the build process.

Powertop suggests usbcore.autosuspend=1 sysctl, but it would be nice if we have all this power management control in one place. Usb-autosuspend module will be included in future versions of laptop-mode-tools, but for now someone wrote a module and posted it to the Debian bug tracker. I keep the module and configuration in my build dir but don't include it in the final package for now. I'll wait a bit and see how things will develop.


To help you start hacking on laptop-mode-tools you can take a look at all the above patches and my PKGBUILD. Every step is documented in PKGBUILD comments, and please do check them because some things I patch but some I modify inline with sed. I also don't install acpid handlers and before mentioned false pm-utils support... everything is commented: http://sysphere.org/~anrxc/local/softwa … ode-tools/


You need to install an RTFM interface.

Offline

#2 2010-03-07 21:31:00

ammon
Member
Registered: 2008-12-11
Posts: 413

Re: laptop-mode-tools fixes and improvements

Why dont you post pklbuild to AUR?

Offline

#3 2010-03-07 22:25:12

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: laptop-mode-tools fixes and improvements

Hello,
this was one year ago, and I helped the author improve these things. Today I don't have to patch my laptop-mode-tools... (I still do with some minor things, but that's just to satisfy some personal preferences smile. Use the arch package, even the battery polling helper is included.


You need to install an RTFM interface.

Offline

#4 2010-03-07 22:27:38

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,400
Website

Re: laptop-mode-tools fixes and improvements

anrxc wrote:

this was one year ago

Exactly.... http://wiki.archlinux.org/index.php/For … Bumping.27

Closing.

Offline

Board footer

Powered by FluxBB