Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685217 > unrolled thread

[PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2017-07-11 19:10 +0200
Last post2017-07-13 17:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-07-11 19:10 +0200
    Re: [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-07-12 09:40 +0200
    Re: [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS  bits Jiri Kosina <jikos@kernel.org> - 2017-07-13 17:00 +0200

#1685217 — [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-07-11 19:10 +0200
Subject[PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits
Message-ID<u26PE-56j-21@gated-at.bofh.it>
Now that input core insists on having dev->absinfo when device claims to
generate EV_ABS in its dev->evbit, we should not be blindly setting that
bit.

The code in question might have been needed before input_set_abs_params()
started setting EV_ABS in device's evbit, but not anymore, and is now
breaking devices such as SMART SPNL-6075 Touchscreen.

Fixes: 6ecfe51b4082 ("Input: refuse to register absolute devices ...")
Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
Tested-by: Matthias Fend <Matthias.Fend@wolfvision.net>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

Jiri, Benjamin, I marked it for stable as it causes regressions in 4.12
reported by users. Please take a look.

 drivers/hid/hid-multitouch.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 24d5b6deb571..be5bea15ce52 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -595,16 +595,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	return 0;
 }
 
-static int mt_touch_input_mapped(struct hid_device *hdev, struct hid_input *hi,
-		struct hid_field *field, struct hid_usage *usage,
-		unsigned long **bit, int *max)
-{
-	if (usage->type == EV_KEY || usage->type == EV_ABS)
-		set_bit(usage->type, hi->input->evbit);
-
-	return -1;
-}
-
 static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
 {
 	__s32 quirks = td->mtclass.quirks;
@@ -905,8 +895,10 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
 		return 0;
 
 	if (field->application == HID_DG_TOUCHSCREEN ||
-	    field->application == HID_DG_TOUCHPAD)
-		return mt_touch_input_mapped(hdev, hi, field, usage, bit, max);
+	    field->application == HID_DG_TOUCHPAD) {
+		/* We own these mappings, tell hid-input to ignore them */
+		return -1;
+	}
 
 	/* let hid-core decide for the others */
 	return 0;
-- 
2.13.2.725.g09c95d1e9-goog


-- 
Dmitry

[toc] | [next] | [standalone]


#1685573

FromBenjamin Tissoires <benjamin.tissoires@redhat.com>
Date2017-07-12 09:40 +0200
Message-ID<u2kpA-5f6-27@gated-at.bofh.it>
In reply to#1685217
On Jul 11 2017 or thereabouts, Dmitry Torokhov wrote:
> Now that input core insists on having dev->absinfo when device claims to
> generate EV_ABS in its dev->evbit, we should not be blindly setting that
> bit.
> 
> The code in question might have been needed before input_set_abs_params()
> started setting EV_ABS in device's evbit, but not anymore, and is now
> breaking devices such as SMART SPNL-6075 Touchscreen.
> 
> Fixes: 6ecfe51b4082 ("Input: refuse to register absolute devices ...")
> Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
> Tested-by: Matthias Fend <Matthias.Fend@wolfvision.net>
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
> Jiri, Benjamin, I marked it for stable as it causes regressions in 4.12
> reported by users. Please take a look.

set_bit(usage->type, input->evbit); is called by hid-input.c when the
return code is positive, so we should be safe here.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> 
>  drivers/hid/hid-multitouch.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 24d5b6deb571..be5bea15ce52 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -595,16 +595,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
>  	return 0;
>  }
>  
> -static int mt_touch_input_mapped(struct hid_device *hdev, struct hid_input *hi,
> -		struct hid_field *field, struct hid_usage *usage,
> -		unsigned long **bit, int *max)
> -{
> -	if (usage->type == EV_KEY || usage->type == EV_ABS)
> -		set_bit(usage->type, hi->input->evbit);
> -
> -	return -1;
> -}
> -
>  static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
>  {
>  	__s32 quirks = td->mtclass.quirks;
> @@ -905,8 +895,10 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
>  		return 0;
>  
>  	if (field->application == HID_DG_TOUCHSCREEN ||
> -	    field->application == HID_DG_TOUCHPAD)
> -		return mt_touch_input_mapped(hdev, hi, field, usage, bit, max);
> +	    field->application == HID_DG_TOUCHPAD) {
> +		/* We own these mappings, tell hid-input to ignore them */
> +		return -1;
> +	}
>  
>  	/* let hid-core decide for the others */
>  	return 0;
> -- 
> 2.13.2.725.g09c95d1e9-goog
> 
> 
> -- 
> Dmitry

[toc] | [prev] | [next] | [standalone]


#1686597 — Re: [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits

FromJiri Kosina <jikos@kernel.org>
Date2017-07-13 17:00 +0200
SubjectRe: [PATCH] HID: multitouch: do not blindly set EV_KEY or EV_ABS bits
Message-ID<u2NKW-6Wd-7@gated-at.bofh.it>
In reply to#1685217
On Tue, 11 Jul 2017, Dmitry Torokhov wrote:

> Now that input core insists on having dev->absinfo when device claims to
> generate EV_ABS in its dev->evbit, we should not be blindly setting that
> bit.
> 
> The code in question might have been needed before input_set_abs_params()
> started setting EV_ABS in device's evbit, but not anymore, and is now
> breaking devices such as SMART SPNL-6075 Touchscreen.
> 
> Fixes: 6ecfe51b4082 ("Input: refuse to register absolute devices ...")
> Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
> Tested-by: Matthias Fend <Matthias.Fend@wolfvision.net>
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
> Jiri, Benjamin, I marked it for stable as it causes regressions in 4.12
> reported by users. Please take a look.

Thanks for a quick fix, Dmitry. Queued in for-4.13/upstream-fixes branch.

-- 
Jiri Kosina
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web