David Megginson wrote:
> 
> I've just checked in a new patch for automatic joystick type detection
> (where available).  NOTE: it will work *only* if you have a recent (2
> months or so) CVS version of plib.
> 
...
> 
> Please send me your bindings for your own device.  Under Linux, you
> can find the device name with a command like
> 
>   jstest /dev/js0 | less
> 
> (You must include any trailing spaces.)

May I offer this patch which will help non-Linux users find their joysticks' names:

  Index: js_demo.cxx
  ===================================================================
  RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/Input/js_demo.cxx,v
  retrieving revision 1.1
  diff -u -3 -p -d -r1.1 js_demo.cxx
  --- js_demo.cxx 4 Jun 2001 19:26:53 -0000       1.1
  +++ js_demo.cxx 5 Jul 2002 17:47:09 -0000
  @@ -26,9 +26,12 @@ int main ( int, char ** )
     t = 0;
     for ( i = 0; i < Z; i++ )
     { useful[i] = ! ( js[i]->notWorking () );
  -    if ( useful[i] )
  +    if ( useful[i] ) {
            t++;
  -    else printf ( "Joystick %i not detected\n", i ) ;
  +#ifdef FG_PLIB_JOYSTICK_GETNAME
  +         printf ( "Joystick %i: \"%s\"\n", i, js[i]->getName() ) ;
  +#endif
  +    } else printf ( "Joystick %i not detected\n", i ) ;
     }
     if ( t == 0 ) exit ( 1 ) ;
  

For my Saitek "Cyborg 3D Gold USB" joystick, that gave:

  Joystick test program.
  ~~~~~~~~~~~~~~~~~~~~~~
  Joystick 0: "Microsoft PC-joystick driver"
  Joystick 1 not detected
  ...

which is presumably because I haven't bothered to install Saitek's driver, because the 
default Windows one does the job.  Some other people will have done the same, of 
course, but there's not a lot we can do about it.

On a related note (Windows compatibility), a given joystick's axes are sometimes 
numbered differently under Windows and under Linux.  This is nearly always true for 
the hat switch with the present version of PLIB.  Therefore we should either:
- provide different configurations for the same joystick under different OSs; or
- make PLIB present the axes numbered in the same way under all OSs.

PLIB is supposed to provide cross-platform portability, so obviously the latter should 
be attempted.  It is not a simple bug in PLIB, it is a slightly complicated issue due 
to the different ways the joystick interface is provided by the different OSs, and may 
rely on cooperation from the vendor driver writers.  I will raise the issue on the 
PLIB list.


One more point: it would be good to separate the joystick axis number-to-name mappings 
(axis 0 = left/right, axis 2 = twist, axis 3 = slider, etc) from the name-to-function 
mappings (left/right = ailerons, twist = rudder, etc.).  At least, if we don't 
separate them, we should probably make sure that all of our joystick mapping files 
give the same functions.  It would be silly if users find that the twist axis controls 
rudder when they use some types of joystick, but controls view direction when they use 
other types.

I have hat fwd/back mapped to elevator trim.  Are we standardising on the hat 
controlling view direction (for the supplied bindings; I know I can keep my local 
changes)?

- Julian

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to