On Thu, Jan 25, 2018 at 11:49 AM, Jason Gerecke
wrote:
> Devices using the 2.6.30 wacom-specific multitouch protocol have to be
> careful to ensure that two contacts don't use the same axis value. This
> is because the second contact's value will be swallowed by the kernel.
> The 2.6.36 kernel replaced direct-access to the value with an accessor
> function (named "input_abs_get_val"), but our 2.6.30-compatible branch
> kept using direct access, though only for pre-2.6.35 kernels (off-by-one
> error on the version number).
>
> This commit introduces an "input_abs_get_val" function for pre-2.6.36
> kernels. This allows us to use the native API where available and
> fallback to direct access when not. It also means that the fixups are
> now applied to 2.6.35+ kernels.
>
Nice cleanup! Thank you.
>
> Signed-off-by: Jason Gerecke
>
Reviewed-by: Ping Cheng for the set.
Cheers,
Ping
---
> 2.6.30/wacom_wac.c | 26 ++
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
> index 72c5f65..90c5c2b 100644
> --- a/2.6.30/wacom_wac.c
> +++ b/2.6.30/wacom_wac.c
> @@ -909,6 +909,14 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
> return 0;
> }
>
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
> +static int input_abs_get_val(struct input_dev *input, unsigned int axis)
> +{
> + return input->abs[axis];
> +}
> +#endif
> +
> static void wacom_multitouch_generic_finger(struct wacom_wac *wacom,
> int contact_id, bool prox,
> int x, int y)
> @@ -928,14 +936,12 @@ static void wacom_multitouch_generic_finger(struct
> wacom_wac *wacom,
>
> wacom->slots[slot] = prox ? contact_id : -1;
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
> if (wacom->last_finger != slot) {
> - if (x == input->abs[ABS_X])
> + if (x == input_abs_get_val(input, ABS_X))
> x++;
> - if (y == input->abs[ABS_Y])
> + if (y == input_abs_get_val(input, ABS_Y))
> y++;
> }
> -#endif
>
> if (wacom->shared)
> prox = prox && !wacom->shared->stylus_in_proximity;
> @@ -1063,15 +1069,13 @@ static void wacom_tpc_finger_in(struct wacom_wac
> *wacom, unsigned char *data, in
> int x = le16_to_cpup((__le16 *)[finger * 2]) & 0x7fff;
> int y = le16_to_cpup((__le16 *)[4 + finger * 2]) & 0x7fff;
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
> if (wacom->last_finger != finger) {
> - if (x == input->abs[ABS_X])
> + if (x == input_abs_get_val(input, ABS_X))
> x++;
>
> - if (y == input->abs[ABS_Y])
> + if (y == input_abs_get_val(input, ABS_Y))
> y++;
> }
> -#endif
>
> input_report_abs(input, ABS_X, x);
> input_report_abs(input, ABS_Y, y);
> @@ -1217,15 +1221,13 @@ static void wacom_tpc_mt(struct wacom_wac *wacom)
> int x = get_unaligned_le16([offset +
> x_offset + 7]);
> int y = get_unaligned_le16([offset +
> x_offset + 9]);
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
> if (wacom->last_finger == id) {
> - if (x == input->abs[ABS_X])
> + if (x == input_abs_get_val(input,
> ABS_X))
> x++;
>
> - if (y == input->abs[ABS_Y])
> + if (y == input_abs_get_val(input,
> ABS_Y))
> y++;
> }
> -#endif
>
> wacom->id[slot+1] = touch;
> if (!wacom->id[1] && !wacom->id[2])
> --
> 2.16.0
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel