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

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

Issue 3590005: laptop-mode-tools: USB autosuspend ignores user input devices (Closed) Base URL: http://git.chromium.org/git/laptop-mode-tools.git
Patch Set: Updated with second blacklist Created 10 years, 3 months 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/etc/laptop-mode/conf.d/usb-autosuspend.conf ('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 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
« no previous file with comments | « laptop-mode-tools_1.52/etc/laptop-mode/conf.d/usb-autosuspend.conf ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698