Package: laptop-mode-tools
Version: 1.45-1
Severity: wishlist
Tags: patch

USB Autosuspend mode is good for the hub and devices. These days USB is the way 
to go and most laptops come with 4 USB ports. When running on battery, they are 
useless and drawing a lot of power.

Powertop, when run on  a default Debian kernel/laptop-mode-tools, reports that 
USB autosuspend mode be enabled. I looked into powertop's usb.c implementation 
and am submitting a similar thing for laptop-mode-tools usb-autosuspend module.

This should help save some more power.


Ritesh

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-custom (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages laptop-mode-tools depends on:
ii  lsb-base                      3.2-20     Linux Standard Base 3.2 init scrip
ii  util-linux                    2.13.1.1-1 Miscellaneous system utilities

Versions of packages laptop-mode-tools recommends:
ii  acpid                         1.0.6-16   Utilities for using ACPI power man
ii  hal                           0.5.11-6   Hardware Abstraction Layer
ii  hdparm                        8.9-2      tune hard disk parameters for high
ii  sdparm                        1.02-1     Output and modify SCSI device para

laptop-mode-tools suggests no packages.

-- no debconf information
#
# Configuration file for Laptop Mode Tools module usb autosuspend.
#
# For more information, consult the laptop-mode.conf(8) manual page.
#


###############################################################################
# USB AutoSuspend power saving settings
# ---------------------------
#
# If you enable this setting, laptop mode tools will automatically set the
# USB Devices into Auto Suspend mode. USB Devices will get auto suspended, when
# running on battery, after a specified interval; the default being 2 seconds.
#
###############################################################################

# Control USB Auto Suspend?
CONTROL_USB_AUTOSUSPEND=1

#! /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 [ -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 [ -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

Reply via email to