]> git.baikalelectronics.ru Git - kernel.git/commit
HID: hid-lg4ff: Adjust X axis input value accordingly to selected range.
authorMichal Malý <madcatxster@gmail.com>
Sun, 23 Sep 2012 20:41:08 +0000 (22:41 +0200)
committerJiri Kosina <jkosina@suse.cz>
Tue, 25 Sep 2012 13:41:02 +0000 (15:41 +0200)
commit1b0929a49b902b12caae5d3ad08e3c2400478cf6
treecf01b767eee96bd9d178a43d8c694cafeb287b3c
parent2ec77f3c2382da5b8a6655cf9eb1083a035d15c6
HID: hid-lg4ff: Adjust X axis input value accordingly to selected range.

Range limiting command for the Driving Force Pro wheel is only a FF_SPRING
effect so that the wheel creates resistance when the user tries to turn it past
the limit. It is however possible to overpower the FFB motors quite easily which
leads to the X axis value exceeding the expected limit. This confuses
games which dynamically adjust calibration using the highest/lowest min and max
values reported by the wheel. Joydev device driver also doesn't take in account
any changes in an axis range after the joystick device is created.

This patch recalculates received ABS_X axis value so it is always in
<0; 16383> range where 0 is the left limit and 16383 the right limit.
Logitech driver for Windows does the same thing.  As for any concerns about
possible loss of precision, I compared a large set of raw/adjusted values
generated by "mult_frac" to values returned by the Windows driver and I got
a 100% match.

Other Logitech wheels will probably need a similar fix, but I currently lack
the information needed to write one.

Signed-off-by: Michal Malý <madcatxster@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-lg.c
drivers/hid/hid-lg.h
drivers/hid/hid-lg4ff.c