Hprofile

is a little application that can be used to manage multiple profiles be it hardware or software. The following subsection are just examples on what could be done with hprofile.

Preparation
{{File|/etc/hprofile/hprofile.initd.patch|| --- a/etc/init.d/hprofile	2014-07-19 20:14:14.608007022 +0000 +++ b/etc/init.d/hprofile	2014-07-19 20:09:14.482006076 +0000 @@ -8,20 +8,16 @@ } start { -	local vga=$(/usr/sbin/hpdet vga) -	local pwr=$(/usr/sbin/hpdet power) -	ebegin "Selecting hardware profile vga.$vga and pwr.$pwr" -	/usr/sbin/hprofile vga -	/usr/sbin/hprofile power +	profile=$(/usr/sbin/hpdet boot) +	ebegin "Selecting hardware profile ${profile}" +	/usr/sbin/hprofile boot eend $? } stop { -	local vga=$(/usr/sbin/hpdet vga) -	local pwr=$(/usr/sbin/hpdet power) -	ebegin "Selecting hardware profile vga.$vga and power.$pwr" -	/usr/sbin/hprofile vga -	/usr/sbin/hprofile power +	profile=$(/usr/sbin/hprofile -c boot) +	ebegin "Stopping hardware profile ${profile}" +	/usr/sbin/hprofile -s boot eend $? } }}

Power
When thinking about a better way to have dynamic power profiles that could be dynamically switched depending on hardware or software state is not straightforward especially for power management which could depend on many software e.g., , to name a few. So, how could you get hardware profiles and switch between them dynamically? And how to get everything together? How many deamons to start depending on what hardware or software state?

That sum up quite a few considerations to what a user can face when trying to build a nice setup with power management in mind. [S]he can remember of Windows(tm) power management profiles if [s]he ever used it. Or else, [s]he did not thought about it because [s]he used to run a GNU Linux or BSD based distribution with everything putted together and does not know how to begin with if [s]he is not satisfied with what [s]he gets.

Now -2 grew up to be quite a good piece of software. If you're runnng an Intel based platform, you can get access to pretty much everything one would expect if trying to build power profiles. But the package does not ship with a daemon-ish like software nor with a configuration or profile file which PowerTOP could pick up when launched in the next restart. One has to launch it again and again in a terminal and enable power management for every power manageable hardware... quite the redundant an manual way evertime the system boot up.

This basic profile will try to implement Disk, CPU (see External resources), network interfaces and ALSA drivers power saving capabilities.

One would need the following files to set up basic power management profiles.

I have a /etc/acpi/defaults.sh script that make use of those scripts, at least battery and AC Adapter. Those two power profiles are dynamically switched if AC power is un/plugged. See ACPI article for more info about the acpid default.sh script. It's not enough? Do you want more tunings? Expand the article then!

RFKill
This hardware profile subsection could be beneficial to the previous section, however software RF killing/switching can be quite troublesome which require cold reboot and removing battery/AC power for a few seconds to be able to get back usable wireless (Wifi/Bluetooth) interfaces again. This happen on my Intel GM45 based laptop. Luckily there is a physical switch to kill bluetooth and wifi radio.

There's no much consideration for this section, if your hardware support RFKill, add it to your hardware profile!

VGA
I use to manage VGA profile to my laptop and my desktop. On my desktop, I use hprofile to switch between nvidia-drivers, nouveau and nv when the previous profiles do no work; and to switch radeon and intel on my laptop which has switchable graphics via VGASwitcheroo. Now I have a new laptop with nVidia Optimus, VGASwitcheroo/PRIME does work quite bit avoiding to get a hot potato because that thing has a GT750M GPU! although I have to wait linux-3.16 and Mesa-10.3 to make any use of a GT750M and go through the black screen of death (right, BSOD(tm)).

Just be sure to built kernel modules about everything — at least i915, nouveau, radeon, ttm, drm, and optionally (?) ac, button, video, i2c-algo-bit — to avoid useless hassles and be able to boot with a single kernel be it with vesa/nvidia-drivers, or i915, or nouveau.

Create the necessaries folder and add the following files.

And with that, you should be able to switch vga profile as you like without needing an extra kernel and setup. Just close your X session and type hprofile vga.$profile ENTER.

The ptest script will just look if VGASwitcheroo (Intel HD Graphics/AMD ATI Radeon hybrid graphics) or PRIME (Intel HD Graphicss/nVidia Optimus) is available and which driver is loaded and then start the appropriate profile. One can black list modules and leave the other un-black listed to be able to chose ...a default VGA profile. Or else, use of file.

Hard disk
A disk profile is even straightforward because there fewer issue to keep in mind. So this section will be short and straightforward. Additionally, one need.

External resources

 * Power management/Processor - See that article for CPU power management insight.