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 -0000      1.6
+++ sys/dev/hid/hidmt.c 27 Jul 2018 19:53:59 -0000
@@ -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 -0000      1.5
+++ sys/dev/i2c/iatp.c  27 Jul 2018 19:53:59 -0000
@@ -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 -0000       1.17
+++ sys/dev/usb/ubcmtp.c        27 Jul 2018 19:53:59 -0000
@@ -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 -0000       1.88
+++ sys/dev/wscons/wsconsio.h   27 Jul 2018 19:53:59 -0000
@@ -238,6 +238,7 @@ struct wskbd_encoding_data {
 #define                WSMOUSE_TYPE_SGI        17      /* SGI serial mouse */
 #define                WSMOUSE_TYPE_ELANTECH   18      /* Elantech touchpad */
 #define                WSMOUSE_TYPE_SYNAP_SBTN 19      /* Synaptics soft 
buttons */
+#define                WSMOUSE_TYPE_TOUCHPAD   20      /* Generic touchpad */
 
 /* Set resolution.  Not applicable to all mouse types. */
 #define        WSMOUSEIO_SRES          _IOW('W', 33, u_int)
Index: sbin/wsconsctl/mousecfg.c
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/mousecfg.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 mousecfg.c
--- sbin/wsconsctl/mousecfg.c   7 May 2018 22:15:36 -0000       1.4
+++ sbin/wsconsctl/mousecfg.c   27 Jul 2018 19:53:59 -0000
@@ -61,6 +61,7 @@ static const int touchpad_types[] = {
        WSMOUSE_TYPE_ALPS,              /* ALPS touchpad */
        WSMOUSE_TYPE_ELANTECH,          /* Elantech touchpad */
        WSMOUSE_TYPE_SYNAP_SBTN,        /* Synaptics soft buttons */
+       WSMOUSE_TYPE_TOUCHPAD,          /* Generic touchpad */
 };
 
 struct wsmouse_parameters cfg_tapping = {
Index: sbin/wsconsctl/util.c
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/util.c,v
retrieving revision 1.66
diff -u -p -u -p -r1.66 util.c
--- sbin/wsconsctl/util.c       2 Jan 2018 17:39:34 -0000       1.66
+++ sbin/wsconsctl/util.c       27 Jul 2018 19:53:59 -0000
@@ -95,6 +95,7 @@ static const struct nameint mstype_tab[]
        { WSMOUSE_TYPE_SGI,     "sgi" },
        { WSMOUSE_TYPE_ELANTECH, "elantech" },
        { WSMOUSE_TYPE_SYNAP_SBTN, "synaptics" },
+       { WSMOUSE_TYPE_TOUCHPAD, "touchpad" },
 };
 
 static const struct nameint dpytype_tab[] = {

Reply via email to