[I'm afraid I'm not subscribed to the plib devel list, so I hope that by posting this message here, the info will get passed on to the right person]

I'm running FlightGear on an old linux box (RedHat 7.3)

For the first time in a few months, I tried out a freshly updated version of FlightGear this afternoon, with plib, SimGear, and FlightGear all pulled from CVS. I noticed that the hat switch on my venerable Thrustmaster FCS joystick wasn't working. I checked the 'js_demo' program that comes with FlightGear and found that it wasn't reading the joystick's "name" (in my case, "Analog 2-axis 4-button 1-hat FCS joystick"). The name was an empty string, and thus I was getting the default joystick bindings instead of those for my joystick.

I started looking through CVS logs to see what had changed, and finally tracked the problem back to a reorganization of the joystick code in plib that occurred back in August. Plib's joystick code is split up into several OS-specific files (jsBSD.cxx, jsWindows,cxx, etc). There are two such files for Linux, on for the "old" joystick driver (jsLinuxOld.cxx) and one for the "new" (jsLinux.cxx). During the joystick code cleanup, the following code from plib/src/js/js.h was deleted:

#ifdef UL_LINUX         
#    include <sys/ioctl.h>        
#    include <linux/joystick.h>   
/* check the joystick driver version */         
#if defined(JS_VERSION) && JS_VERSION >= 0x010000    
#  define JS_NEW        

Since JS_NEW no longer gets defined, plib compiles the old joystick driver, instead of the new. I suppose I was lucky the joystick worked at all. When I restored the above lines of code to js.h and recompiled, my joystick functioned correctly again.

There may be a cleaner way to fit this version check into the reorganized joystick code: I defer to the plib developers. I will point out that even RedHat 7.3, a rather old distro, has the "new" joystick driver (my JS_VERSION is 0x020100, according to <linux/joystick.h>). Does anyone even need the old driver anymore? Just a thought...


Flightgear-devel mailing list

Reply via email to