Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
New Power Management Daemon: PowerMgr!
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Tue May 10, 2005 1:18 am    Post subject: New Power Management Daemon: PowerMgr! Reply with quote

UPDATE: version 0.0.10 now available!

Features:

  • Inputs:
  • ac adapter (acpi, omnibook)
  • battery (acpi, omnibook)
  • fan (acpi, dell, omnibook, toshiba)
  • lid (acpi)
  • temperature (acpi, dell, ibm, omnibook, hddtemp)
  • load average
  • running programs
  • Outputs:
  • brightness (asus, dpms, ibm, omnibook, toshiba)
  • cpu frequency/governor (kernel cpufreq, speedfreq)
  • fan (acpi, dell, ibm, toshiba)
  • laptop mode
  • wireless power management (standard, ipw2200)
  • runlevel
  • running services
  • execute command
  • write file


Dependencies:

  • Getopt-Mixed
  • any manufacturer-specific utility (e.g., i8kctl), if you want to use its features


Known issues:

  • Powermgr will dim your display after the lid is closed, and may take up to five seconds to brighten it again. This is because of a quirk in how the dimming is implemented, and will be fixed soon by adding a separate "display on" output.




I have created Yet Another Power Management Daemon (hey, I should have called it yapmd!) called PowerMgr. It is modeled on cpufreqd, where rules specify a set of input conditions and a profile to use when they are matched, and profiles specify a set of settings to apply. However, it encompasses a few more types of power management than cpufreqd, and I am adding more inputs and outputs as I go along.

The current list of supported power management features is shown above. If you have a piece of hardware you want supported, please tell me how to read the input or write the output you want. (For example, if you wanted me to support wireless power management [which I already do, but as an example], I would need to know that you need to run "iwconfig interface power on|off" to set it)

Get powermgr at http://powermgr.sourceforge.net/!

Thanks, and please feel free to reply or email (powermgr.thinkinginbinary@spamgourmet.org) with comments, suggestions, etc...


Last edited by ttuttle on Fri Jul 22, 2005 7:45 pm; edited 7 times in total
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Tue May 10, 2005 1:41 am    Post subject: Reply with quote

Moved from Kernel & Hardware.
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Fri May 13, 2005 4:21 pm    Post subject: Reply with quote

I've added support for switching based on load average and running processes, and support for starting/stopping services and changing runlevel. It also allows you to set the minimum and maximum CPU speed (useful for ondemand). If anyone's interested I will make a release, otherwise I'll just keep coding...
Back to top
View user's profile Send private message
quat
Guru
Guru


Joined: 18 Sep 2004
Posts: 316

PostPosted: Fri May 13, 2005 5:46 pm    Post subject: Re: New Power Management Daemon: PowerMgr! Reply with quote

ThinkingInBinary wrote:
I'm planning to add support for more inputs (cpu usage and/or load average, temperature [both thermal_zone and hddtemp], processes running (to prevent movie players and games from lagging),
I don't know how is it for you but for me these features are essential for such daemon. I'll wait until you implement it. then I can check it, test it, and report bugs :wink:

hth
_________________
a mind is like a parachute, it's better when it's open
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Sat May 14, 2005 4:51 pm    Post subject: Reply with quote

I have released a new version of powermgr, version 0.0.2!

It now supports many more inputs and outputs, including:

Inputs: ac adapter, battery charging, battery critical, battery percentage, battery time, temperature (ACPI), hard drive temperature, load average, and running programs
Outputs: asus brightness, cpu minimum/maximum frequency, cpu governor, wireless/ipw2200 power management, laptop mode, runlevel, services

You can get it here:

http://thinkinginbinary.dyndns.org/~tom/powermgr.html

Please take a look at it! It's improved a lot over the last week and I want to make this program really awesome and useful.
Back to top
View user's profile Send private message
quat
Guru
Guru


Joined: 18 Sep 2004
Posts: 316

PostPosted: Sat May 14, 2005 7:24 pm    Post subject: Reply with quote

ThinkingInBinary wrote:
You can get it here:

