Re: always reset mt state in wsmouse_mt_init

2016-07-12 Thread Mark Kettenis
> From: Ulf Brosziewski 
> Date: Tue, 12 Jul 2016 23:17:34 +0200
> 
> It seems that if an MT device is disabled and reenabled,
> remnants of the previous MT state can lead to problems.
> wsmouse_mt_init should always reset that state completely
> (thanks to jcs@ for help).
> 
> OK?

Makes sense to me.

> Index: dev/wscons/wsmouse.c
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 wsmouse.c
> --- dev/wscons/wsmouse.c  5 Jul 2016 19:33:14 -   1.31
> +++ dev/wscons/wsmouse.c  12 Jul 2016 21:01:17 -
> @@ -1266,11 +1266,8 @@ wsmouse_mt_init(struct device *sc, int n
>   &((struct wsmouse_softc *) sc)->input;
>   int n, size;
>  
> - if (num_slots == input->mt.num_slots
> - && (!tracking == ((input->flags & MT_TRACKING) == 0)))
> - return (0);
> -
>   free_mt_slots(input);
> + memset(>mt, 0, sizeof(struct mt_state));
>  
>   if (tracking)
>   input->flags |= MT_TRACKING;
> 
> 



always reset mt state in wsmouse_mt_init

2016-07-12 Thread Ulf Brosziewski
It seems that if an MT device is disabled and reenabled,
remnants of the previous MT state can lead to problems.
wsmouse_mt_init should always reset that state completely
(thanks to jcs@ for help).

OK?


Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.31
diff -u -p -r1.31 wsmouse.c
--- dev/wscons/wsmouse.c5 Jul 2016 19:33:14 -   1.31
+++ dev/wscons/wsmouse.c12 Jul 2016 21:01:17 -
@@ -1266,11 +1266,8 @@ wsmouse_mt_init(struct device *sc, int n
&((struct wsmouse_softc *) sc)->input;
int n, size;
 
-   if (num_slots == input->mt.num_slots
-   && (!tracking == ((input->flags & MT_TRACKING) == 0)))
-   return (0);
-
free_mt_slots(input);
+   memset(>mt, 0, sizeof(struct mt_state));
 
if (tracking)
input->flags |= MT_TRACKING;