Re: stop using WSMOUSE_TYPE_ELANTECH in other drivers (xenocara)

2018-07-29 Thread Ulf Brosziewski
It's still possible to use synaptics as alternative to ws.  The
new type would break such a configuration for ubcmtp, iatp, and
hidmt.  I think as long as it doesn't take too much efforts, we
should keep synaptics up to date and add the diff below to this
one.  However, I don't insist on that, so

ok bru@ (either way)


On 07/27/2018 10:00 PM, joshua stein wrote:
> And here is the xenocara part.
> 
> Index: xserver/config/wscons.c
> ===
> RCS file: /cvs/xenocara/xserver/config/wscons.c,v
> retrieving revision 1.21
> diff -u -p -u -p -r1.21 wscons.c
> --- xserver/config/wscons.c   8 Dec 2017 15:02:00 -   1.21
> +++ xserver/config/wscons.c   27 Jul 2018 19:54:17 -
> @@ -239,6 +239,7 @@ wscons_add_pointers(void)
>case WSMOUSE_TYPE_ALPS:
>case WSMOUSE_TYPE_ELANTECH:
>case WSMOUSE_TYPE_SYNAP_SBTN:
> +  case WSMOUSE_TYPE_TOUCHPAD:
>  wscons_add_pointer(devnam, "ws",
> ATTR_TOUCHPAD);
>  break;
> 
> 

Index: driver/xf86-input-synaptics/src/wsconscomm.c
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v
retrieving revision 1.17
diff -u -p -r1.17 wsconscomm.c
--- driver/xf86-input-synaptics/src/wsconscomm.c7 Mar 2017 19:07:56 
-   1.17
+++ driver/xf86-input-synaptics/src/wsconscomm.c29 Jul 2018 12:25:48 
-
@@ -71,7 +71,8 @@ WSConsIsTouchpad(InputInfoPtr pInfo, con
 if (wsmouse_type == WSMOUSE_TYPE_SYNAPTICS ||
 wsmouse_type == WSMOUSE_TYPE_SYNAP_SBTN ||
 wsmouse_type == WSMOUSE_TYPE_ALPS ||
-wsmouse_type == WSMOUSE_TYPE_ELANTECH)
+wsmouse_type == WSMOUSE_TYPE_ELANTECH ||
+wsmouse_type == WSMOUSE_TYPE_TOUCHPAD)
 rc = TRUE;

 out:
