Resend: Patch - Joystick coef[] doesn't support dial with low number of positions

Resending as no commentary was made… please review/apply.

Simon> ----- Original Message -----

Subject: Patch - Joystick coef[] doesn’t support dial with low number of
positions.
From: @Simon_Wood
Date: Wed, January 23, 2013 2:09 pm
To: sdl at lists.libsdl.org

I am working on joystick support for the SRW-S1 gaming wheel on Linux,
this device has 3 dials with only a few positions each.

At present SDL2 only fail to report the highest position value, due to the
interger math used for coef[]'s.

So with a 4 position switch I have input values (with evtest)

Event: time 1358967246.173186, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967246.173186, -------------- SYN_REPORT ------------
Event: time 1358967246.369150, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967246.369150, -------------- SYN_REPORT ------------
Event: time 1358967246.930277, type 3 (EV_ABS), code 9 (ABS_GAS), value 0
Event: time 1358967246.930277, -------------- SYN_REPORT ------------
Event: time 1358967249.369832, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967249.369832, -------------- SYN_REPORT ------------
Event: time 1358967249.514382, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967249.514382, -------------- SYN_REPORT ------------
Event: time 1358967249.626189, type 3 (EV_ABS), code 9 (ABS_GAS), value 3
Event: time 1358967249.626189, -------------- SYN_REPORT ------------

Testjoystick reports

Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768

The attached patch ‘shifts’ the coef[], so that 1/2 values can be
computed/seen and allows testjoystick to report correctly.

Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767

Cheers,
Simon
-------------- next part --------------
A non-text attachment was scrubbed…
Name: joystick_dial.patch
Type: text/x-patch
Size: 1595 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130205/309d6a1e/attachment.bin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: dial_patch.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130205/309d6a1e/attachment.txt

This is in too, thanks!
http://hg.libsdl.org/SDL/rev/e14535915e3eOn Tue, Feb 5, 2013 at 4:12 PM, wrote:

Resending as no commentary was made… please review/apply.

Simon

---------------------------- Original Message ----------------------------
Subject: Patch - Joystick coef[] doesn’t support dial with low number of
positions.
From: simon at mungewell.org
Date: Wed, January 23, 2013 2:09 pm
To: sdl at lists.libsdl.org

I am working on joystick support for the SRW-S1 gaming wheel on Linux,
this device has 3 dials with only a few positions each.

At present SDL2 only fail to report the highest position value, due to the
interger math used for coef[]'s.

So with a 4 position switch I have input values (with evtest)

Event: time 1358967246.173186, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967246.173186, -------------- SYN_REPORT ------------
Event: time 1358967246.369150, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967246.369150, -------------- SYN_REPORT ------------
Event: time 1358967246.930277, type 3 (EV_ABS), code 9 (ABS_GAS), value 0
Event: time 1358967246.930277, -------------- SYN_REPORT ------------
Event: time 1358967249.369832, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967249.369832, -------------- SYN_REPORT ------------
Event: time 1358967249.514382, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967249.514382, -------------- SYN_REPORT ------------
Event: time 1358967249.626189, type 3 (EV_ABS), code 9 (ABS_GAS), value 3
Event: time 1358967249.626189, -------------- SYN_REPORT ------------

Testjoystick reports

Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768

The attached patch ‘shifts’ the coef[], so that 1/2 values can be
computed/seen and allows testjoystick to report correctly.

Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767

Cheers,
Simon


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org