http://thinkinginbinary.dyndns.org/~tom/powermgr.html
where exactly ? there is no link on this page.
_________________
a mind is like a parachute, it's better when it's open
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Sat May 14, 2005 8:25 pm    Post subject: Reply with quote

i've always missed a feature in cpufreqd: the ability to run a shell command on a matching pattern/status... and eventually read the exit code (in bash/shell style)

will this be eventually possible to be implemented? would be very useful to me (i need to echo some values to proc)

thanks
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Sun May 15, 2005 3:33 am    Post subject: Reply with quote

quat wrote:

ThinkingInBinary wrote:

You can get it here:

http://thinkinginbinary.dyndns.org/~tom/powermgr.html

where exactly ? there is no link on this page.


Sorry, I got distracted and forgot to finish the page. (I was rewriting a better description and uploaded it half finished.)

FonderiaDigitale wrote:
i've always missed a feature in cpufreqd: the ability to run a shell command on a matching pattern/status... and eventually read the exit code (in bash/shell style)

will this be eventually possible to be implemented? would be very useful to me (i need to echo some values to proc)

thanks


I'm going to do this, but I'd rather know what you're echoing to what so I can add it as an output in its own right.

How would you get the return value back? If you need to act on the return value, you should write a script that my daemon will call, since that's getting a little complicated for the mechanism it uses. (Did you want to use the exit value of a command as an input to a rule?)
Back to top
View user's profile Send private message
michelle778
n00b
n00b


Joined: 19 Mar 2005
Posts: 73

PostPosted: Sun May 15, 2005 8:16 am    Post subject: Re: New Power Management Daemon: PowerMgr! Reply with quote

ThinkingInBinary wrote:
I have created Yet Another Power Management Daemon (hey, I should have called it yapmd!) called PowerMgr. It is modeled on cpufreqd, where rules specify a set of input conditions and a profile to use when they are matched, and profiles specify a set of settings to apply. However, it encompasses a few more types of power management than cpufreqd, and I am adding more inputs and outputs as I go along.

Hmm, why don't you implement your new ideas in cpufreqd or any other existing power managment daemon? There are already so many power managment deamons out there...
_________________
Nothing is easier than being busy - and nothing more difficult than being effective.
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Sun May 15, 2005 7:30 pm    Post subject: Re: New Power Management Daemon: PowerMgr! Reply with quote

michelle778 wrote:

ThinkingInBinary wrote:

I have created Yet Another Power Management Daemon (hey, I should have called it yapmd!) called PowerMgr. It is modeled on cpufreqd, where rules specify a set of input conditions and a profile to use when they are matched, and profiles specify a set of settings to apply. However, it encompasses a few more types of power management than cpufreqd, and I am adding more inputs and outputs as I go along.

Hmm, why don't you implement your new ideas in cpufreqd or any other existing power managment daemon? There are already so many power managment deamons out there...


There are a few reasons, some of which may be ungrounded. First, it was easier for me to write one for my needs than to modify someone else's. Second, it's not focused on cpu throttling, as (obviously, by the name) cpufreqd is. Third, it's written in Perl, and I'm much better at Perl than C. Fourth, it's (I think) more modular, allowing it to serve more purposes without rewriting code in other places. Modules can be added simply by installing one file in the inputs.d or outputs.d directory, and they will be loaded at startup.
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Sun May 15, 2005 9:01 pm    Post subject: Reply with quote

ThinkingInBinary wrote:

How would you get the return value back? If you need to act on the return value, you should write a script that my daemon will call, since that's getting a little complicated for the mechanism it uses. (Did you want to use the exit value of a command as an input to a rule?)


using it as input should be fine, anyway i need to use some custom script as an output (bash shell scripts), so i need the ability to launch them on a matching pattern.

The echo value i need is precisely the one to change the lcd brightness of the omnibook module, as /proc/omnibook/lcd (min 1 max 7)
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Mon May 16, 2005 10:22 am    Post subject: Reply with quote

FonderiaDigitale wrote:
ThinkingInBinary wrote:

How would you get the return value back? If you need to act on the return value, you should write a script that my daemon will call, since that's getting a little complicated for the mechanism it uses. (Did you want to use the exit value of a command as an input to a rule?)


