[dinput][joystick_linuxinput] make axes work, that are "not in a row"

Vitaliy Margolen wine-devel at kievinfo.com
Thu Jan 11 14:10:21 CST 2007


Christoph Frick wrote:
> On Thu, Jan 11, 2007 at 10:25:51AM -0700, Vitaliy Margolen wrote:
> 
>>> @@ -128,11 +122,20 @@ struct JoystickImpl
>>>  	/* The 'parent' DInput */
>>>  	IDirectInputImpl               *dinput;
>>>  
>>> +	/* autodetecting ranges per axe by following movement */
>>> +	LONG				havemax[8];
>>> +	LONG				havemin[8];
>> I could never understood why we need these? In other joystick_linux the
>> range assumed to be 0 - 0xffff.
> 
> linux/input.h reports us the proper ranges from the device. these
> numbers will also be used as teh want(min|max). so what this numbers are
> good for. apps that want the input as "pure" as it gets dont
> SetProperty some something and just get what the hardware tells them
> (e.g. RBR does so).
What you described is SetProperty(DIPROP_RANGE). What I'm talking about
is the range we get from device itself. In the map_axis we have:

    if (val > hmax) This->joydev->havemax[axis] = hmax = val;
    if (val < hmin) This->joydev->havemin[axis] = hmin = val;

We either need to query the device for what it's ranges are, or use
default range (as it's done in joystick_linux). Auto-detecting range
will work only if you move joystick on all axes from min to max. And
even then it still doesn't work here.
I'm using joystick sample from DXSDK and it always shows 0-128-256 range
for accelerator - brake pedals (as a combined Z axis). joystick_linux
shows it correctly - 0..1000 (it sets this range for all axes).

>>> +    fake_current_js_state(newDevice);
>> Can you explain what this suppose to do? Why do we need to "fake
>> current state" everywhere?
> 
> after e.g. SetProperties and initializing the device we have to put the
> values of the DIJOYSTATE2 in a sane state. e.g. GPL set the ranges to
> 1000-25k; where my pedals are in 0..512; so the app gets in the next
> step after the setting a default value of 512 (clutch not pressed) and
> gets nuts.
> 
Right. But can we query device for the current axes position? They are
analog devices, and should provide absolute position.

Vitaliy.



More information about the wine-devel mailing list