Index: laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend |
diff --git a/laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend b/laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend |
index fdda281441fa068b3acf82a97287bf651cb782c1..03b950ffc8841f329dfcc079808100d970bea11a 100755 |
--- a/laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend |
+++ b/laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend |
@@ -17,6 +17,30 @@ blacklisted() { |
return 1 |
} |
+# Check whether the USB driver type is blacklisted |
+blacklisted_by_type() { |
+ device=$1 |
+ device_base=`basename $device` |
+ for driver_type in $AUTOSUSPEND_USBTYPE_BLACKLIST; do |
+ if grep -q DRIVER=$driver_type $device/uevent; then |
+ return 0 |
+ fi |
+ # Check child devices as well. The actual driver type is |
+ # listed in a child device, not the top-level device. |
+ for subdevice in $device/$device_base*; do |
+ if [ -f $subdevice/uevent ]; then |
+ if grep -q DRIVER=$driver_type\ |
+ $subdevice/uevent; then |
+ return 0 |
+ fi |
+ fi |
+ done |
+ done |
+ |
Benson Leung
2010/10/01 20:45:39
Delete empty line.
|
+ return 1 |
+} |
+ |
+ |
if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
if [ $ON_AC -eq 1 ]; then |
if [ "$ACTIVATE" -eq 1 ]; then |
@@ -40,6 +64,7 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
do |
usb_device=`basename $usb_device`; |
if ! blacklisted /sys/bus/usb/devices/$usb_device; then |
+ if ! blacklisted_by_type /sys/bus/usb/devices/$usb_device; then |
if [ -f /sys/bus/usb/devices/$usb_device/power/autosuspend ]; then |
echo $AUTOSUSPEND_TIMEOUT > /sys/bus/usb/devices/$usb_device/power/autosuspend; |
log "VERBOSE" "Enabling auto suspend mode for usb device $usb_device." |
@@ -53,6 +78,9 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
else |
log "VERBOSE" "Not enabling auto power level for usb device $usb_device" |
fi |
+ else |
+ log "VERBOSE" "Device $usb_device has blacklisted driver type, skipping auto suspend." |
+ fi |
else |
log "VERBOSE" "USB device $usbid is in the autosuspend blacklist." |
fi |