Subject: Re: uhid and UPS's
To: Lennart Augustsson <lennart@augustsson.net>
From: Wolfgang S. Rupprecht <wolfgang+gnus20041115T103227@dailyplanet.dontspam.wsrcc.com>
List: tech-userlevel
Date: 11/15/2004 13:23:52
Lennart Augustsson writes:
> This is a rather unusual device.  Is this really the way power
> devices are supposed to work?

The only usb power-control info I've been able to find is an old 1997
pdf from intel at usb.org,
http://www.usb.org/developers/devclass_docs/pdcv10.pdf . It shows
several report-ids (id 1 to id 11, see pdf pages 51-58), but it
appears that the intention was to offer related bundles of
information.

I'm inclined to think APC misunderstood the intention of the report
id's.  On the other hand, APC is a very common brand of UPS in the US,
so this is going to come up more frequently as time goes on.

> Anyway, perhaps there should be a way not to make a separate
> uhid device for each report id.  This is the way it used to
> be (but that doesn't work for devices where only the report
> id distinguishes a mouse from a keyboard).
> I suggest using 'flag 1' on the uhidev device.

Ok.  I'll play around. I might try to turn off the multi-uhid logic
for power devices (eg. hid page 0x84 and 0x85) or perhaps just for APC
power-control devices.

Martin Husemann writes:
> On Mon, Nov 15, 2004 at 09:24:03PM +0100, Lennart Augustsson wrote:
> > This is a rather unusual device.  Is this really the way power
> > devices are supposed to work?
> 
> I wonder what logic made the manufacturer declare it as uhid anyway.
> It does have a button and some LEDs, but so does my CD drive.

I've been scratching my head over that one too.  Maybe they intended
the UPS to be a keyboard-like device that would type "shutdown -h +1
'power is gone and you are screwed.'"

In any case, it is tempting to tie it into the apm logic a bit tighter
and have the kernel and UPS coordinate the power-off event a bit
better than they now do.  The current apcupsd power-off logic uses a
timer in the UPS and if the shutdown is a bit slow the UPS could cut
power before the kernel unmounted everything.

-wolfgang