summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/pms.c
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1997-08-29 22:40:18 +0000
committerkstailey <kstailey@cvs.openbsd.org>1997-08-29 22:40:18 +0000
commitb794a59429443fbc80b0c20d0b5ff7823939a60f (patch)
tree1b0b8e693f083e48c769ff93b747b9ec9e632c62 /sys/arch/i386/isa/pms.c
parent817805ad9fd88b4520e8f5df04663c363259882e (diff)
M$ IntelliMouse support
Diffstat (limited to 'sys/arch/i386/isa/pms.c')
-rw-r--r--sys/arch/i386/isa/pms.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/sys/arch/i386/isa/pms.c b/sys/arch/i386/isa/pms.c
index f0f376ccbe8..18997ff763a 100644
--- a/sys/arch/i386/isa/pms.c
+++ b/sys/arch/i386/isa/pms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pms.c,v 1.15 1997/05/30 19:51:27 deraadt Exp $ */
+/* $OpenBSD: pms.c,v 1.16 1997/08/29 22:40:16 kstailey Exp $ */
/* $NetBSD: pms.c,v 1.29 1996/05/12 23:12:42 mycroft Exp $ */
/*-
@@ -229,6 +229,23 @@ pmsattach(parent, self, aux)
sc->sc_ih = isa_intr_establish(ic, irq, IST_EDGE, IPL_TTY,
pmsintr, sc, sc->sc_dev.dv_xname);
+
+#ifdef INTELLIMOUSE
+ /* The Micro$oft IntelliMouse has a wheel that you can turn or
+ * click stuck in between the left and right buttons.
+ * By default this mouse acts like a two-button PS/2 mouse.
+ * If you set the sampling rate to 200, then 100, then 80
+ * it changes to a 4-byte-per-packet format and the wheel
+ * acts like a middle button if you click it. Turing the
+ * wheel modifies the fourth byte in the packet.
+ */
+ pms_dev_cmd(PMS_SET_SAMPLE);
+ pms_dev_cmd(200); /* 200 samples/sec */
+ pms_dev_cmd(PMS_SET_SAMPLE);
+ pms_dev_cmd(100); /* 100 samples/sec */
+ pms_dev_cmd(PMS_SET_SAMPLE);
+ pms_dev_cmd(80); /* 80 samples/sec */
+#endif
}
int
@@ -446,12 +463,16 @@ pmsintr(arg)
case 2:
dy = inb(PMS_DATA);
dy = (dy == -128) ? -127 : dy;
+#ifdef INTELLIMOUSE
+ ++state;
+#else
state = 0;
-
+#endif
buttons = ((buttons & PS2LBUTMASK) << 2) |
((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
- sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
+ sc->sc_status = buttons |
+ (sc->sc_status & ~BUTSTATMASK) | changed;
if (dx || dy || changed) {
/* Update accumulated movements. */
@@ -473,6 +494,12 @@ pmsintr(arg)
}
break;
+#ifdef INTELLIMOUSE /* discard fourth "wheel" byte */
+ case 3:
+ state = 0;
+ inb(PMS_DATA);
+ break;
+#endif
}
} else {
/* read data port */
@@ -494,12 +521,17 @@ pmsintr(arg)
case 2:
dy = buffer[0];
dy = (dy == -128) ? -127 : dy;
+#ifdef INTELLIMOUSE
+ ++state;
+#else
state = 0;
+#endif
buttons = ((buttons & PS2LBUTMASK) << 2) |
((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
- sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
+ sc->sc_status = buttons |
+ (sc->sc_status & ~BUTSTATMASK) | changed;
if (dx || dy || changed) {
/* Update accumulated movements. */
@@ -507,6 +539,11 @@ pmsintr(arg)
sc->sc_y += dy;
}
break;
+#ifdef INTELLIMOUSE /* discard fourth "wheel" byte */
+ case 3:
+ state = 0;
+ return 0; /* XXX 0? -1? */
+#endif
}
/* add raw data to the queue. */