summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbru <bru@openbsd.org>2017-10-28 14:44:46 +0000
committerbru <bru@openbsd.org>2017-10-28 14:44:46 +0000
commit36e35055d646477d03dd23046e1a08ae525d9ddd (patch)
tree6c77952d6b8ed42fbcf529549b8bba1bebfd1450
parentAdapt the Elantech handlers (v1-3) to the new wsmouse infrastructure. (diff)
downloadwireguard-openbsd-36e35055d646477d03dd23046e1a08ae525d9ddd.tar.xz
wireguard-openbsd-36e35055d646477d03dd23046e1a08ae525d9ddd.zip
Add the compat-mode setup for wsmouse.
-rw-r--r--sys/dev/i2c/iatp.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/sys/dev/i2c/iatp.c b/sys/dev/i2c/iatp.c
index 5dae7908cba..54e9ca75295 100644
--- a/sys/dev/i2c/iatp.c
+++ b/sys/dev/i2c/iatp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iatp.c,v 1.3 2016/09/24 18:32:18 kettenis Exp $ */
+/* $OpenBSD: iatp.c,v 1.4 2017/10/28 14:44:46 bru Exp $ */
/*
* Atmel maXTouch i2c touchscreen/touchpad driver
* Copyright (c) 2016 joshua stein <jcs@openbsd.org>
@@ -319,6 +319,30 @@ iatp_activate(struct device *self, int act)
}
int
+iatp_configure(struct iatp_softc *sc)
+{
+ struct wsmousehw *hw;
+
+ hw = wsmouse_get_hw(sc->sc_wsmousedev);
+ if (sc->sc_touchpad) {
+ hw->type = WSMOUSE_TYPE_SYNAPTICS;
+ hw->hw_type = WSMOUSEHW_CLICKPAD;
+ } else {
+ hw->type = WSMOUSE_TYPE_TPANEL;
+ hw->hw_type = WSMOUSEHW_TPANEL;
+ }
+ hw->x_min = sc->sc_tsscale.minx;
+ hw->x_max = sc->sc_tsscale.maxx;
+ hw->y_min = sc->sc_tsscale.miny;
+ hw->y_max = sc->sc_tsscale.maxy;
+ hw->h_res = sc->sc_tsscale.resx;
+ hw->v_res = sc->sc_tsscale.resy;
+ hw->mt_slots = sc->num_touchids;
+
+ return (wsmouse_configure(sc->sc_wsmousedev, NULL, 0));
+}
+
+int
iatp_enable(void *v)
{
struct iatp_softc *sc = v;
@@ -333,14 +357,11 @@ iatp_enable(void *v)
DPRINTF(("%s: enabling\n", sc->sc_dev.dv_xname));
- if (wsmouse_mt_init(sc->sc_wsmousedev, sc->num_touchids, 0)) {
- printf("%s: failed wsmouse_mt_init\n", sc->sc_dev.dv_xname);
+ if (iatp_configure(sc)) {
+ printf("%s: failed wsmouse_configure\n", sc->sc_dev.dv_xname);
return 1;
}
- if (sc->sc_touchpad)
- wsmouse_set_mode(sc->sc_wsmousedev, WSMOUSE_COMPAT);
-
/* force a read of any pending messages so we start getting new
* interrupts */
iatp_t5_read_msgs(sc, sc->info.max_report_id);