From: | "Samuli Suominen (ssuominen)" <ssuominen@g.o> |
---|---|
To: | gentoo-commits@l.g.o |
Subject: | [gentoo-commits] gentoo-x86 commit in sys-power/pm-utils/files/power.d: usb_bluetooth pci_devices |
Date: | Wed, 04 Jun 2014 20:46:52 |
Message-Id: | 20140604204646.DAC892004F@flycatcher.gentoo.org |
1 | ssuominen 14/06/04 20:46:46 |
2 | |
3 | Added: usb_bluetooth pci_devices |
4 | Log: |
5 | Selectively synchronize only bug fixes with Debian patchset version 1.4.1-14. |
6 | |
7 | (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 4868F14D) |
8 | |
9 | Revision Changes Path |
10 | 1.1 sys-power/pm-utils/files/power.d/usb_bluetooth |
11 | |
12 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/pm-utils/files/power.d/usb_bluetooth?rev=1.1&view=markup |
13 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/pm-utils/files/power.d/usb_bluetooth?rev=1.1&content-type=text/plain |
14 | |
15 | Index: usb_bluetooth |
16 | =================================================================== |
17 | #!/bin/sh |
18 | |
19 | # |
20 | # This script adjusts the USB bluetooth device settings via the USB |
21 | # power control. This simply sets this to "auto" for power saving and to "on" |
22 | # for non-power saving. This has been shown to save about 1W on some |
23 | # systems. |
24 | # |
25 | # According to http://www.usb.org/developers/defined_class |
26 | # USB wireless bluetooth devices have baseclass 0xe0, subclass 0x01, |
27 | # protocol 0x01 |
28 | # |
29 | |
30 | USB_BLUETOOTH_PM_ENABLE="${USB_BLUETOOTH_PM_ENABLE:-true}" |
31 | |
32 | set_usb_bluetooth() |
33 | { |
34 | for dev in /sys/bus/usb/devices/* ; do |
35 | if [ -e $dev/bDeviceClass -a \ |
36 | -e $dev/bDeviceSubClass -a \ |
37 | -e $dev/bDeviceProtocol -a \ |
38 | -e $dev/power/control ]; then |
39 | if [ x`cat $dev/bDeviceClass` = xe0 -a \ |
40 | x`cat $dev/bDeviceSubClass` = x01 -a \ |
41 | x`cat $dev/bDeviceProtocol` = x01 ]; then |
42 | echo Setting $dev to $1 |
43 | echo $1 > $dev/power/control |
44 | fi |
45 | fi |
46 | done |
47 | } |
48 | |
49 | case "$1" in |
50 | true) # powersaving on |
51 | [ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "auto" |
52 | ;; |
53 | false) # powersaving off |
54 | [ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "on" |
55 | ;; |
56 | *) |
57 | exit 254 |
58 | ;; |
59 | esac |
60 | |
61 | exit 0 |
62 | |
63 | |
64 | |
65 | 1.1 sys-power/pm-utils/files/power.d/pci_devices |
66 | |
67 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/pm-utils/files/power.d/pci_devices?rev=1.1&view=markup |
68 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/pm-utils/files/power.d/pci_devices?rev=1.1&content-type=text/plain |
69 | |
70 | Index: pci_devices |
71 | =================================================================== |
72 | #!/bin/sh |
73 | |
74 | # |
75 | # This script adjusts the power control of a set of PCI devices that |
76 | # prove beneficial to enable power savings |
77 | # |
78 | |
79 | PCI_DEVICES_PM_ENABLE="${PCI_DEVICES_PM_ENABLE:-true}" |
80 | |
81 | set_pci_device() |
82 | { |
83 | for dev in /sys/bus/pci/devices/* ; do |
84 | if [ -e $dev/class -a -e $dev/power/control ]; then |
85 | id=`basename $dev` |
86 | case `cat $dev/class` in |
87 | 0x020000) # ethernet |
88 | echo "Setting Ethernet device $id to $1" |
89 | echo $1 > $dev/power/control |
90 | ;; |
91 | 0x028000) # wireless |
92 | echo "Setting Wireless device $id to $1" |
93 | echo $1 > $dev/power/control |
94 | ;; |
95 | 0x040300) # audio |
96 | echo "Setting Audio device $id to $1" |
97 | echo $1 > $dev/power/control |
98 | ;; |
99 | 0x060000) # host bridge |
100 | echo "Setting Host Bridge $id to $1" |
101 | echo $1 > $dev/power/control |
102 | ;; |
103 | 0x080500) # SD card reader |
104 | echo "Setting SD card reader device $id to $1" |
105 | echo $1 > $dev/power/control |
106 | ;; |
107 | 0x088000|0x088001) # card reader |
108 | echo "Setting card reader device $id to $1" |
109 | echo $1 > $dev/power/control |
110 | ;; |
111 | 0x0c0000|0x0c0010) # firewire |
112 | echo "Setting FireWire device $id to $1" |
113 | echo $1 > $dev/power/control |
114 | ;; |
115 | esac |
116 | fi |
117 | done |
118 | } |
119 | |
120 | case "$1" in |
121 | true) # powersaving on |
122 | [ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "auto" |
123 | ;; |
124 | false) # powersaving off |
125 | [ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "on" |
126 | ;; |
127 | *) |
128 | exit 254 |
129 | ;; |
130 | esac |
131 | |
132 | exit 0 |