define WSMOUSE_TYPE_TOUCHPAD so non-elantech drivers can stop
authorjcs <jcs@openbsd.org>
Mon, 30 Jul 2018 15:56:30 +0000 (15:56 +0000)
committerjcs <jcs@openbsd.org>
Mon, 30 Jul 2018 15:56:30 +0000 (15:56 +0000)
claiming to be elantech devices

sys/dev/hid/hidmt.c
sys/dev/i2c/iatp.c
sys/dev/usb/ubcmtp.c
sys/dev/wscons/wsconsio.h

index c7653fb..7a9b916 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidmt.c,v 1.6 2017/10/10 20:31:50 jcs Exp $ */
+/* $OpenBSD: hidmt.c,v 1.7 2018/07/30 15:56:30 jcs Exp $ */
 /*
  * HID multitouch driver for devices conforming to Windows Precision Touchpad
  * standard
@@ -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, caddr_t data, int flag,
        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 189b547..7c6fdad 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: iatp.c,v 1.5 2018/06/22 15:58:26 jcs Exp $ */
+/* $OpenBSD: iatp.c,v 1.6 2018/07/30 15:56:30 jcs Exp $ */
 /*
  * Atmel maXTouch i2c touchscreen/touchpad driver
  * Copyright (c) 2016 joshua stein <jcs@openbsd.org>
@@ -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 data, int flag, struct proc *p)
                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 388850e..b4554e5 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ubcmtp.c,v 1.17 2017/06/06 21:53:07 bru Exp $ */
+/*     $OpenBSD: ubcmtp.c,v 1.18 2018/07/30 15:56:30 jcs Exp $ */
 
 /*
  * Copyright (c) 2013-2014, joshua stein <jcs@openbsd.org>
@@ -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, caddr_t data, int flag, struct proc *p)
            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 7212e46..64478d4 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsio.h,v 1.88 2018/05/07 21:58:42 bru Exp $ */
+/* $OpenBSD: wsconsio.h,v 1.89 2018/07/30 15:56:30 jcs Exp $ */
 /* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */
 
 /*
@@ -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)