1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

- Fix min/max/center values of USB joysticks

- Bump PORTREVISION

PR:		189006
Submitted by:	russo@bogodyn.org
This commit is contained in:
Rene Ladan 2014-07-21 13:23:26 +00:00
parent 7b01835678
commit 0dd6eaa107
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=362435
2 changed files with 48 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= plib
PORTVERSION= 1.8.5
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= x11-toolkits
MASTER_SITES= http://plib.sourceforge.net/dist/

View File

@ -0,0 +1,47 @@
--- ./src/js/jsBSD.cxx.orig 2014-07-21 15:11:30.000000000 +0200
+++ ./src/js/jsBSD.cxx 2014-07-21 15:11:30.000000000 +0200
@@ -99,6 +99,8 @@
// on every read of a USB device
int cache_buttons ;
float cache_axes [ _JS_MAX_AXES ] ;
+ float axes_minimum [ _JS_MAX_AXES ] ;
+ float axes_maximum [ _JS_MAX_AXES ] ;
};
// Idents lower than USB_IDENT_OFFSET are for analog joysticks.
@@ -196,9 +198,12 @@
case HUG_Z:
case HUG_RZ:
case HUG_SLIDER:
+ case HUG_DIAL:
if (*num_axes < _JS_MAX_AXES)
{
os->axes_usage[*num_axes] = usage;
+ os->axes_minimum[*num_axes] = h.logical_minimum;
+ os->axes_maximum[*num_axes] = h.logical_maximum;
(*num_axes)++;
}
break;
@@ -324,9 +329,6 @@
for ( int i = 0 ; i < _JS_MAX_AXES ; i++ )
{
- // We really should get this from the HID, but that data seems
- // to be quite unreliable for analog-to-USB converters. Punt for
- // now.
if ( os->axes_usage [ i ] == HUG_HAT_SWITCH )
{
max [ i ] = 1.0f ;
@@ -335,9 +337,9 @@
}
else
{
- max [ i ] = 255.0f ;
- center [ i ] = 127.0f ;
- min [ i ] = 0.0f ;
+ max [ i ] = os->axes_maximum [ i ];
+ min [ i ] = os->axes_minimum [ i ];
+ center [ i ] = (max [ i ] + min [ i ]) / 2.0 ;
}
dead_band [ i ] = 0.0f ;
saturate [ i ] = 1.0f ;