#! /bin/sh # # Laptop mode tools module: USB Auto Suspend power saving mode. # if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] ; then if [ $ON_AC -eq 1 ]; then if [ -f /sys/module/usbcore/parameters/autosuspend ]; then echo 2 > /sys/module/usbcore/parameters/autosuspend $LM_VERBOSE && echo "Disabling auto suspend mode for new USB devices." fi if [ -d /sys/bus/usb/devices ]; then for usb_device in /sys/bus/usb/devices/*; do usb_device=`basename $usb_device`; if [ -f /sys/bus/usb/devices/$usb_device/power/autosuspend ]; then echo 2 > /sys/bus/usb/devices/$usb_device/power/autosuspend; $LM_VERBOSE && echo "Disabling auto suspend mode for usb device $usb_device." >> $OUTPUT fi if [ -f /sys/bus/usb/devices/$usb_device/power/level ]; then echo "auto" > /sys/bus/usb/devices/$usb_device/power/level; $LM_VERBOSE && echo "Setting auto power level for usb device $usb_device." >> $OUTPUT fi done else #This will rarely happen. $LM_VERBOSE && echo "There are no USB devices." >> $OUTPUT fi else if [ -f /sys/module/usbcore/parameters/autosuspend ]; then echo 0 > /sys/module/usbcore/parameters/autosuspend $LM_VERBOSE && echo "Enabling auto suspend mode for new USB devices." fi if [ -d /sys/bus/usb/devices ]; then for usb_device in /sys/bus/usb/devices/*; do usb_device=`basename $usb_device`; if [ -f /sys/bus/usb/devices/$usb_device/power/autosuspend ]; then echo 0 > /sys/bus/usb/devices/$usb_device/power/autosuspend; $LM_VERBOSE && echo "Enabling auto suspend mode for usb device $usb_device." >> $OUTPUT fi if [ -f /sys/bus/usb/devices/$usb_device/power/level ]; then echo "auto" > /sys/bus/usb/devices/$usb_device/power/level; $LM_VERBOSE && echo "Enabling auto power level for usb device $usb_device." >> $OUTPUT fi done else #This will rarely happen. $LM_VERBOSE && echo "There are no USB devices." >> $OUTPUT fi fi else $LM_VERBOSE && echo "USB auto suspend is disabled." >> $OUTPUT fi