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


Groups > linux.kernel > #1356237 > unrolled thread

[PATCH] HID: multitouch: Release all touch slots on reset_resume

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2016-03-11 23:30 +0100
Last post2016-03-14 10:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] HID: multitouch: Release all touch slots on reset_resume Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-03-11 23:30 +0100
    Re: [PATCH] HID: multitouch: Release all touch slots on reset_resume Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-03-14 09:10 +0100
    Re: [PATCH] HID: multitouch: Release all touch slots on  reset_resume Jiri Kosina <jikos@kernel.org> - 2016-03-14 10:20 +0100

#1356237 — [PATCH] HID: multitouch: Release all touch slots on reset_resume

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-03-11 23:30 +0100
Subject[PATCH] HID: multitouch: Release all touch slots on reset_resume
Message-ID<rbDJg-4zW-11@gated-at.bofh.it>
From: Benson Leung <bleung@chromium.org>

When resetting a device (especially after power loss) it is unlikely
that the firmware will keep the contact tracking data for the previous
touches and will be able to reconcile it with the new contacts, so
let's release all slots on reset resume as start anew.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
---
 drivers/hid/hid-multitouch.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 6adb788..e24e33c 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1148,8 +1148,30 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 }
 
 #ifdef CONFIG_PM
+static void mt_release_contacts(struct hid_device *hid)
+{
+	struct hid_input *hidinput;
+
+	list_for_each_entry(hidinput, &hid->inputs, list) {
+		struct input_dev *input_dev = hidinput->input;
+		struct input_mt *mt = input_dev->mt;
+		int i;
+
+		if (mt) {
+			for (i = 0; i < mt->num_slots; i++) {
+				input_mt_slot(input_dev, i);
+				input_mt_report_slot_state(input_dev,
+							   MT_TOOL_FINGER,
+							   false);
+			}
+			input_sync(input_dev);
+		}
+	}
+}
+
 static int mt_reset_resume(struct hid_device *hdev)
 {
+	mt_release_contacts(hdev);
 	mt_set_maxcontacts(hdev);
 	mt_set_input_mode(hdev);
 	return 0;
-- 
2.7.0.rc3.207.g0ac5344


-- 
Dmitry

[toc] | [next] | [standalone]


#1357027

FromBenjamin Tissoires <benjamin.tissoires@redhat.com>
Date2016-03-14 09:10 +0100
Message-ID<rcvJE-17X-5@gated-at.bofh.it>
In reply to#1356237
On Mar 11 2016 or thereabouts, Dmitry Torokhov wrote:
> From: Benson Leung <bleung@chromium.org>
> 
> When resetting a device (especially after power loss) it is unlikely
> that the firmware will keep the contact tracking data for the previous
> touches and will be able to reconcile it with the new contacts, so
> let's release all slots on reset resume as start anew.
> 
> Signed-off-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
> ---

Seems good to me:

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

Cheers,
Benjamin

>  drivers/hid/hid-multitouch.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 6adb788..e24e33c 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -1148,8 +1148,30 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  }
>  
>  #ifdef CONFIG_PM
> +static void mt_release_contacts(struct hid_device *hid)
> +{
> +	struct hid_input *hidinput;
> +
> +	list_for_each_entry(hidinput, &hid->inputs, list) {
> +		struct input_dev *input_dev = hidinput->input;
> +		struct input_mt *mt = input_dev->mt;
> +		int i;
> +
> +		if (mt) {
> +			for (i = 0; i < mt->num_slots; i++) {
> +				input_mt_slot(input_dev, i);
> +				input_mt_report_slot_state(input_dev,
> +							   MT_TOOL_FINGER,
> +							   false);
> +			}
> +			input_sync(input_dev);
> +		}
> +	}
> +}
> +
>  static int mt_reset_resume(struct hid_device *hdev)
>  {
> +	mt_release_contacts(hdev);
>  	mt_set_maxcontacts(hdev);
>  	mt_set_input_mode(hdev);
>  	return 0;
> -- 
> 2.7.0.rc3.207.g0ac5344
> 
> 
> -- 
> Dmitry

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


#1357083 — Re: [PATCH] HID: multitouch: Release all touch slots on reset_resume

FromJiri Kosina <jikos@kernel.org>
Date2016-03-14 10:20 +0100
SubjectRe: [PATCH] HID: multitouch: Release all touch slots on reset_resume
Message-ID<rcwPo-1Mw-1@gated-at.bofh.it>
In reply to#1356237
On Fri, 11 Mar 2016, Dmitry Torokhov wrote:

> From: Benson Leung <bleung@chromium.org>
> 
> When resetting a device (especially after power loss) it is unlikely
> that the firmware will keep the contact tracking data for the previous
> touches and will be able to reconcile it with the new contacts, so
> let's release all slots on reset resume as start anew.
> 
> Signed-off-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Dmitry Torokhov <dtor@chromium.org>

Applied to for-4.6/multitouch.

-- 
Jiri Kosina
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web