Re: 2.6: drivers/input/power.c is never built

Vojtech Pavlik
2005-02-18T20:39:52Z

On Fri, Feb 18, 2005 at 09:24:43PM +0100, Pavel Machek wrote:
> Hi!
>
> > > > > But input layer shoudl not be used as a generic transport. I mean
> > > > > battery low, docking requests, etc has nothing to do with input.
> > > >
> > > > Well, plugging in a power cord is a physical user action much like
> > > > closing the lid is, much like pressing the power button is, much like
> > > > pressing a key is.
> > >
> > > What about power dying and my UPS switing on? I think it is out of
> > > input layer,
> >
> > Yes, I was thinking about this, too. An UPS is pretty much the same
> > thing to a desktop as a battery is to a notebook. And I also got to the
> > conclusion that this is a bad idea.
>
> Well, I'm not sure if input layer is suitable for batteries... Modern
> battery has quite a lot of parameters. It can tell you current
> voltage, current capacity (either mAh or mWh), design capacity, last
> capacity at full charge, current current, battery's estimate of run
> time (which may be better than system's estimate), ... But some
> batteries only know percentage of energy left, and some batteries only
> know current voltage (you can estimate %left from that). I'm not sure
> if input system can handle all that complexity...

I wouldn't want to pass all the battery info (UPSes can be even more
complex, able to switch on/off individual sockets, etc) through input,
just the basic events:

AC power on/off
battery full/normal/low/critical/(fail)

Then the other power-related events

Lid open/closed
Power button
Sleep button

I think that's all you need to trigger actions. You don't need the exact
percentage of the battery, and you don't need the exact AC voltage at
input.

Nice graphics battery monitors in X can gather their information from
the platform specific sources, since they'll need it all in the greatest
detail.

PS.

full = not charging
normal = OK state, charging if AC
low = better shutdown if you don't want to stress the battery
(namely LiIon batteries prefer not to be discharged too much)
critical = last chance to shutdown cleanly
fail = battery present, but doesn't work.

A server, while booting should wait for battery going at least to 'low'
before mounting system read/write, otherwise subsequent power failures
might cause damage.

--
Vojtech Pavlik
SuSE Labs, SuSE CR