Re: fix for ClickPad

2012-07-10 Thread Gilles Chehade
For what it's worth, this fixes the issue on my laptop.
I still can't highlight a portion of a line, but at least I can copy / paste a 
word now \o/

Thanks a *LOT* as it was plenty annoying

Gilles

On Wed, Jul 11, 2012 at 12:53:00AM +0600, Alexandr Shadchin wrote:
> Now in clickpad mode the pointer moves to [1,1] (upper left corner)
> even on a single tap. These patches fixes it.
> 
> On issue pointed gilles@ and matthieu@
> 
> * cd /sys
> * patch < 01_kernel.diff
> * build and install new kernel
> * cd /usr/src
> * (if need - make obj)
> * make includes
> * cd /usr/xenocara/driver/xf86-input-synaptics
> * patch < 02_xenocara.diff
> * make -f Makefile.bsd-wrapper obj build
> * reboot and test
> 
> Also need check on other touchpad.
> 
> Comments ? OK ?
> 
> -- 
> Alexandr Shadchin
> Index: dev/pckbc/pms.c
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 pms.c
> --- dev/pckbc/pms.c   1 Jul 2012 12:59:34 -   1.30
> +++ dev/pckbc/pms.c   10 Jul 2012 18:17:14 -
> @@ -782,6 +782,9 @@ int
>  synaptics_get_hwinfo(struct pms_softc *sc)
>  {
>   struct synaptics_softc *syn = sc->synaptics;
> +#ifdef DEBUG
> + int i, val;
> +#endif
>  
>   if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify))
>   return (-1);
> @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s
>   if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8)
>   syn->ext_model &= ~0xf000;
>  
> +#ifdef DEBUG
> + for (i = 0; i < 16; i++) {
> + if (synaptics_query(sc, i, &val))
> + printf("%s: querie %2d: fail\n", DEVNAME(sc), i);
> + else
> + printf("%s: querie %2d: 0x%06x\n", DEVNAME(sc), i, val);
> + }
> +#endif
> +
>   return (0);
>  }
>  
> @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc)
>   if (syn->wsmode == WSMOUSE_NATIVE) {
>   wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
>   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> + WSMOUSE_INPUT_SYNC);
>   } else {
>   dx = dy = 0;
>   if (z > SYNAPTICS_PRESSURE) {
> @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc)
>  
>   wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
>   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> + WSMOUSE_INPUT_SYNC);
>  
>   alps->old_fin = fin;
>   } else {
> Index: dev/wscons/wsconsio.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.65
> diff -u -p -r1.65 wsconsio.h
> --- dev/wscons/wsconsio.h 17 Apr 2012 08:51:24 -  1.65
> +++ dev/wscons/wsconsio.h 10 Jul 2012 18:17:14 -
> @@ -80,6 +80,7 @@ struct wscons_event {
>/* 12-15, see below */
>  #define  WSCONS_EVENT_MOUSE_DELTA_W  16  /* W delta amount */
>  #define  WSCONS_EVENT_MOUSE_ABSOLUTE_W   17  /* W location */
> +#define  WSCONS_EVENT_SYNC   18
>  /* 
>   * Following events are not real wscons_event but are used as parameters of 
> the
>   * WSDISPLAYIO_WSMOUSED ioctl 
> Index: dev/wscons/wsmouse.c
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 wsmouse.c
> --- dev/wscons/wsmouse.c  17 Aug 2011 16:10:27 -  1.22
> +++ dev/wscons/wsmouse.c  10 Jul 2012 18:17:14 -
> @@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev,
>   ub ^= d;
>   }
>  
> + if (flags & WSMOUSE_INPUT_SYNC) {
> + NEXT;
> + ev->type = WSCONS_EVENT_SYNC;
> + ev->value = 0;
> + TIMESTAMP;
> + ADVANCE;
> + }
> +
>   /* XXX fake wscons_event notifying wsmoused(8) to close mouse device */
>   if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) {
>   NEXT;
> Index: dev/wscons/wsmousevar.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
> retrieving revision 1.5
> diff -u -p -r1.5 wsmousevar.h
> --- dev/wscons/wsmousevar.h   10 Apr 2007 22:37:17 -  1.5
> +++ dev/wscons/wsmousevar.h   10 Jul 2012 18:17:14 -
> @@ -72,6 +72,7 @@ int wsmousedevprint(void *, const char *
>  #define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1)
>  #define WSMOUSE_INPUT_ABSOLUTE_Z (1<<2)
>  #define WSMOUSE_INPUT_ABSOLUTE_W (1<<4)
> +#define WSMOUSE_INPUT

Re: fix for ClickPad

2012-07-11 Thread Matthieu Herrb
On Wed, Jul 11, 2012 at 12:53:00AM +0600, Alexandr Shadchin wrote:
> Now in clickpad mode the pointer moves to [1,1] (upper left corner)
> even on a single tap. These patches fixes it.
> 
> On issue pointed gilles@ and matthieu@
> 
> * cd /sys
> * patch < 01_kernel.diff
> * build and install new kernel
> * cd /usr/src
> * (if need - make obj)
> * make includes
> * cd /usr/xenocara/driver/xf86-input-synaptics
> * patch < 02_xenocara.diff
> * make -f Makefile.bsd-wrapper obj build
> * reboot and test
> 
> Also need check on other touchpad.
> 
> Comments ? OK ?
> 

Fixes the issue here too (Thinkpad X200). Not yet tested on other
touchpads I have. 
ok for the X part A few comments inline on the kernel part. 

(and of course you need to commit the kernel part first).

> -- 
> Alexandr Shadchin
> 

> Index: dev/pckbc/pms.c
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 pms.c
> --- dev/pckbc/pms.c   1 Jul 2012 12:59:34 -   1.30
> +++ dev/pckbc/pms.c   10 Jul 2012 18:17:14 -
> @@ -782,6 +782,9 @@ int
>  synaptics_get_hwinfo(struct pms_softc *sc)
>  {
>   struct synaptics_softc *syn = sc->synaptics;
> +#ifdef DEBUG
> + int i, val;
> +#endif
>  
>   if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify))
>   return (-1);
> @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s
>   if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8)
>   syn->ext_model &= ~0xf000;
>  
> +#ifdef DEBUG
> + for (i = 0; i < 16; i++) {
> + if (synaptics_query(sc, i, &val))
> + printf("%s: querie %2d: fail\n", DEVNAME(sc), i);
> + else
> + printf("%s: querie %2d: 0x%06x\n",
> DEVNAME(sc), i, val);

> + }
> +#endif
'querie' is not correct. use "query" or drop the #ifdef DEBUG part
completely. 

> +
>   return (0);
>  }
>  
> @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc)
>   if (syn->wsmode == WSMOUSE_NATIVE) {
>   wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
>   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> + WSMOUSE_INPUT_SYNC);
>   } else {
>   dx = dy = 0;
>   if (z > SYNAPTICS_PRESSURE) {
> @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc)
>  
>   wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
>   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> + WSMOUSE_INPUT_SYNC);
>  
>   alps->old_fin = fin;
>   } else {
> Index: dev/wscons/wsconsio.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.65
> diff -u -p -r1.65 wsconsio.h
> --- dev/wscons/wsconsio.h 17 Apr 2012 08:51:24 -  1.65
> +++ dev/wscons/wsconsio.h 10 Jul 2012 18:17:14 -
> @@ -80,6 +80,7 @@ struct wscons_event {
>/* 12-15, see below */
>  #define  WSCONS_EVENT_MOUSE_DELTA_W  16  /* W delta amount */
>  #define  WSCONS_EVENT_MOUSE_ABSOLUTE_W   17  /* W location */
> +#define  WSCONS_EVENT_SYNC   18
>  /* 
>   * Following events are not real wscons_event but are used as parameters of 
> the
>   * WSDISPLAYIO_WSMOUSED ioctl 
> Index: dev/wscons/wsmouse.c
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 wsmouse.c
> --- dev/wscons/wsmouse.c  17 Aug 2011 16:10:27 -  1.22
> +++ dev/wscons/wsmouse.c  10 Jul 2012 18:17:14 -
> @@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev,
>   ub ^= d;
>   }
>  
> + if (flags & WSMOUSE_INPUT_SYNC) {
> + NEXT;
> + ev->type = WSCONS_EVENT_SYNC;
> + ev->value = 0;
> + TIMESTAMP;
> + ADVANCE;
> + }
> +
>   /* XXX fake wscons_event notifying wsmoused(8) to close mouse device */
>   if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) {
>   NEXT;
> Index: dev/wscons/wsmousevar.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
> retrieving revision 1.5
> diff -u -p -r1.5 wsmousevar.h
> --- dev/wscons/wsmousevar.h   10 Apr 2007 22:37:17 -  1.5
> +++ dev/wscons/wsmousevar.h   10 Jul 2012 18:17:14 -
> @@ -72,6 +72,7 @@ int wsmousedevprint(void *, const char *
>  #define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1)
>  #define WSMOUSE_INPU

Re: fix for ClickPad

2012-07-11 Thread Alexandr Shadchin
On Wed, Jul 11, 2012 at 05:51:53PM +0200, Matthieu Herrb wrote:
> On Wed, Jul 11, 2012 at 12:53:00AM +0600, Alexandr Shadchin wrote:
> > Now in clickpad mode the pointer moves to [1,1] (upper left corner)
> > even on a single tap. These patches fixes it.
> > 
> > On issue pointed gilles@ and matthieu@
> > 
> > * cd /sys
> > * patch < 01_kernel.diff
> > * build and install new kernel
> > * cd /usr/src
> > * (if need - make obj)
> > * make includes
> > * cd /usr/xenocara/driver/xf86-input-synaptics
> > * patch < 02_xenocara.diff
> > * make -f Makefile.bsd-wrapper obj build
> > * reboot and test
> > 
> > Also need check on other touchpad.
> > 
> > Comments ? OK ?
> > 
> 
> Fixes the issue here too (Thinkpad X200). Not yet tested on other
> touchpads I have. 
> ok for the X part A few comments inline on the kernel part. 
> 
> (and of course you need to commit the kernel part first).
> 
> > -- 
> > Alexandr Shadchin
> > 
> 
> > Index: dev/pckbc/pms.c
> > ===
> > RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> > retrieving revision 1.30
> > diff -u -p -r1.30 pms.c
> > --- dev/pckbc/pms.c 1 Jul 2012 12:59:34 -   1.30
> > +++ dev/pckbc/pms.c 10 Jul 2012 18:17:14 -
> > @@ -782,6 +782,9 @@ int
> >  synaptics_get_hwinfo(struct pms_softc *sc)
> >  {
> > struct synaptics_softc *syn = sc->synaptics;
> > +#ifdef DEBUG
> > +   int i, val;
> > +#endif
> >  
> > if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify))
> > return (-1);
> > @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s
> > if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8)
> > syn->ext_model &= ~0xf000;
> >  
> > +#ifdef DEBUG
> > +   for (i = 0; i < 16; i++) {
> > +   if (synaptics_query(sc, i, &val))
> > +   printf("%s: querie %2d: fail\n", DEVNAME(sc), i);
> > +   else
> > +   printf("%s: querie %2d: 0x%06x\n",
> > DEVNAME(sc), i, val);
> 
> > +   }
> > +#endif
> 'querie' is not correct. use "query" or drop the #ifdef DEBUG part
> completely. 
> 
> > +
> > return (0);
> >  }
> >  
> > @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc)
> > if (syn->wsmode == WSMOUSE_NATIVE) {
> > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> > +   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> > +   WSMOUSE_INPUT_SYNC);
> > } else {
> > dx = dy = 0;
> > if (z > SYNAPTICS_PRESSURE) {
> > @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc)
> >  
> > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> > +   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> > +   WSMOUSE_INPUT_SYNC);
> >  
> > alps->old_fin = fin;
> > } else {
> > Index: dev/wscons/wsconsio.h
> > ===
> > RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> > retrieving revision 1.65
> > diff -u -p -r1.65 wsconsio.h
> > --- dev/wscons/wsconsio.h   17 Apr 2012 08:51:24 -  1.65
> > +++ dev/wscons/wsconsio.h   10 Jul 2012 18:17:14 -
> > @@ -80,6 +80,7 @@ struct wscons_event {
> >  /* 12-15, see below */
> >  #defineWSCONS_EVENT_MOUSE_DELTA_W  16  /* W delta amount */
> >  #defineWSCONS_EVENT_MOUSE_ABSOLUTE_W   17  /* W location */
> > +#defineWSCONS_EVENT_SYNC   18
> >  /* 
> >   * Following events are not real wscons_event but are used as parameters 
> > of the
> >   * WSDISPLAYIO_WSMOUSED ioctl 
> > Index: dev/wscons/wsmouse.c
> > ===
> > RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 wsmouse.c
> > --- dev/wscons/wsmouse.c17 Aug 2011 16:10:27 -  1.22
> > +++ dev/wscons/wsmouse.c10 Jul 2012 18:17:14 -
> > @@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev,
> > ub ^= d;
> > }
> >  
> > +   if (flags & WSMOUSE_INPUT_SYNC) {
> > +   NEXT;
> > +   ev->type = WSCONS_EVENT_SYNC;
> > +   ev->value = 0;
> > +   TIMESTAMP;
> > +   ADVANCE;
> > +   }
> > +
> > /* XXX fake wscons_event notifying wsmoused(8) to close mouse device */
> > if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) {
> > NEXT;
> > Index: dev/wscons/wsmousevar.h
> > ===
> > RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
> > retrieving revision 1.5
> > diff -u -p -r1.5 wsmousevar.h
> > --- dev/wscons/wsmousevar.

Re: fix for ClickPad

2012-07-22 Thread Theo de Raadt
You want this in now... and it has been tested on how many machines
to see if any new regressions show up?

Come on guys.  Don't have me OK this.  Instead, have me OK it based on
saying something like "This must go in".  You take the risk.  I don't
want to.



Re: fix for ClickPad

2012-07-22 Thread Matthieu Herrb
On Sun, Jul 22, 2012 at 10:38:50AM -0600, Theo de Raadt wrote:
> You want this in now... and it has been tested on how many machines
> to see if any new regressions show up?
> 
> Come on guys.  Don't have me OK this.  Instead, have me OK it based on
> saying something like "This must go in".  You take the risk.  I don't
> want to.

looking closer at my mail history, the patch is not as important as I
believed it was. (I thought it was part of the fix for all ALPS
touchpads that was discussend and committed while I was busy with work
and not looking too closely at patches, but this part has been
committed separatly).

Anyways, It fixes issues seen on synaptics clickpads (as found on the
X220 for example) for at least gilles@ and me. Other people with
clickpads have often de-activated them in the BIOS because of these
issues. Having that working in 5.2 would have been nice.

I've tested that patch on all my machines with pms (X40, X220,
toshiba, msi, samsung laptops, plus one desktop with a regular ps/2
mouse), but I it doesn't count. So it can wait after release, since
your comments seem to indicate that is this your preference.

Alexandr, just don't forget about it... 


-- 
Matthieu Herrb