The "Steering" usage (HID_UP_SIMULATION | 0xc8) is defined in HUT 1.12 as
follows:

"A steering wheel is a single degree-of-freedom device that rotates about
an axis. The zero position is always the neutral or 'straight ahead'
position, with positive values turning clockwise and negative values
turning counterclockwise. If the Coordinate Values Wrap attribute is
set, the steering wheel can be turned past 360 degrees."

The hidinput_configure_usage function canonically maps this usage to the
ABS_WHEEL axis, but hidinput_calc_abs_res does not recognize this axis
as one for which it can calculate a resolution. This effectively prevents
wheels from being assigned a proper resolution that userspace can use
to determine the precise angle of input.

This commit adds ABS_WHEEL as a rotational axis to hidinput_calc_abs_res.

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com>
[jason.gere...@wacom.com: Imported into input-wacom repository (c0bf574)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
[jason.gere...@wacom.com: backported from input-wacom repository (8975a0a)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>

IMPORT NOTE: This patch allows us to calculate a resolution for the
ABS_WHEEL axis that pad devices use for touchring information. While we
can't modify hid.h directly, we can achieve the same effect by modifying
wacom_map_usage to pass a fake resolution_code for this axis, just like
we do for pen rotation.
---
 3.17/wacom_wac.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index a4543a2..7e1fa12 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1491,7 +1491,12 @@ static void wacom_map_usage(struct input_dev *input, 
struct hid_usage *usage,
        unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
        int resolution_code = code;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
        if (equivalent_usage == HID_DG_TWIST) {
+#else
+       if (equivalent_usage == HID_DG_TWIST ||
+           equivalent_usage == WACOM_HID_WD_TOUCHRING) {
+#endif
                resolution_code = ABS_RZ;
        }
 
-- 
2.10.2


------------------------------------------------------------------------------
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to