[freespace2] Linux joystick code

Karl Robillard krobillard at cox.net
Tue Dec 16 03:17:50 EST 2003


On Monday 15 December 2003 04:14 am, Alan Swanson wrote:
> Thats up to Dan, but I think your patch is unneeded.
>
> People know how to use the joystick interface as its been around
> forever! Set it up correctly for SDL and all the other games will
> also work without having to add joystick code to each game.


I was able to get SDL to recognize the hat with 
SDL_LINUX_JOYSTICK="'06a3:0464' 4 1 0".  Yes, the name of my joystick is 
06a3:0464.  I am not a number!  I am a free... erm, device!  I'm not sure why 
SDL cares about the name of my joystick, but there you are.

Strictly speaking my code is not needed.  Especially now that I was able to 
get SDL to recognize the hat.  But then, strictly speaking, Linux is not 
needed; we could all use Windows and just play Freespace there.  Variety is 
good and looking at (or implementing) the same thing in different ways can be 
valuable.  It certainly does no harm.  In about the same amount of code it 
takes to use the SDL wrapper to the Linux joystick one can just directly use 
the Linux joystick.  As a Linux enthusiast I prefer to use applications that 
use the native APIs rather than those using wrapper layers such as Wine or 
SDL.

It seems like there should be some standard Linux environment variables for 
the joystick (JOYSTICK_DEVICE, JOYSTICK_HAT_AXIS, etc.) which applications 
(and libraries like SDL) could use.


> The joystick interface is being replaced by event interface. (Though
> it could stll do with a calibration method :-)

Do you think it would be good for app. developers to stick with the joystick 
interface for the next year or so until the event interface is widely used?

Thanks for adding my code Dan!


-Karl




More information about the freespace2 mailing list