As I mentioned before, the joystick initialization crashes and causes a
segmentation fault on my machine.  I have a Microsoft Sidewinder Force
Feedback 2 joystick, FG.9.8. on Fedora Core 3.  athlon cpu and ati
radeon AIW video card.

I have isolated the problem code in file plib/src/js/jsLinux.cxx  which
if I comment out this section of the jsLinux.cxx file I can compile and
run FlightGear:

  // Remove any deadband value already done in the kernel.
  // Since we have our own deadband management this is save to do so.

  struct js_corr corr [ _JS_MAX_AXES ];
  ioctl ( os->fd, JSIOCGCORR, corr );
  for ( int i = 0; i < num_axes ; ++i ) {
    if ( corr[ i ] . type == JS_CORR_BROKEN ) {
      int nodeadband = ( corr[ i ] . coef[ 0 ] + corr[ i ] . coef
[ 1 ] ) / 2 ;
      corr[ i ] . coef[ 0 ] = nodeadband ;
      corr[ i ] . coef[ 1 ] = nodeadband ;
    }
  }
  ioctl ( os->fd, JSIOCSCORR, corr );

The Segmentation Fault is caused by the first ioctl() call.  It
overwrites more than the struct js_corr structure and corrupts the THIS
pointer.  then the next line:

     for ( int i =0; i< num_axes;++i)

generates a Segmentation Fault when it tries to access  num_axes because
the THIS pointer is now pointing at 0x0010000 memory address.

I have been unable to figure out how to fix it but if someone can give
me some help I'm sure we can figure it out.

Thanks,
Doug.



_______________________________________________
Flightgear-users mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-users
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to