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.
$ ./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.
TEST=Run with verbose messages enabled, passing in various combinations of
module and device lists. Check output to verify.
Signed-off-by: Simon Que <firstname.lastname@example.org>
Review URL: http://codereview.chromium.org/4853002
3 files changed