[synaptics] Reset touch state on DeviceOff

Submitted by Peter Hutterer on April 24, 2012, 5:46 a.m.

Details

Message ID 20120424054650.GA1803@yabbi.bne.redhat.com
State Accepted
Commit 9ecf505c6473c65cd850a58b1b6eeb86f7d390e6
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer April 24, 2012, 5:46 a.m.
Don't leave touches lingering around during suspend.

Test case:
1) leave finger on touchpad
2) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
3) lift fingers
4) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1

https://bugzilla.redhat.com/show_bug.cgi?id=814972

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 src/eventcomm.c |    1 +
 src/synaptics.c |    1 +
 2 files changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 9d1233c..5707e38 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -128,6 +128,7 @@  UninitializeTouch(InputInfoPtr pInfo)
 
     mtdev_close(proto_data->mtdev);
     proto_data->mtdev = NULL;
+    proto_data->num_touches = 0;
 }
 
 static void
diff --git a/src/synaptics.c b/src/synaptics.c
index 853bfa8..d2fe960 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1086,6 +1086,7 @@  DeviceOff(DeviceIntPtr dev)
     if (pInfo->fd != -1) {
 	TimerCancel(priv->timer);
 	xf86RemoveEnabledDevice(pInfo);
+        SynapticsResetTouchHwState(priv->hwState);
         if (priv->proto_ops->DeviceOffHook &&
             !priv->proto_ops->DeviceOffHook(pInfo))
             rc = !Success;

Comments

On 04/23/2012 10:46 PM, Peter Hutterer wrote:
> Don't leave touches lingering around during suspend.
> 
> Test case:
> 1) leave finger on touchpad
> 2) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
> 3) lift fingers
> 4) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=814972
> 
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
>  src/eventcomm.c |    1 +
>  src/synaptics.c |    1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/src/eventcomm.c b/src/eventcomm.c
> index 9d1233c..5707e38 100644
> --- a/src/eventcomm.c
> +++ b/src/eventcomm.c
> @@ -128,6 +128,7 @@ UninitializeTouch(InputInfoPtr pInfo)
>  
>      mtdev_close(proto_data->mtdev);
>      proto_data->mtdev = NULL;
> +    proto_data->num_touches = 0;
>  }
>  
>  static void
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 853bfa8..d2fe960 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -1086,6 +1086,7 @@ DeviceOff(DeviceIntPtr dev)
>      if (pInfo->fd != -1) {
>  	TimerCancel(priv->timer);
>  	xf86RemoveEnabledDevice(pInfo);
> +        SynapticsResetTouchHwState(priv->hwState);
>          if (priv->proto_ops->DeviceOffHook &&
>              !priv->proto_ops->DeviceOffHook(pInfo))
>              rc = !Success;

Makes sense to me, and I hope that it fixes
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/968845
too.

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>