using it as input should be fine, anyway i need to use some custom script as an output (bash shell scripts), so i need the ability to launch them on a matching pattern.

The echo value i need is precisely the one to change the lcd brightness of the omnibook module, as /proc/omnibook/lcd (min 1 max 7)


No no no no no no no! What you should do is say to me, "Thinking in Binary, can you add an output called 'omnibook brightness' that sets /proc/omnibook/lcd?" I would definitely rather add specific outputs than generic ones. I'll go add this now, along with an execute one and a file (writing, i.e. "file(/proc/omnibook/lcd) = 5") one.
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Mon May 16, 2005 10:54 am    Post subject: Reply with quote

RELEASE 0.0.3 IS UPON US!

No, it's not sprinkled with holy anything pee, but it now includes more inputs and outputs than ever before!

New in 0.0.3 are:

  • the ChangeLog ;-)
  • the "execute" output: for example "execute = halt" in critical.
  • the "file" output: for example "file(/proc/omnibook/brn) = 4" to dim display to 50%.
  • the "omnibook brightness" output: for example "omnibook brightness = 50%"
  • new way of specifying brightness (this breaks the old one; apologies to anyone who's actually using it ;-)): it is now a percentage which will be scaled to your laptop's range. For example, "asus brightness = 100%" will write "15" to /proc/acpi/asus/brn, but "omnibook brightness = 100%" will write "7" to /proc/omnibook/lcd.


As always, please suggest new features![/list]
Back to top
View user's profile Send private message
foxcub
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2002
Posts: 131
Location: North Carolina

PostPosted: Mon May 16, 2005 12:36 pm    Post subject: Reply with quote

ThinkingInBinary wrote:
No no no no no no no! What you should do is say to me, "Thinking in Binary, can you add an output called 'omnibook brightness' that sets /proc/omnibook/lcd?" I would definitely rather add specific outputs than generic ones.


But why? Why do you want to make it less generic, and so highly specialized? Flexible is always better.
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Mon May 16, 2005 2:23 pm    Post subject: Reply with quote

foxcub wrote:
ThinkingInBinary wrote:
No no no no no no no! What you should do is say to me, "Thinking in Binary, can you add an output called 'omnibook brightness' that sets /proc/omnibook/lcd?" I would definitely rather add specific outputs than generic ones.


But why? Why do you want to make it less generic, and so highly specialized? Flexible is always better.


I'd like to make is as flexible as possible but include as much built-in functionality as possible. I added file writing and command executing outputs, but I also want to make it possible to write "brightness = 50%" and have it work on many different kinds of laptop.

Did you try 0.0.3? Does it work?
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Tue May 17, 2005 1:02 am    Post subject: Reply with quote

mh. perhaps i've not made it clear.
i have a *VERY* custom script i need to launch when i go down on battery, it makes many things that you cannot add as a 'feature', such cleanly unmount remote nfs / crypted shares and stop vpns.

is that so wrong for you to add support to launch external commands? cannot understand why. really.
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Tue May 17, 2005 1:19 am    Post subject: Reply with quote

FonderiaDigitale wrote:
mh. perhaps i've not made it clear.
i have a *VERY* custom script i need to launch when i go down on battery, it makes many things that you cannot add as a 'feature', such cleanly unmount remote nfs / crypted shares and stop vpns.

is that so wrong for you to add support to launch external commands? cannot understand why. really.


No it's not wrong, and I am adding them. You can use "execute command = /home/user/script.sh". I didn't mean that I wouldn't allow it at all, I just meant that it's better for things like writing values to a file to be built in.
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Tue May 17, 2005 2:22 am    Post subject: Reply with quote

Ok thanks. i really appreciated :)
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Mon May 23, 2005 3:08 am    Post subject: Reply with quote

Okay, release 0.0.4 is out! You can get it here: webpage or .tar.bz2.[/url]

At FonderiaDigitale's request, there is now support for most of the features in /proc/omnibook. If anyone uses display blanking or multiple batteries, I will add these, but I didn't yet because he doesn't need them. Because the battery doesn't return a rate, the "charging rate" will be +1 for charging and -1 for discharging. This means the "battery charging" input still works, but the "battery time" input is misleading.

