You are not logged in.

#1 2013-01-28 20:01:01

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

Certain questions towards powersaving

Hello everyone,

I'm working on my powersave script (https://github.com/Unia/powersave) and I've come across some points I would like more information about. For now, it's just two small questions I couldn't find the answer to but it might get more in the future.

1. Is it considered 'clean' to use shell commands in a udev rule? I would like to have a rule that sets my screen brightness to low or high depending on if I'm on AC or not. So far the only way I can think of to do this is by echo'ing the brightness value into a /sys/class/backlight/acpi_video0/brightness, which would require me to use RUN+="/bin/sh -c 'command'". Is that considered 'clean'?
2. What exactly does iw's power_save option do? Or well, what I am most interested in; does it come at the cost of performance? I can not seem to find the answer anywhere. The logical answer to me would be "duh, powersave means drop in performance", but I would like to get this confirmed.

For now that's it, but more might be added later. Thanks in advance!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#2 2013-01-29 07:49:19

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,246

Re: Certain questions towards powersaving

For your question 1. The acpid is just for that kind of things. Install acpid and put your commands in /etc/acpi/handler.sh (the file is well documented). Be careful that system react by default to some acpi events (but not battery events). So check /etc/systemd/logind.conf and make sure acpi events are handled either by systemd or acpid but not both. By the way I do not think that udev react to such events, so I do not think writing an udev rule will work at all.

For your question 2. By iw, you mean the wireless tools? I do not know the answer to your question, I have never seen any clear explanation for that apart from the occasional (it causes problems, so disable it). I suppose it stops the card when not in use. I have never seen a real difference in power consumption, though.

Offline

#3 2013-01-29 10:38:58

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

Re: Certain questions towards powersaving

olive wrote:

For your question 1. The acpid is just for that kind of things. Install acpid and put your commands in /etc/acpi/handler.sh (the file is well documented). Be careful that system react by default to some acpi events (but not battery events). So check /etc/systemd/logind.conf and make sure acpi events are handled either by systemd or acpid but not both. By the way I do not think that udev react to such events, so I do not think writing an udev rule will work at all.

I do not want to use acpid, because alot of what it does it already handled by systemd. I already have a perfectly working powersaving script, I am only interested in "porting" it to udev rules, as I think that's a cleaner way of handling things. Udev does react to changes in power.

olive wrote:

For your question 2. By iw, you mean the wireless tools? I do not know the answer to your question, I have never seen any clear explanation for that apart from the occasional (it causes problems, so disable it). I suppose it stops the card when not in use. I have never seen a real difference in power consumption, though.

It seems iw isn't documented that well, eh? Too bad, I'm really curious to see what's going on when it changes power states. I just want to know, because if it doesn't hurt performance I don't have to make it switch back to normal when I'm on AC and I can save more power in general.

Thanks for your reply.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB