events in evdev.c

Sascha Hlusiak saschahlusiak at
Sun Sep 21 10:57:34 PDT 2008

> > keysyms are totally X11 and application side and very much
> > cross-platform.
> You say evdev's keysym code is totally X11?  Well, evdev.c's keysym code
> brings in linux's input.h, which isn't cross-platform, isn't purely X11. 
Nope, two different things. Evdev gets the scancodes from the kernel (with the 
interface defined in input.h) and the evdev.c has a giant map of mapping 
those scancodes to keysyms. Getting the scancode is platform depend, but the 
rest isn't.

> That's one big reason that I couldn't figure out what evdev.c was doing.  I
> don't say it isn't nice code, only that I couldn't learn keysyms from it,
> because it used too many defines I couldn't figure out, stuff that wasn't
> X11 only.  I /could/ do that with joystick.  That's true, isn't it?
evdev is easier here. You just get a scancode from a device and tell Xorg how 
to map the scancode. That map is fixed and defined in evdev.c. The scancode 
to keysym map in the joystick driver is made up on loading, it's not fixed 
but totally dependend on the configuration.

> > And something similar to the Linux events (as in evdev) do exist in
> > FreeBSD, it's just no 1:1 mapping. And even if they didn't; what's your
> > point? That the evdev driver should not exist then, just because other
> > platforms don't provide such an interface?
> You've said that before, I don't really want to disagree, but could you
> point to the actual interface you're talking about? I might be wrong, it 
> doesn't seem all that event-ish to me, and I'd like to see what you mean. 
The evdev interface in Linux doesn't seem so event-ish to me either. Can you 
point out the callbacks, that you meant?

If you compare the evdev implementation with the usbhid (bsd) implementation 
in the joystick driver, you'll see how similar they are. And you'll find that 
you might be able to use that usb hid interface with your device as well, if 
it's supported.

> I mean, FreeBSD doesn't call out of the kernel, you have to call into it
> and query (from a user-mode viewpoint).
We all do query the kernel with evdev. Still the kernel tells us when there is 
data available (when we are inside the select call), and BSD does the same.

- Sascha

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the xorg mailing list