[Plib-cvs] plib/src/js jsLinux.cxx,1.6,1.7
Brought to you by:
sjbaker
From: Bram S. <br...@us...> - 2005-02-21 07:37:38
|
Update of /cvsroot/plib/plib/src/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21342 Modified Files: jsLinux.cxx Log Message: Patch by Mathias Froehlich to handle joysticks with lotsa axes. Index: jsLinux.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/js/jsLinux.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- jsLinux.cxx 20 Oct 2004 23:49:33 -0000 1.6 +++ jsLinux.cxx 21 Feb 2005 07:37:25 -0000 1.7 @@ -75,12 +75,13 @@ ioctl ( os->fd, JSIOCGNAME ( sizeof(name) ), name ) ; fcntl ( os->fd, F_SETFL , O_NONBLOCK ) ; + int all_axes = num_axes; if ( num_axes > _JS_MAX_AXES ) num_axes = _JS_MAX_AXES ; // 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 ] ; + struct js_corr* corr = new js_corr[ all_axes ] ; ioctl ( os->fd, JSIOCGCORR, corr ); for ( int i = 0; i < num_axes ; ++i ) { if ( corr[ i ] . type == JS_CORR_BROKEN ) { @@ -90,6 +91,7 @@ } } ioctl ( os->fd, JSIOCSCORR, corr ); + delete [] corr; for ( int i = 0 ; i < _JS_MAX_AXES ; i++ ) { |