[Pm-utils] pm-utils and pmu hardware.
Peter Jones
pjones at redhat.com
Tue May 2 10:20:31 PDT 2006
On Tue, 2006-05-02 at 11:51 +0200, Stefan Seyfried wrote:
> On Tue, May 02, 2006 at 10:31:43AM +0100, Richard Hughes wrote:
>
> > Why do we need to check if the pmu device works? It's early, and I've
> > been up for hours so go easy on me :-)
>
> Well, just open()ing it would probably suffice, but just checking
> for the existence of /dev/pmu ("test -c /dev/pmu"), might not, since
> there could still be people out there using static /dev.
I think that's not right. If we're on static /dev, then the dev package
should be providing /dev/pmu on appropriate machines. Likewise, if
you're on a dynamic /dev, udev or initscripts should be
creating /dev/pmu when appropriate.
So if we've got some small pmu shim program (I'll call it "pm-pmu"),
then the interface it presents to the shell should be that we call
"pm-pmu --suspend" or "pm-pmu --hibernate". If it's not the right thing
to do, it returns an error, else it returns success. Then our shell
code looks like:
pm-pmu --suspend || echo -n mem > /sys/power/state
And that's it, we're done. No invoking it twice, no checking to see if
the device is there before we run it. That stuff is great for a kernel
API, but it makes the shell script senselessly complicated. If we've
already got to have a C program to do this part, it should just do all
of it on those boxes where it's needed.
--
Peter
More information about the Pm-utils
mailing list