4
# This script adjusts the USB bluetooth device settings via the USB
5
# power control. This simply sets this to "auto" for power saving and to "on"
6
# for non-power saving. This has been shown to save about 1W on some
9
# According to http://www.usb.org/developers/defined_class
10
# USB wireless bluetooth devices have baseclass 0xe0, subclass 0x01,
14
USB_BLUETOOTH_PM_ENABLE="${USB_BLUETOOTH_PM_ENABLE:-true}"
18
for dev in /sys/bus/usb/devices/* ; do
19
if [ -e $dev/bDeviceClass -a \
20
-e $dev/bDeviceSubClass -a \
21
-e $dev/bDeviceProtocol -a \
22
-e $dev/power/control ]; then
23
if [ x`cat $dev/bDeviceClass` = xe0 -a \
24
x`cat $dev/bDeviceSubClass` = x01 -a \
25
x`cat $dev/bDeviceProtocol` = x01 ]; then
26
echo Setting $dev to $1
27
echo $1 > $dev/power/control
34
true) # powersaving on
35
[ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "auto"
37
false) # powersaving off
38
[ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "on"