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 c82a8ed0df4763dc53313445892055ffb549a3d7..c9e521cf0bd87dff0f38b7697d10fb405a4520c9 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 |
@@ -50,6 +50,23 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
SUSPEND_USB_DEVICES="$BATT_SUSPEND_USB" |
fi |
+ if [ -d /sys/bus/usb/devices ]; then |
+ if [ "$DEVICES" != "" ]; then |
+ # If a list of devices has been provided, operate on only the |
+ # listed USB devices. |
+ DEVICE_LIST="" |
+ for DEVICE in $DEVICES; do |
+ DEVICE_LIST="$DEVICE_LIST $DEVICE" |
+ done |
+ else |
+ # If no list was provided, operate on all USB devices |
+ DEVICE_LIST=/sys/bus/usb/devices/* |
+ fi |
+ else |
+ # This will rarely happen. |
+ log "VERBOSE" "There are no USB devices." |
+ fi |
+ |
if [ x$SUSPEND_USB_DEVICES = x1 ]; then |
if [ -f /sys/module/usbcore/parameters/autosuspend ]; then |
echo $AUTOSUSPEND_TIMEOUT > /sys/module/usbcore/parameters/autosuspend |
@@ -57,8 +74,8 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
else |
log "VERBOSE" "Not enabling autosuspend mode for USBCORE Controller. Not Supported" |
fi |
- if [ -d /sys/bus/usb/devices ]; then |
- for usb_device in /sys/bus/usb/devices/*; |
+ if [ "$DEVICE_LIST" != "" ]; then |
+ for usb_device in $DEVICE_LIST; |
do |
usb_device=`basename $usb_device`; |
if ! blacklisted /sys/bus/usb/devices/$usb_device; then |
@@ -83,9 +100,6 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
log "VERBOSE" "USB device $usbid is in the autosuspend blacklist." |
fi |
done |
- else |
- # This will rarely happen. |
- log "VERBOSE" "There are no USB devices." |
fi |
else |
AUTOSUSPEND_TIMEOUT=0 |
@@ -95,8 +109,8 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
else |
log "VERBOSE" "Not disabling autosuspend mode for USBCORE Controller. Not Supported" |
fi |
- if [ -d /sys/bus/usb/devices ]; then |
- for usb_device in /sys/bus/usb/devices/*; |
+ if [ "$DEVICE_LIST" != "" ]; then |
+ for usb_device in $DEVICE_LIST; |
do |
usb_device=`basename $usb_device`; |
if [ -f /sys/bus/usb/devices/$usb_device/power/autosuspend ]; then |
@@ -113,9 +127,6 @@ if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then |
log "VERBOSE" "Not enabling ON power level for usb device $usb_device" |
fi |
done |
- else |
- # This will rarely happen. |
- log "VERBOSE" "There are no USB devices." |
fi |
fi |
else |