blob: c06b706d82a7bd52044031ec0dc1f061ebbe655b (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/sh
#
# This script adjusts the power control of a set of PCI devices that
# prove beneficial to enable power savings
#
PCI_DEVICES_PM_ENABLE="${PCI_DEVICES_PM_ENABLE:-true}"
set_pci_device()
{
for dev in /sys/bus/pci/devices/* ; do
if [ -e $dev/class -a -e $dev/power/control ]; then
id=`basename $dev`
case `cat $dev/class` in
0x020000) # ethernet
echo "Setting Ethernet device $id to $1"
echo $1 > $dev/power/control
;;
0x028000) # wireless
echo "Setting Wireless device $id to $1"
echo $1 > $dev/power/control
;;
0x040300) # audio
echo "Setting Audio device $id to $1"
echo $1 > $dev/power/control
;;
0x060000) # host bridge
echo "Setting Host Bridge $id to $1"
echo $1 > $dev/power/control
;;
0x080500) # SD card reader
echo "Setting SD card reader device $id to $1"
echo $1 > $dev/power/control
;;
0x088000|0x088001) # card reader
echo "Setting card reader device $id to $1"
echo $1 > $dev/power/control
;;
0x0c0000|0x0c0010) # firewire
echo "Setting FireWire device $id to $1"
echo $1 > $dev/power/control
;;
esac
fi
done
}
case "$1" in
true) # powersaving on
[ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "auto"
;;
false) # powersaving off
[ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "on"
;;
*)
exit 254
;;
esac
exit 0
|