hal: ups as input?

Brad Hards bhards at bigpond.net.au
Thu Jan 15 23:14:34 EET 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 16 Jan 2004 03:05 am, Matthew Mastracci wrote:
> Sean Middleditch wrote:
> > I have an APC UPS unit attached via USB (for monitoring and such), and
> > HAL reports it as the capability 'input' - doesn't smell right to me.
> > ;-)  perhaps a 'ups' capability is needed.
>
> Actually, from the point of view of the kernel, the APC device *is* an
> input device.  More specifically, it's a HID-class device.  This is a
> class of device that presents arrays of numbers to the kernel - it's up
> to userspace programs to handle and interpret these.
This is a tad imprecise. It is a HID device, but not all HID devices are input 
devices. Nothing in the HID spec actually requires that the device produce 
any input (beyond the normal USB self-describing descriptors). The kernel 
actually knows this - there is a macro that tests the Application information 
in the HID descriptor, and if the right magic numbers come up, then you are 
an input device (and get connected to the input subsystem, subject to it 
being configured into the kernel). Otherwise you get connected to hiddev 
(again subject to kernel config).

HAL should not be guessing what top level API the device is going to be 
attached to, based on low level data like the USB class code.

> Unfortunately, USB doesn't have a UPS class of device.
But it does have a Power Device spec, which is basically the HID usage pages 
for an UPS or similar device.

> BTW, I have the same UPS at home and I've played around with the data
> you can get from it.  You could pretty easily create a user-space daemon
> to connect to the kernel APC devices and interpret the HID data.  I've
> done this already in C# under Windows - it would be a small step to port
> this to Linux.
Network UPS Tools (http://www.exploits.org/nut or something like that) and 
APCUPSD already should be able to do this.

Brad 
- -- 
http://linux.conf.au - Having fun now!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFABwK+GwwszQ/PZzgRAs05AKCgjQNCYaRuNextF0V8G+umxQY9qQCfQkw2
Vbcd4BhTXBjJU/5t9aykR08=
=8ATN
-----END PGP SIGNATURE-----



More information about the xdg mailing list