summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2011-12-03 19:43:01 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2011-12-03 19:43:01 +0000
commit56c3b324a9254442652e4f734b8619d667b0bf2f (patch)
tree421a67df0138fe2ffd38f91b3aebdde083f7216a /sys/dev
parent485b3adf60018bfd53ab0001140d3ec2e0e60e39 (diff)
Correctly handle clitpad packets for some ALPS models.
reported by espie@, not reported by miod@ with and ok shadchin@, ok espie@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pckbc/pms.c48
-rw-r--r--sys/dev/pckbc/pmsreg.h7
2 files changed, 37 insertions, 18 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c
index 81e4d84593b..8ad7b44aec9 100644
--- a/sys/dev/pckbc/pms.c
+++ b/sys/dev/pckbc/pms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pms.c,v 1.24 2011/10/17 17:12:01 mpi Exp $ */
+/* $OpenBSD: pms.c,v 1.25 2011/12/03 19:43:00 mpi Exp $ */
/* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -147,15 +147,13 @@ static const struct alps_model {
} alps_models[] = {
#if 0
/* FIXME some clipads are not working yet */
+ { 0x5212, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+ { 0x6222, 0xcf, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+#endif
{ 0x2021, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
{ 0x2221, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
{ 0x2222, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
{ 0x3222, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
- { 0x5212, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
- { 0x6222, 0xcf, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
- { 0x633b, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
- { 0x7301, 0xf8, ALPS_DUALPOINT },
-#endif
{ 0x5321, 0xf8, ALPS_GLIDEPOINT },
{ 0x5322, 0xf8, ALPS_GLIDEPOINT },
{ 0x603b, 0xf8, ALPS_GLIDEPOINT },
@@ -165,6 +163,8 @@ static const struct alps_model {
{ 0x6324, 0x8f, ALPS_GLIDEPOINT },
{ 0x6325, 0xef, ALPS_GLIDEPOINT },
{ 0x6326, 0xf8, ALPS_GLIDEPOINT },
+ { 0x633b, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+ { 0x7301, 0xf8, ALPS_DUALPOINT },
{ 0x7321, 0xf8, ALPS_GLIDEPOINT },
{ 0x7322, 0xf8, ALPS_GLIDEPOINT },
{ 0x7325, 0xcf, ALPS_GLIDEPOINT },
@@ -1075,6 +1075,7 @@ int
pms_enable_alps(struct pms_softc *sc)
{
struct alps_softc *alps = sc->alps;
+ struct wsmousedev_attach_args a;
u_char resp[3];
if (pms_set_resolution(sc, 0) ||
@@ -1108,6 +1109,13 @@ pms_enable_alps(struct pms_softc *sc)
alps->max_y = ALPS_YMAX_BEZEL;
alps->wsmode = WSMOUSE_COMPAT;
+
+ if (alps->model & ALPS_DUALPOINT) {
+ a.accessops = &synaptics_pt_accessops;
+ a.accesscookie = sc;
+ sc->sc_pt_wsmousedev = config_found((void *)sc, &a,
+ wsmousedevprint);
+ }
}
if (alps->model == 0)
@@ -1221,6 +1229,23 @@ pms_proc_alps(struct pms_softc *sc)
y = sc->packet[4] | ((sc->packet[3] & 0x70) << 3);
z = sc->packet[5];
+ buttons = ((sc->packet[3] & 1) ? WSMOUSE_BUTTON(1) : 0) |
+ ((sc->packet[3] & 2) ? WSMOUSE_BUTTON(3) : 0) |
+ ((sc->packet[3] & 4) ? WSMOUSE_BUTTON(2) : 0);
+
+ if ((sc->sc_dev_enable & PMS_DEV_SECONDARY) && z == ALPS_Z_MAGIC) {
+ dx = (x > ALPS_XSEC_BEZEL / 2) ? (x - ALPS_XSEC_BEZEL) : x;
+ dy = (y > ALPS_YSEC_BEZEL / 2) ? (y - ALPS_YSEC_BEZEL) : y;
+
+ wsmouse_input(sc->sc_pt_wsmousedev, buttons, dx, dy, 0, 0,
+ WSMOUSE_INPUT_DELTA);
+
+ return;
+ }
+
+ if ((sc->sc_dev_enable & PMS_DEV_PRIMARY) == 0)
+ return;
+
/*
* XXX The Y-axis is in the oposit direction compared to
* Synaptics touchpads and PS/2 mouses.
@@ -1229,18 +1254,7 @@ pms_proc_alps(struct pms_softc *sc)
*/
y = ALPS_YMAX_BEZEL - y + ALPS_YMIN_BEZEL;
- buttons = ((sc->packet[3] & 1) ? WSMOUSE_BUTTON(1) : 0) |
- ((sc->packet[3] & 2) ? WSMOUSE_BUTTON(3) : 0) |
- ((sc->packet[3] & 4) ? WSMOUSE_BUTTON(2) : 0);
-
if (alps->wsmode == WSMOUSE_NATIVE) {
- if (z == 127) {
- /* DualPoint touchpads are not absolute. */
- wsmouse_input(sc->sc_wsmousedev, buttons, x, y, 0, 0,
- WSMOUSE_INPUT_DELTA);
- return;
- }
-
ges = sc->packet[2] & 0x01;
fin = sc->packet[2] & 0x02;
diff --git a/sys/dev/pckbc/pmsreg.h b/sys/dev/pckbc/pmsreg.h
index c2ce5567ac8..5c124ff8a25 100644
--- a/sys/dev/pckbc/pmsreg.h
+++ b/sys/dev/pckbc/pmsreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmsreg.h,v 1.5 2011/10/04 06:30:40 mpi Exp $ */
+/* $OpenBSD: pmsreg.h,v 1.6 2011/12/03 19:43:00 mpi Exp $ */
/* $NetBSD: psmreg.h,v 1.1 1998/03/22 15:41:28 drochner Exp $ */
#ifndef SYS_DEV_PCKBC_PMSREG_H
@@ -135,4 +135,9 @@
#define ALPS_YMIN_BEZEL 130
#define ALPS_YMAX_BEZEL 640
+#define ALPS_XSEC_BEZEL 768
+#define ALPS_YSEC_BEZEL 512
+
+#define ALPS_Z_MAGIC 127
+
#endif /* SYS_DEV_PCKBC_PMSREG_H */