BUG: Joydev - Broken line compensation does not work for small range inputs
From: <hidden>
Date: 2013-01-23 05:22:00
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]))quoted
14)
}
break;
--
RZ = 0,1,2,3 :
expect to see -32768, -10922, +10922, +32768
actually see -32768, 0, 32768, 65536 (limited to 32768)