summaryrefslogtreecommitdiff
path: root/tools/linux/hal-system-power-set-power-save-linux
blob: 38fccaa20bff926c3582c211b2e18b91865f06a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

value=$1

unsupported() {
	echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
	echo No powersave method found >&2
	exit 1
}

# We only support pm-utils
if [ -x "/usr/sbin/pm-powersave" ] ; then
	if [ $value = "true" ]; then
		/usr/sbin/pm-powersave true
		RET=$?
	elif [ $value = "false" ]; then
		/usr/sbin/pm-powersave false
		RET=$?
	fi

else
	# cannot set proc stuff here, so error out
	unsupported
	fi 

exit $RET