Lines 99-104
Link Here
|
99 |
// on every read of a USB device |
99 |
// on every read of a USB device |
100 |
int cache_buttons ; |
100 |
int cache_buttons ; |
101 |
float cache_axes [ _JS_MAX_AXES ] ; |
101 |
float cache_axes [ _JS_MAX_AXES ] ; |
|
|
102 |
float axes_minimum [ _JS_MAX_AXES ] ; |
103 |
float axes_maximum [ _JS_MAX_AXES ] ; |
102 |
}; |
104 |
}; |
103 |
|
105 |
|
104 |
// Idents lower than USB_IDENT_OFFSET are for analog joysticks. |
106 |
// Idents lower than USB_IDENT_OFFSET are for analog joysticks. |
Lines 196-204
Link Here
|
196 |
case HUG_Z: |
198 |
case HUG_Z: |
197 |
case HUG_RZ: |
199 |
case HUG_RZ: |
198 |
case HUG_SLIDER: |
200 |
case HUG_SLIDER: |
|
|
201 |
case HUG_DIAL: |
199 |
if (*num_axes < _JS_MAX_AXES) |
202 |
if (*num_axes < _JS_MAX_AXES) |
200 |
{ |
203 |
{ |
201 |
os->axes_usage[*num_axes] = usage; |
204 |
os->axes_usage[*num_axes] = usage; |
|
|
205 |
os->axes_minimum[*num_axes] = h.logical_minimum; |
206 |
os->axes_maximum[*num_axes] = h.logical_maximum; |
202 |
(*num_axes)++; |
207 |
(*num_axes)++; |
203 |
} |
208 |
} |
204 |
break; |
209 |
break; |
Lines 324-332
Link Here
|
324 |
|
329 |
|
325 |
for ( int i = 0 ; i < _JS_MAX_AXES ; i++ ) |
330 |
for ( int i = 0 ; i < _JS_MAX_AXES ; i++ ) |
326 |
{ |
331 |
{ |
327 |
// We really should get this from the HID, but that data seems |
|
|
328 |
// to be quite unreliable for analog-to-USB converters. Punt for |
329 |
// now. |
330 |
if ( os->axes_usage [ i ] == HUG_HAT_SWITCH ) |
332 |
if ( os->axes_usage [ i ] == HUG_HAT_SWITCH ) |
331 |
{ |
333 |
{ |
332 |
max [ i ] = 1.0f ; |
334 |
max [ i ] = 1.0f ; |
Lines 335-343
Link Here
|
335 |
} |
337 |
} |
336 |
else |
338 |
else |
337 |
{ |
339 |
{ |
338 |
max [ i ] = 255.0f ; |
340 |
max [ i ] = os->axes_maximum [ i ]; |
339 |
center [ i ] = 127.0f ; |
341 |
min [ i ] = os->axes_minimum [ i ]; |
340 |
min [ i ] = 0.0f ; |
342 |
center [ i ] = (max [ i ] + min [ i ]) / 2.0 ; |
341 |
} |
343 |
} |
342 |
dead_band [ i ] = 0.0f ; |
344 |
dead_band [ i ] = 0.0f ; |
343 |
saturate [ i ] = 1.0f ; |
345 |
saturate [ i ] = 1.0f ; |