Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend

Issue 4853002: laptop-mode accepts lists of devices and modules (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/laptop-mode-tools.git
Patch Set: Added more comments, removed echo, added rule file Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « laptop-mode-tools_1.52/usr/sbin/laptop_mode ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « laptop-mode-tools_1.52/usr/sbin/laptop_mode ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698