The "battery critical" input has been removed because it doesn't work with omnibook laptops and it is quite useless some of the time. For example, my laptop is convinced the battery is critically low when it has 10% left, but I can often get 30 minutes more power. The "critical" profile is now activated at 10% left instead. Feel free to tweak this if you like.

It now automatically detects which driver to use in cases where there are multiple ones. For example, "brightness = 50%" will be dispatched to the asus-brightness output if /proc/acpi/asus/brn exists, and to the omnibook-brightness output if /proc/omnibook/lcd exists, and so on... Currently this is used for ac adapter, battery, temperature, and brightness.

Things in the works include X idle input, DPMS support (console, vbetool, and/or X), network interface detection (so you don't have to specify "wireless power management(eth1)" unless you *only* want to change the setting for eth1), Xscreensaver support, power/sleep/hibernate support (maybe), APM support (please tell me nobody needs this--APM is *old*!), and the eventual world domination by ultra-flexible Centrino-laptop-wielding ninjas.

Enjoy, send me a note if it works (or if it doesn't), and tell your friends!
Back to top
View user's profile Send private message
ihtruelsen
Apprentice
Apprentice


Joined: 14 Mar 2003
Posts: 168
Location: Mill Bay, BC

PostPosted: Tue May 24, 2005 5:18 pm    Post subject: Reply with quote

Is this intended to, or is it capable of, replacing cpufreq? Can they both be used together or do they conflict?
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Tue May 24, 2005 10:24 pm    Post subject: Reply with quote

ihtruelsen wrote:
Is this intended to, or is it capable of, replacing cpufreq? Can they both be used together or do they conflict?


It can basically replace cpufreq. I'm not sure if it supports every single feature of cpufreq (notably it doesn't support cpu usage, but only load average) but it can perform the same task (changing cpu frequency based on system state) as well as others (display brightness, wireless card power management, laptop mode). However, it can't replace daemons like speedfreq that rapidly change the frequency based on CPU usage. For this you should use the ondemand governor in the kernel, or speedfreq (you can start it with the service output, and I might add a speedfreq policy output.)

So yes, it is a replacement for cpufreq (an improvement, since it has more functionality), but it will not conflict unless you tell it to change the cpu frequency.
Back to top
View user's profile Send private message
rmh3093
Advocate
Advocate


Joined: 06 Aug 2003
Posts: 2138
Location: Albany, NY

PostPosted: Wed May 25, 2005 12:12 am    Post subject: Reply with quote

r u planning on adding toshiba lcd support?
_________________
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.
Back to top
View user's profile Send private message
ttuttle
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2004
Posts: 131

PostPosted: Wed May 25, 2005 2:51 am    Post subject: Reply with quote

rmh3093 wrote:
r u planning on adding toshiba lcd support?


Yes, it is in the NEW version 0.0.5! You can get it here!

If it doesn't work, feel free to contact me (my contact info is in the README).
Back to top
View user's profile Send private message
JokerF15
n00b
n00b


Joined: 25 May 2005
Posts: 10

PostPosted: Thu May 26, 2005 9:34 pm    Post subject: Reply with quote

Just started using this couple days ago, fairly easy intall overall I like it. I was planning on using CPUFREQD but for some reason it gives me a segmentation fault.

Couple things:

How can i start this on boot? Also is it a 'true daemon' b/c when I run it it seems to hold up the eterm window. Doesn't a daemon run in the background and not as an active program?

-JokerF15
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Tue May 31, 2005 2:14 am    Post subject: Reply with quote

there is a new governor available: conservative. it acts the same as ondemand, but more graceful regarding to the battery.
any plan to support this?

regarding the init script, how about something like:
Code:
#!/sbin/runscript

depend() {
        use hotplug
        need logger
}


start() {
        ebegin "Starting powermgr"
        start-stop-daemon --start --quiet --pidfile /var/run/powermgr.pid --exec /usr/bin/powermgr >/var/log/powermgr.log 2>&1
        eend $?
}

stop() {
        ebegin "Stopping powermgr"
        start-stop-daemon --stop --quiet --pidfile /var/run/powermgr.pid
        eend $?
}

_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum