[Pm-utils] [PATCH 1/4] Even simpler modularization of sleep methods.
Dan Nicholson
dbn.lists at gmail.com
Fri Feb 8 10:03:12 PST 2008
I had to look through this commit a couple times to see what exactly
was going on. It seems like you moved the pm-is-supported
functionality into check_* functions defined by the backends. That's
nice. It would be great if you could explain that a bit in the commit
message.
On Feb 7, 2008 8:33 PM, Victor Lowther <victor.lowther at gmail.com> wrote:
<snip>
> diff --git a/pm/module.d/Makefile.am b/pm/module.d/Makefile.am
> new file mode 100644
> index 0000000..8e861f3
> --- /dev/null
> +++ b/pm/module.d/Makefile.am
> @@ -0,0 +1,9 @@
> +moduledir = $(libdir)/pm-utils/module.d
> +
> +module_SCRIPTS = \
> + kernel
> +
> +EXTRA_DIST=$(module_SCRIPTS)
The scripts don't need to be in EXTRA_DIST since automake knows
they're needed for module_SCRIPTS.
> diff --git a/pm/module.d/kernel b/pm/module.d/kernel
> new file mode 100644
> index 0000000..c111490
> --- /dev/null
> +++ b/pm/module.d/kernel
> @@ -0,0 +1,28 @@
> +check_suspend() {
> + grep -q mem /sys/power/state; return $?
> +}
`grep -q' is a GNU grepism. Just redirect to stdout to /dev/null. We
do want to see stderr, though, to know if /sys/power/state doesn't
exist.
Also, the `return $?' is completely superfluous. The function will
just return the exit code of the last command, which is $?.
> +check_hibernate() {
> + [ -f /sys/power/disk ] && grep -q disk /sys/power/state
> + return $?
> +}
`grep -q' again. Do we want to grep for "$HIBERNATE_MODE" in
/sys/power/disk? Oh, I guess this is just a copy of what
pm-is-supported was doing.
--
Dan
More information about the Pm-utils
mailing list