Problem with input device

David Zeuthen david at fubar.dk
Thu Jun 3 10:51:03 PDT 2004


On Wed, Jun 02, 2004 at 02:38:18PM -0400, Joe Shaw wrote:
> On Wed, 2004-06-02 at 14:32 -0400, Bill Nottingham wrote:
> > Well, all of the input devices are in /proc/bus/input/devices; so you
> > can determine keyboard/ps2-mouse/touchpad, etc.
> 
> Ah, good call.  I often forget about /proc because it's evil and I hate
> it. :)  Ideally it'd all by in sysfs but hey, what can you do.
> 
> Kristian, if you want to whip up a patch to parse
> /proc/bus/input/devices, that'd be fine by me.
> 

We did this earlier before we, uhmm, refactored everything into something
a bit more object oriented. Here's the relevant link from CVS

 http://freedesktop.org/cgi-bin/viewcvs.cgi/hal/hal/hald/linux/Attic/linux_class_input.c?rev=1.6&only_with_tag=HAL_0_2_6&view=auto

to the old file.

I think it's a good idea to use /proc/bus/input/devices for the time
being, but once you know what properties are interesting it would be
good to write a patch to the kernel to export these properties. I
think this would be happily accepted as my interpretation is that the
kernel developers wants to gid rid of, or at least deprecate,
non-process stuff in /proc. That would be nice.

For USB, I did that to expose three more USB attributes and Robert
helped to push it into 2.6.6. I still haven't written code to use it
in hald so there is still some ugly code (I know cause I wrote it :-)
to read /proc/bus/usb/devices and it will still be there for backwards
compatibility for at least some time. I suppose it makes sense to make
using whatever code a build-time configuration at some future point.

The reason you might have trouble when hotplugging may be because of
the fact that there's a race between the kernel to write the
attributes and HAL to read it. This race we normally resolve in
hal_hotplug.c (in tools/linux/) because then we can block which is not
an option in hald.

Hope this helps,
David





_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list