Joystick Façade

Hans Fugal hans at
Fri Jun 1 23:30:51 MDT 2007

The problem: X-Plane doesn't read joystick directional hats in linux
correctly (you know, the little thumb thingy to look around with).

This is because the linux kernel reports directional hat events as two
axes, and they always read either -32767, 0, or +32767. Windows reports
them as 4 buttons (up, down, right, left). X-Plane runs on linux, but
the author isn't gracious enough to make the easy fix (in his own words)
to support his linux users.

There have been patching efforts floating around, but they are very
fragile and rely on hardcoding the joystick number (which can change
easily if you have multiple joystick devices like me - I have 4 that are
in frequent use) and button numbers.

So my question is, in this day and age, shouldn't it be possible to
write a joystick façade, or proxy, or filter or whatever you want to
call it, which converts those joystick hat axis events into button
events? It would detect the joystick by name or product id or some other
sane mechanism, and provide an X-Plane friendly façade. Ideally it
wouldn't break other programs (like FlightGear) that are not broken to
begin with. Ideally it would be a userspace solution, but I'm open to
making a kernel module or even a patch to joydev.c, if someone can point
me in the right direction.

Any kernel hackers with some sage advice, before I go jump in the shark
pool and ask on the LKML?

Hans Fugal ;
There's nothing remarkable about it. All one has to do is hit the 
right keys at the right time and the instrument plays itself.
    -- Johann Sebastian Bach

More information about the PLUG mailing list