Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in

Issue 4853002: laptop-mode accepts lists of devices and modules (Closed)

8 years, 9 months ago by Simon Que
8 years, 3 months ago


laptop-mode accepts lists of devices and modules laptop-mode script now takes two more parameters, modules and devices. These specify which modules (scripts) to run, and which devices for which they should be run. If the modules parameter is not specified, all scripts will be run. Examples: $ ./laptop-mode modules="lcd-brightness usb-autosuspend" Runs lcd-brightness and usb-autosuspend $ ./laptop-mode modules="usb-autosuspend" devices="1-1 1-2 1-3" Runs usb-autosuspend for 1-1, 1-2, and 1-3. $ ./laptop-mode devices="/dev/sda /dev/sdb" Runs all modules for /dev/sda and /dev/sdb. CAUTION: this is not a realistic example as not all scripts necessarily operate on /dev/sd*. This example is meant only to demonstrate syntax. laptop-mode exports the device list as an environment variable, $DEVICES. Each module script can access this variable and use it. However, those that have not been modified will ignore it. The behavior when no devices are specified is dependent on the behavior of each script. Scripts that have not been modified to accept the device list will behave as they did before this patch. This patch gives usb-autosuspend the capability to run over selected devices. usb-autosuspend reads the $DEVICES list. If the list is not defined, usb-autosuspend will operate on all USB devices. As of this patch, usb-autosuspend is the only module that uses the device list. BUG=chromium-os:7912 TEST=Run with verbose messages enabled, passing in various combinations of module and device lists. Check output to verify. Signed-off-by: Simon Que <>; Change-Id: I579f1850fd7123c0617499ea73190fdf4121595f Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=8783183

Patch Set 1 #

Patch Set 2 : Added more comments, removed echo, added rule file #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -19 lines) Patch
A laptop-mode-tools_1.52/etc/rules/99-laptop-mode.rules View 1 chunk +1 line, -0 lines 0 comments Download
M laptop-mode-tools_1.52/usr/sbin/laptop_mode View 1 2 chunks +41 lines, -9 lines 0 comments Download
M laptop-mode-tools_1.52/usr/share/laptop-mode-tools/modules/usb-autosuspend View 5 chunks +21 lines, -10 lines 0 comments Download


Total messages: 4 (0 generated)
Simon Que
8 years, 9 months ago (2010-11-12 04:05:38 UTC) #1
Simon Que
8 years, 9 months ago (2010-11-12 23:50:01 UTC) #2
Benson Leung
On 2010/11/12 23:50:01, Simon Que wrote: LGTM.
8 years, 9 months ago (2010-11-13 00:10:22 UTC) #3
Sameer Nanda
8 years, 9 months ago (2010-11-13 00:29:53 UTC) #4
LGTM. Can you update the TEST description to indicate whether you've tested
these changes with plugging in external USB devices (like mouse/keyboard) before
checking in?

Powered by Google App Engine
This is Rietveld 408576698