You are not logged in.

#26 2012-09-08 07:31:59

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [SOLVED] How to read whether laptop is on AC or battery?

I'm really happy it helped you wink
Well, regarding upower, pm-utils and the power-manager (i'm using xfce but i guess it's the same)... well i just get rid of them, then compiled xfce4-session without upower (and consolekit, but it does not regard your problem).
Then i created the application launchers in my xfce4-panel, with systemctl hibernate / poweroff / reboot.
But i know in gnome3 it is hard to add launchers to the panel (i really don't know how to achieve this, but i *hope* there is a way of doing it), so you will probably stick with pm-utils and upower.
You can prevent upower from doing anything by changing "RunPowersaveCommands=true" in "false", in /etc/UPower/UPower.conf. So upower won't call pm-powersave, and again, upower will hibernate/suspend/reboot/poweroff using systemd commands.
Practically, pm-utils is there, but it's doing nothing. Your DE needs it (even if i can't understand why, since upower does not call pm-utils...).

Offline

#27 2012-09-08 21:42:41

bwat47
Member
Registered: 2009-10-07
Posts: 638

Re: [SOLVED] How to read whether laptop is on AC or battery?

Yeah I now have pm-powersave disabled in upower.conf, I previously just had all the pm-powersave scripts masked but this does seem cleaner smile.

I have my own theory about why upower still seems to need pm-utils after doing some testing: upower still uses the pm-utils "pm-is-supported" function to determine if the machine supports suspend to ram, so if pm-utils is not present it just gives you an error saying it is not supported

So I guess I'll pm-utils around for that, maybe someday I can get rid of it smile Sometimes things like this make me wish I was only running a WM, probably could have gotten rid of consolekit and pm-utils by now.

Last edited by bwat47 (2012-09-09 15:25:25)

Offline

#28 2012-09-09 08:32:17

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [SOLVED] How to read whether laptop is on AC or battery?

Yes, you're probably right about pm-is-supported...hope this will change in the near future!
Remember that every update /etc/UPower/UPower.conf it's replaced(no .pacnew)  so you'll have to make again that fix.
I think pm-utils will die soon, just like ck...let's see! smile

Offline

#29 2012-09-19 07:08:04

bwat47
Member
Registered: 2009-10-07
Posts: 638

Re: [SOLVED] How to read whether laptop is on AC or battery?

65kid wrote:
nierro wrote:

...he told me that powersave script aren't so useful, because what it's good on battery is also good on ac...

I have always been skeptical regarding all these powersave scripts. Shouldn't the kernel know best about the settings? Are all these settings actually useful? Do they actually save power? Especially the cpufreq powersave governor: I read somewhere (don't have a source, sorry) that it does't actually save power. The ondemand governor may increase the frequency on load, but therefore the cpu is also done faster with the job and can idle longer. So all in all, it doesn't really make sense to use anything other than ondemand.

I'm not saying that these power saving scripts are completely useless - I don't know that. But I would love to see some comparions on how much effect all these settings actually have.

I know I haven't actually helped here, but I wanted to get his off my mind, sorry.... wink

You may be thinking of sched-powersave which was buggy and didn't really do anything (and was actually removed in kernel 3.5), this script didn't include that setting anyway, it only set the governor. But setting the governor is also no longer necessary, I've removed that section from the script on my pc. Since kernel 3.4 ondemand is already the default governor, so there is no need to set it, unless you need to set it to something other than ondemand. I've simplified the script a bit for my machine:

http://pastie.org/4752076

I removed the cpupower setting (handled automatically by kernel)

Removed iwconfig setting and replaced it with iw (iwconfig/wireless_tools is deprecated afiak)

Removed USB autosuspend settings (Tested on my system and the kernel seems to do some of this automatically now and I only needed the "for i in /sys/bus/*/devices/*/power/control; do echo auto > $i; done" command to enable runtime-pm for all my devices as well as usb autosuspend, confirmed by powertop and cat: http://i.imgur.com/Yco7c.png, http://i.imgur.com/8rAdA.png)

Tweaked intel audio powersave settings to enable powersave on both ac and battery due to known bug where toggling intel audio powersave on and off causes a bug where all audio codecs run at 100% as if power saving were disabled, even on battery. So instead of disabling it, I just increase the timeout to 5 minutes which significantly reduces any popping/clicking sounds.

Tweaked vm_writeback settings to be more conservative (personal preference)

Removed ASPM powersave (since ASPM is totally borked on my system, even if its forced sad )

Removed brightness settings (Since gnome does it for me)

Tweaked hdparm settings on battery to personal preference, removed -a setting since it didn't seem to make much of a difference in my testing.

As always, this type of thing really depends on your system and preferences, mileage may very. Thats why I love this solution, its very easy to tailor the script to your system. You can always try testing with powertop to see if it makes any difference. The script saves a few watts for me.

EDIT: Tweaked it again: Changed the device-pm command to only apply to non-usb devices: for dpcontrol in /sys/bus/{pci,spi,i2c}/devices/*/power/control; do echo auto > $dpcontrol; done

(Because my system has a bug where I need to unload the usb kernel modules before suspend, or else it hangs, I do this with a systemd-sleep hook. The downside is if I mess with the usb-pm settings in this script it conflicts a bit with my systemd-sleep hook causing values to be inconstantly set if I enable it on battery and then disable it on ac. It seems the kernel now enables usb autosuspend by default anyway) Also disabled intel controller pm because its buggy on my system, and I just disabled nmi watchdog at the kernel since I don't really ever need it.

http://pastie.org/4756651

Last edited by bwat47 (2012-09-19 23:58:03)

Offline

#30 2012-09-19 08:20:31

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [SOLVED] How to read whether laptop is on AC or battery?

Thanks for all this informations.
I guess you should talk about them here: https://bbs.archlinux.org/viewtopic.php … 5#p1163275. May be this can be helpful for that project. smile
Again, thanks for your time!

Offline

#31 2012-09-19 10:42:57

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [SOLVED] How to read whether laptop is on AC or battery?

bwat47 wrote:

As always, this type of thing really depends on your system and preferences, mileage may very. Thats why I love this solution, its very easy to tailor the script to your system. You can always try testing with powertop to see if it makes any difference. The script saves a few watts for me.

Glad I could be of assistance and/or inspiration wink I have placed your iw wireless option in the script.


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