@@ -357,6 +358,8 @@ WSConsReadDevDimensions(InputInfoPtr pIn
 priv->has_double = FALSE;
 priv->has_triple = FALSE;
 break;
+case WSMOUSE_TYPE_TOUCHPAD:
+/* Use Elantech settings for the generic type. */
 case WSMOUSE_TYPE_ELANTECH:
 priv->model = MODEL_ELANTECH;
 priv->has_width = TRUE;



Re: stop using WSMOUSE_TYPE_ELANTECH in other drivers

2018-07-29 Thread Ulf Brosziewski
ok bru@ (but please see my comments on the second diff)

On 07/27/2018 09:59 PM, joshua stein wrote:
> Back when touchpad drivers were using the synaptics Xorg driver, 
> they had to pretend to be Elantech devices in order to get 
> particular packet processing.
> 
> Since Ulf switched us to wstpad and xf86-input-ws a while ago, these 
> drivers can stop claiming to be WSMOUSE_TYPE_ELANTECH devices and 
> use a common WSMOUSE_TYPE_TOUCHPAD.
> 
> This also makes the WSMOUSEIO_GTYPE ioctl in those drivers respond 
> with whatever is stored in the softc to avoid repeating ourselves 
> (or possibly responding incorrectly).
> 
> There's also a corresponding xenocara diff coming after this.
> 
> 
> Index: sys/dev/hid/hidmt.c
> ===
> RCS file: /cvs/src/sys/dev/hid/hidmt.c,v
> retrieving revision 1.6
> diff -u -p -u -p -r1.6 hidmt.c
> --- sys/dev/hid/hidmt.c   10 Oct 2017 20:31:50 -  1.6
> +++ sys/dev/hid/hidmt.c   27 Jul 2018 19:53:59 -
> @@ -235,7 +235,7 @@ hidmt_configure(struct hidmt *mt)
>   return;
>  
>   hw = wsmouse_get_hw(mt->sc_wsmousedev);
> - hw->type = WSMOUSE_TYPE_ELANTECH;   /* see hidmt_ioctl */
> + hw->type = WSMOUSE_TYPE_TOUCHPAD;
>   hw->hw_type = (mt->sc_clickpad
>   ? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
>   hw->x_min = mt->sc_minx;
> @@ -468,13 +468,11 @@ hidmt_ioctl(struct hidmt *mt, u_long cmd
>   int wsmode;
>  
>   switch (cmd) {
> - case WSMOUSEIO_GTYPE:
> - /*
> -  * So we can specify our own finger/w values to the
> -  * xf86-input-synaptics driver like pms(4)
> -  */
> - *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
> + case WSMOUSEIO_GTYPE: {
> + struct wsmousehw *hw = wsmouse_get_hw(mt->sc_wsmousedev);
> + *(u_int *)data = hw->type;
>   break;
> + }
>  
>   case WSMOUSEIO_GCALIBCOORDS:
>   wsmc->minx = mt->sc_minx;
> Index: sys/dev/i2c/iatp.c
> ===
> RCS file: /cvs/src/sys/dev/i2c/iatp.c,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 iatp.c
> --- sys/dev/i2c/iatp.c22 Jun 2018 15:58:26 -  1.5
> +++ sys/dev/i2c/iatp.c27 Jul 2018 19:53:59 -
> @@ -325,7 +325,7 @@ iatp_configure(struct iatp_softc *sc)
>  
>   hw = wsmouse_get_hw(sc->sc_wsmousedev);
>   if (sc->sc_touchpad) {
> - hw->type = WSMOUSE_TYPE_SYNAPTICS;
> + hw->type = WSMOUSE_TYPE_TOUCHPAD;
>   hw->hw_type = WSMOUSEHW_CLICKPAD;
>   } else {
>   hw->type = WSMOUSE_TYPE_TPANEL;
> @@ -415,12 +415,11 @@ iatp_ioctl(void *v, u_long cmd, caddr_t 
>   wsmc->resy = sc->sc_tsscale.resy;
>   break;
>  
> - case WSMOUSEIO_GTYPE:
> - if (sc->sc_touchpad)
> - *(u_int *)data = WSMOUSE_TYPE_SYNAPTICS;
> - else
> - *(u_int *)data = WSMOUSE_TYPE_TPANEL;
> + case WSMOUSEIO_GTYPE: {
> + struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
> + *(u_int *)data = hw->type;
>   break;
> + }
>  
>   case WSMOUSEIO_SETMODE:
>   if (!sc->sc_touchpad)
> Index: sys/dev/usb/ubcmtp.c
> ===
> RCS file: /cvs/src/sys/dev/usb/ubcmtp.c,v
> retrieving revision 1.17
> diff -u -p -u -p -r1.17 ubcmtp.c
> --- sys/dev/usb/ubcmtp.c  6 Jun 2017 21:53:07 -   1.17
> +++ sys/dev/usb/ubcmtp.c  27 Jul 2018 19:53:59 -
> @@ -521,7 +521,7 @@ ubcmtp_configure(struct ubcmtp_softc *sc
>  {
>   struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
>  
> - hw->type = WSMOUSE_TYPE_ELANTECH;   /* see ubcmtp_ioctl */
> + hw->type = WSMOUSE_TYPE_TOUCHPAD;
>   hw->hw_type = (IS_CLICKPAD(sc->dev_type->type)
>   ? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
>   hw->x_min = sc->dev_type->l_x.min;
> @@ -601,11 +601,11 @@ ubcmtp_ioctl(void *v, unsigned long cmd,
>   cmd);
>  
>   switch (cmd) {
> - case WSMOUSEIO_GTYPE:
> - /* so we can specify our own finger/w values to the
> -  * xf86-input-synaptics driver like pms(4) */
> - *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
> + case WSMOUSEIO_GTYPE: {
> + struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
> + *(u_int *)data = hw->type;
>   break;
> + }
>  
>   case WSMOUSEIO_GCALIBCOORDS:
>   wsmc->minx = sc->dev_type->l_x.min;
> Index: sys/dev/wscons/wsconsio.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.88
> diff -u -p -u -p -r1.88 wsconsio.h
> --- sys/dev/wscons/wsconsio.h 7 May 2018 21:58:42 -   1.88
> +++ sys/dev/wscons/wsconsio.h 27 Jul 2018 19

stop using WSMOUSE_TYPE_ELANTECH in other drivers (xenocara)

2018-07-27 Thread joshua stein
And here is the xenocara part.

Index: xserver/config/wscons.c
===
RCS file: /cvs/xenocara/xserver/config/wscons.c,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 wscons.c
--- xserver/config/wscons.c 8 Dec 2017 15:02:00 -   1.21
+++ xserver/config/wscons.c 27 Jul 2018 19:54:17 -
@@ -239,6 +239,7 @@ wscons_add_pointers(void)
   case WSMOUSE_TYPE_ALPS:
   case WSMOUSE_TYPE_ELANTECH:
   case WSMOUSE_TYPE_SYNAP_SBTN:
+  case WSMOUSE_TYPE_TOUCHPAD:
 wscons_add_pointer(devnam, "ws",
ATTR_TOUCHPAD);
 break;



stop using WSMOUSE_TYPE_ELANTECH in other drivers

2018-07-27 Thread joshua stein
Back when touchpad drivers were using the synaptics Xorg driver, 
they had to pretend to be Elantech devices in order to get 
particular packet processing.

Since Ulf switched us to wstpad and xf86-input-ws a while ago, these 
drivers can stop claiming to be WSMOUSE_TYPE_ELANTECH devices and 
use a common WSMOUSE_TYPE_TOUCHPAD.

This also makes the WSMOUSEIO_GTYPE ioctl in those drivers respond 
with whatever is stored in the softc to avoid repeating ourselves 
(or possibly responding incorrectly).

There's also a corresponding xenocara diff coming after this.


Index: sys/dev/hid/hidmt.c
===
RCS file: /cvs/src/sys/dev/hid/hidmt.c,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 hidmt.c
--- sys/dev/hid/hidmt.c 10 Oct 2017 20:31:50 -  1.6
+++ sys/dev/hid/hidmt.c 27 Jul 2018 19:53:59 -
@@ -235,7 +235,7 @@ hidmt_configure(struct hidmt *mt)
return;
 
hw = wsmouse_get_hw(mt->sc_wsmousedev);
-   hw->type = WSMOUSE_TYPE_ELANTECH;   /* see hidmt_ioctl */
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = (mt->sc_clickpad
? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
hw->x_min = mt->sc_minx;
@@ -468,13 +468,11 @@ hidmt_ioctl(struct hidmt *mt, u_long cmd
int wsmode;
 
switch (cmd) {
-   case WSMOUSEIO_GTYPE:
-   /*
-* So we can specify our own finger/w values to the
-* xf86-input-synaptics driver like pms(4)
-*/
-   *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(mt->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_GCALIBCOORDS:
wsmc->minx = mt->sc_minx;
Index: sys/dev/i2c/iatp.c
===
RCS file: /cvs/src/sys/dev/i2c/iatp.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 iatp.c
--- sys/dev/i2c/iatp.c  22 Jun 2018 15:58:26 -  1.5
+++ sys/dev/i2c/iatp.c  27 Jul 2018 19:53:59 -
@@ -325,7 +325,7 @@ iatp_configure(struct iatp_softc *sc)
 
hw = wsmouse_get_hw(sc->sc_wsmousedev);
if (sc->sc_touchpad) {
-   hw->type = WSMOUSE_TYPE_SYNAPTICS;
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = WSMOUSEHW_CLICKPAD;
} else {
hw->type = WSMOUSE_TYPE_TPANEL;
@@ -415,12 +415,11 @@ iatp_ioctl(void *v, u_long cmd, caddr_t 
wsmc->resy = sc->sc_tsscale.resy;
break;
 
-   case WSMOUSEIO_GTYPE:
-   if (sc->sc_touchpad)
-   *(u_int *)data = WSMOUSE_TYPE_SYNAPTICS;
-   else
-   *(u_int *)data = WSMOUSE_TYPE_TPANEL;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_SETMODE:
if (!sc->sc_touchpad)
Index: sys/dev/usb/ubcmtp.c
===
RCS file: /cvs/src/sys/dev/usb/ubcmtp.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 ubcmtp.c
--- sys/dev/usb/ubcmtp.c6 Jun 2017 21:53:07 -   1.17
+++ sys/dev/usb/ubcmtp.c27 Jul 2018 19:53:59 -
@@ -521,7 +521,7 @@ ubcmtp_configure(struct ubcmtp_softc *sc
 {
struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
 
-   hw->type = WSMOUSE_TYPE_ELANTECH;   /* see ubcmtp_ioctl */
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = (IS_CLICKPAD(sc->dev_type->type)
? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
hw->x_min = sc->dev_type->l_x.min;
@@ -601,11 +601,11 @@ ubcmtp_ioctl(void *v, unsigned long cmd,
cmd);
 
switch (cmd) {
-   case WSMOUSEIO_GTYPE:
-   /* so we can specify our own finger/w values to the
-* xf86-input-synaptics driver like pms(4) */
-   *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_GCALIBCOORDS:
wsmc->minx = sc->dev_type->l_x.min;
Index: sys/dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.88
diff -u -p -u -p -r1.88 wsconsio.h
--- sys/dev/wscons/wsconsio.h   7 May 2018 21:58:42 -   1.88
+++ sys/dev/wscons/wsconsio.h   27 Jul 2018 19:53:59 -
@@ -238,6 +238,7 @@ struct wskbd_encoding_data {
 #defineWSMOUSE_TYPE_SGI17  /* SGI serial mouse */
 #defineWSMOUSE_TYPE_ELANTECH   18  /* Elantech touchpad */
 #define