Sophie

Sophie

distrib > Mandriva > 2011.0 > x86_64 > media > contrib-testing > by-pkgid > e7ef83d9508d0c83cf369fd3130aba85 > files > 6

samsung-tools-1.5-1.x86_64.rpm

#!/bin/bash

# Enable Devices Power Management.

DPM=${DPM:-true}

help() {
cat <<EOF
--------
$0: Devices Power Management.

This hook has 1 tuneable parameter. 
DPM = controls whether we will try to save power on battery.
Defaults to true.

EOF
}

dpm() {
	[ "$DPM" = "true" ] || exit $NA
	if [ "$1" = "auto" ]; then
		printf "Enabling Devices Power Management... "
	else
		printf "Disabling Devices Power Management... "
	fi
	for i in /sys/bus/{pci,spi,i2c}/devices/*/power/control; do
		[ -w $i ] || continue
		echo "$1" > $i
	done
	echo Done.
	
}

case $1 in
    true) dpm auto ;;
    false) dpm on ;;
    help) help;;
    *) exit $NA
esac

exit 0