* Bug HID Dial - jstest and evtest see different number of clicks
@ 2013-01-20 6:24 simon
2013-01-22 4:48 ` simon
0 siblings, 1 reply; 5+ messages in thread
From: simon @ 2013-01-20 6:24 UTC (permalink / raw)
To: linux-input
Hi,
I'm modifying the HID descriptor for a gaming wheel to support the dials
on it and I'm seeing that jstest does not report/register the highest
value location, whereas evtest does.
For example the last dial is 4 position (values 0 to 3) and reported as
the 'ABS_GAS' control.
--
/* ---- Dial patch starts here ---- */
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x37, /* Usage (Dial), */
0x75, 0x04, /* Report Size (4), */
0x95, 0x02, /* Report Count (2), */
0x15, 0x00, /* Logical Minimum (0), */
0x25, 0x0b, /* Logical Maximum (b), */
0x81, 0x02, /* Input (Variable), */
0x09, 0x37, /* Usage (Dial), */
0x75, 0x04, /* Report Size (4), */
0x95, 0x01, /* Report Count (1), */
0x25, 0x03, /* Logical Maximum (3), */
0x81, 0x02, /* Input (Variable), */
/* ---- Dial patch ends here ---- */
--
Jstest only reports 3 positions and 'misses' the last click
--
simon@simon-virtual-machine:~/linux-git$ jstest --event /dev/input/js0
Driver version is 2.1.0.
Joystick (SteelSeries SRWheel) has 8 axes (X, Y, Z, Rudder, Wheel, Gas,
Hat0X, Hat0Y)
and 17 buttons (BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect,
BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?, ?, ?, ?, (null)).
Testing ... (interrupt to exit)
Event: type 129, time 5915608, number 0, value 0
Event: type 129, time 5915608, number 1, value 0
Event: type 129, time 5915608, number 2, value 0
Event: type 129, time 5915608, number 3, value 0
Event: type 129, time 5915608, number 4, value 0
Event: type 129, time 5915608, number 5, value 0
Event: type 129, time 5915608, number 6, value 0
Event: type 129, time 5915608, number 7, value 0
Event: type 129, time 5915608, number 8, value 0
Event: type 129, time 5915608, number 9, value 0
Event: type 129, time 5915608, number 10, value 0
Event: type 129, time 5915608, number 11, value 0
Event: type 129, time 5915608, number 12, value 0
Event: type 129, time 5915608, number 13, value 0
Event: type 129, time 5915608, number 14, value 0
Event: type 129, time 5915608, number 15, value 0
Event: type 129, time 5915608, number 16, value 0
Event: type 130, time 5915608, number 0, value 0
Event: type 130, time 5915608, number 1, value -32767
Event: type 130, time 5915608, number 2, value -32767
Event: type 130, time 5915608, number 3, value -32767
Event: type 130, time 5915608, number 4, value -32767
Event: type 130, time 5915608, number 5, value -32767
Event: type 130, time 5915608, number 6, value 0
Event: type 130, time 5915608, number 7, value 0
Event: type 2, time 5922404, number 5, value 0
Event: type 2, time 5925804, number 5, value 32767
Event: type 2, time 5938004, number 5, value 0
Event: type 2, time 5940096, number 5, value -32767
^C
--
Whereas evtest (simultaneously) sees all 4 positions
--
simon@simon-virtual-machine:~$ evtest /dev/input/event4
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x1038 product 0x1410 version 0x111
Input device name: "SteelSeries SRWheel"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 304 (BTN_A)
Event code 305 (BTN_B)
Event code 306 (BTN_C)
Event code 307 (BTN_X)
Event code 308 (BTN_Y)
Event code 309 (BTN_Z)
Event code 310 (BTN_TL)
Event code 311 (BTN_TR)
Event code 312 (BTN_TL2)
Event code 313 (BTN_TR2)
Event code 314 (BTN_SELECT)
Event code 315 (BTN_START)
Event code 316 (BTN_MODE)
Event code 317 (BTN_THUMBL)
Event code 318 (BTN_THUMBR)
Event code 319 (?)
Event code 704 (BTN_TRIGGER_HAPPY1)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 1800
Min -1800
Max 1800
Fuzz 14
Flat 225
Event code 1 (ABS_Y)
Value 0
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 2 (ABS_Z)
Value 0
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 7 (ABS_RUDDER)
Value 0
Min 0
Max 11
Event code 8 (ABS_WHEEL)
Value 0
Min 0
Max 11
Event code 9 (ABS_GAS)
Value 0
Min 0
Max 3
Event code 16 (ABS_HAT0X)
Value 0
Min -1
Max 1
Event code 17 (ABS_HAT0Y)
Value 0
Min -1
Max 1
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1358662071.788346, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358662071.788346, -------------- SYN_REPORT ------------
Event: time 1358662075.188293, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358662075.188293, -------------- SYN_REPORT ------------
Event: time 1358662079.725606, type 3 (EV_ABS), code 9 (ABS_GAS), value 3
Event: time 1358662079.725606, -------------- SYN_REPORT ------------
Event: time 1358662084.757001, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358662084.757001, -------------- SYN_REPORT ------------
Event: time 1358662087.388547, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358662087.388547, -------------- SYN_REPORT ------------
Event: time 1358662089.477327, type 3 (EV_ABS), code 9 (ABS_GAS), value 0
Event: time 1358662089.477327, -------------- SYN_REPORT ------------
^C
--
Can anyone else confirm this is a bug, or am I messing up some where?
Simon.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug HID Dial - jstest and evtest see different number of clicks
2013-01-20 6:24 Bug HID Dial - jstest and evtest see different number of clicks simon
@ 2013-01-22 4:48 ` simon
2013-01-23 5:21 ` BUG: Joydev - Broken line compensation does not work for small range inputs simon
0 siblings, 1 reply; 5+ messages in thread
From: simon @ 2013-01-22 4:48 UTC (permalink / raw)
To: simon; +Cc: linux-input
With a little more digging on this I think the issue is down to the
default calibration values.
Using 'jscal -c' I am able to recalibrate so that the system reports 4
different values (for the 4 position dial), however the spacing is not
linear as there is no way to set the mid position - which would need to be
1.5
Also using 'jscal -s 8,0,0,0,0,0...' I can turn off the calibration
altogether and see the raw values from the device.
Question: should a calibration really be applied to a dial?? evtest
displays without a fuzz and flat listed.
Simon
> Hi,
> I'm modifying the HID descriptor for a gaming wheel to support the dials
> on it and I'm seeing that jstest does not report/register the highest
> value location, whereas evtest does.
>
> For example the last dial is 4 position (values 0 to 3) and reported as
> the 'ABS_GAS' control.
> --
> /* ---- Dial patch starts here ---- */
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x37, /* Usage (Dial), */
> 0x75, 0x04, /* Report Size (4), */
> 0x95, 0x02, /* Report Count (2), */
> 0x15, 0x00, /* Logical Minimum (0), */
> 0x25, 0x0b, /* Logical Maximum (b), */
> 0x81, 0x02, /* Input (Variable), */
> 0x09, 0x37, /* Usage (Dial), */
> 0x75, 0x04, /* Report Size (4), */
> 0x95, 0x01, /* Report Count (1), */
> 0x25, 0x03, /* Logical Maximum (3), */
> 0x81, 0x02, /* Input (Variable), */
> /* ---- Dial patch ends here ---- */
> --
>
> Jstest only reports 3 positions and 'misses' the last click
> --
> simon@simon-virtual-machine:~/linux-git$ jstest --event /dev/input/js0
> Driver version is 2.1.0.
> Joystick (SteelSeries SRWheel) has 8 axes (X, Y, Z, Rudder, Wheel, Gas,
> Hat0X, Hat0Y)
> and 17 buttons (BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect,
> BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?, ?, ?, ?, (null)).
> Testing ... (interrupt to exit)
> Event: type 129, time 5915608, number 0, value 0
> Event: type 129, time 5915608, number 1, value 0
> Event: type 129, time 5915608, number 2, value 0
> Event: type 129, time 5915608, number 3, value 0
> Event: type 129, time 5915608, number 4, value 0
> Event: type 129, time 5915608, number 5, value 0
> Event: type 129, time 5915608, number 6, value 0
> Event: type 129, time 5915608, number 7, value 0
> Event: type 129, time 5915608, number 8, value 0
> Event: type 129, time 5915608, number 9, value 0
> Event: type 129, time 5915608, number 10, value 0
> Event: type 129, time 5915608, number 11, value 0
> Event: type 129, time 5915608, number 12, value 0
> Event: type 129, time 5915608, number 13, value 0
> Event: type 129, time 5915608, number 14, value 0
> Event: type 129, time 5915608, number 15, value 0
> Event: type 129, time 5915608, number 16, value 0
> Event: type 130, time 5915608, number 0, value 0
> Event: type 130, time 5915608, number 1, value -32767
> Event: type 130, time 5915608, number 2, value -32767
> Event: type 130, time 5915608, number 3, value -32767
> Event: type 130, time 5915608, number 4, value -32767
> Event: type 130, time 5915608, number 5, value -32767
> Event: type 130, time 5915608, number 6, value 0
> Event: type 130, time 5915608, number 7, value 0
> Event: type 2, time 5922404, number 5, value 0
> Event: type 2, time 5925804, number 5, value 32767
> Event: type 2, time 5938004, number 5, value 0
> Event: type 2, time 5940096, number 5, value -32767
> ^C
> --
>
> Whereas evtest (simultaneously) sees all 4 positions
> --
> simon@simon-virtual-machine:~$ evtest /dev/input/event4
> Input driver version is 1.0.1
> Input device ID: bus 0x3 vendor 0x1038 product 0x1410 version 0x111
> Input device name: "SteelSeries SRWheel"
> Supported events:
> Event type 0 (EV_SYN)
> Event type 1 (EV_KEY)
> Event code 304 (BTN_A)
> Event code 305 (BTN_B)
> Event code 306 (BTN_C)
> Event code 307 (BTN_X)
> Event code 308 (BTN_Y)
> Event code 309 (BTN_Z)
> Event code 310 (BTN_TL)
> Event code 311 (BTN_TR)
> Event code 312 (BTN_TL2)
> Event code 313 (BTN_TR2)
> Event code 314 (BTN_SELECT)
> Event code 315 (BTN_START)
> Event code 316 (BTN_MODE)
> Event code 317 (BTN_THUMBL)
> Event code 318 (BTN_THUMBR)
> Event code 319 (?)
> Event code 704 (BTN_TRIGGER_HAPPY1)
> Event type 3 (EV_ABS)
> Event code 0 (ABS_X)
> Value 1800
> Min -1800
> Max 1800
> Fuzz 14
> Flat 225
> Event code 1 (ABS_Y)
> Value 0
> Min 0
> Max 1023
> Fuzz 3
> Flat 63
> Event code 2 (ABS_Z)
> Value 0
> Min 0
> Max 1023
> Fuzz 3
> Flat 63
> Event code 7 (ABS_RUDDER)
> Value 0
> Min 0
> Max 11
> Event code 8 (ABS_WHEEL)
> Value 0
> Min 0
> Max 11
> Event code 9 (ABS_GAS)
> Value 0
> Min 0
> Max 3
> Event code 16 (ABS_HAT0X)
> Value 0
> Min -1
> Max 1
> Event code 17 (ABS_HAT0Y)
> Value 0
> Min -1
> Max 1
> Event type 4 (EV_MSC)
> Event code 4 (MSC_SCAN)
> Properties:
> Testing ... (interrupt to exit)
> Event: time 1358662071.788346, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
> Event: time 1358662071.788346, -------------- SYN_REPORT ------------
> Event: time 1358662075.188293, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
> Event: time 1358662075.188293, -------------- SYN_REPORT ------------
> Event: time 1358662079.725606, type 3 (EV_ABS), code 9 (ABS_GAS), value 3
> Event: time 1358662079.725606, -------------- SYN_REPORT ------------
> Event: time 1358662084.757001, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
> Event: time 1358662084.757001, -------------- SYN_REPORT ------------
> Event: time 1358662087.388547, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
> Event: time 1358662087.388547, -------------- SYN_REPORT ------------
> Event: time 1358662089.477327, type 3 (EV_ABS), code 9 (ABS_GAS), value 0
> Event: time 1358662089.477327, -------------- SYN_REPORT ------------
> ^C
> --
>
> Can anyone else confirm this is a bug, or am I messing up some where?
> Simon.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* BUG: Joydev - Broken line compensation does not work for small range inputs
2013-01-22 4:48 ` simon
@ 2013-01-23 5:21 ` simon
2013-01-23 5:39 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: simon @ 2013-01-23 5:21 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov
[-- Attachment #1: Type: text/plain, Size: 2226 bytes --]
> With a little more digging on this I think the issue is down to the
> default calibration values.
I have further confirmation that this is due to the calibration used when
the dial is presented via the joystick interface. The values in the event
interface are correct.
See 'joydev_correct()' from 'driver/input/joydev.c'
The problem is that the 'broken line' calibration can not properly
represent/process a value with a small range - I guess this does not
matter when there is a large input range.
In my system I have a dial (RZ) with 4 positions (0..3):
expect to see -32768, -10922, +10922, +32768
actually see -32768, 0, 32768, 65536 (limited to 32768)
Anyone got suggestions?
Simon
--
More info:
jscal -s 8,
1,0, 0,0,298261,298261, // Wheel = -1800..1800
1,0, 511,511,1050628,1050628, // Throttle = 0..1023
1,0, 511,511,1050628,1050628, // Brake = 0..1023
1,0, 5,5,107374182,107374182, // RX = 0..12
1,0, 5,5,107374182,107374182, // RY = 0..12
1,0, 1,1,536870912,536870912, // RZ = 0..3
1,0, 0,0,536870912,536870912, // Hat = -1..1
1,0, 0,0,536870912,536870912 // Hat = -1..1
/dev/input/js0
from driver/input/joydev.c
--
case JS_CORR_BROKEN:
value = value > corr->coef[0] ? (value < corr->coef[1] ? 0 :
((corr->coef[3] * (value - corr->coef[1])) >> 14)) :
((corr->coef[2] * (value - corr->coef[0])) >> 14);
break;
--
case JS_CORR_BROKEN:
if (value > corr->coef[0]) {
if (value < corr->coef[1]) {
value = 0
} else {
value = ((corr->coef[3] * (value -
corr->coef[1])) >> 14)
}
} else {
value = ((corr->coef[2] * (value - corr->coef[0]))
>> 14)
}
break;
--
RZ = 0,1,2,3 :
expect to see -32768, -10922, +10922, +32768
actually see -32768, 0, 32768, 65536 (limited to 32768)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test.c --]
[-- Type: text/x-csrc; name="test.c", Size: 628 bytes --]
#include <stdlib.h>
#include <stdio.h>
int coef[] = { 1,1,536870912,536870912};
int compute(int value)
{
#if 1
value = value > coef[0] ? (value < coef[1] ? 0 :
((coef[3] * (value - coef[1])) >> 14)) :
((coef[2] * (value - coef[0])) >> 14);
#else
if (value > coef[0]) {
if (value < coef[1]) {
value = 0;
} else {
value = ((coef[3] * (value - coef[1])) >> 14);
}
} else {
value = ((coef[2] * (value - coef[0])) >> 14);
}
#endif
return value;
}
main()
{
printf("value = %d\n", compute(0));
printf("value = %d\n", compute(1));
printf("value = %d\n", compute(2));
printf("value = %d\n", compute(3));
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BUG: Joydev - Broken line compensation does not work for small range inputs
2013-01-23 5:21 ` BUG: Joydev - Broken line compensation does not work for small range inputs simon
@ 2013-01-23 5:39 ` Dmitry Torokhov
2013-01-23 17:06 ` simon
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2013-01-23 5:39 UTC (permalink / raw)
To: simon, linux-input
simon@mungewell.org wrote:
>> With a little more digging on this I think the issue is down to the
>> default calibration values.
>
>I have further confirmation that this is due to the calibration used
>when
>the dial is presented via the joystick interface. The values in the
>event
>interface are correct.
>
>See 'joydev_correct()' from 'driver/input/joydev.c'
>
>The problem is that the 'broken line' calibration can not properly
>represent/process a value with a small range - I guess this does not
>matter when there is a large input range.
>
>In my system I have a dial (RZ) with 4 positions (0..3):
> expect to see -32768, -10922, +10922, +32768
Hi Simon,
I think you should simply use evdev, joydev is legacy interface useful for real joysticks.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BUG: Joydev - Broken line compensation does not work for small range inputs
2013-01-23 5:39 ` Dmitry Torokhov
@ 2013-01-23 17:06 ` simon
0 siblings, 0 replies; 5+ messages in thread
From: simon @ 2013-01-23 17:06 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: simon, linux-input
>>The problem is that the 'broken line' calibration can not properly
>>represent/process a value with a small range - I guess this does not
>>matter when there is a large input range.
>>
>>In my system I have a dial (RZ) with 4 positions (0..3):
>> expect to see -32768, -10922, +10922, +32768
> Hi Simon,
>
> I think you should simply use evdev, joydev is legacy interface useful for
> real joysticks.
If the use of joydev is truely depricated then a "won't fix" is fine I
guess, but a lot of applications seem to use this...
As I noted you can disable the calibration with something like 'jscal -s
8,0,0,0,0,0...' in order to get 'raw' values via '/dev/input/js0'
interface - this might be sufficient for a user to make use of the
dial/etc.
Thanks,
Simon.
PS. The irony is that although SDL2.0 use the evdev interface, they show a
similar problem due to integer math in their calibration code/coefs... ho
hum off to patch I guess :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-23 17:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-20 6:24 Bug HID Dial - jstest and evtest see different number of clicks simon
2013-01-22 4:48 ` simon
2013-01-23 5:21 ` BUG: Joydev - Broken line compensation does not work for small range inputs simon
2013-01-23 5:39 ` Dmitry Torokhov
2013-01-23 17:06 ` simon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.