summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1999-09-05 16:27:59 +0000
committerJason Wright <jason@cvs.openbsd.org>1999-09-05 16:27:59 +0000
commitaa308abd43670192b1baa8d3d2cad7d189bb9708 (patch)
tree45d166d0ff68dfc8719c72322df006afd24b180e /sys/arch/sparc/dev
parent7ee2a80d3905da8d78a4759da0f2d7e82244fb23 (diff)
support for the "short" mouse protocol on tadpole; from netbsd
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/ms.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/sys/arch/sparc/dev/ms.c b/sys/arch/sparc/dev/ms.c
index 1049fb12e45..d314a7e5adb 100644
--- a/sys/arch/sparc/dev/ms.c
+++ b/sys/arch/sparc/dev/ms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ms.c,v 1.6 1997/08/08 08:25:19 downsj Exp $ */
+/* $OpenBSD: ms.c,v 1.7 1999/09/05 16:27:58 jason Exp $ */
/* $NetBSD: ms.c,v 1.10 1996/09/12 01:36:18 mrg Exp $ */
/*
@@ -129,8 +129,12 @@ ms_rint(c)
ms->ms_byteno = -1;
return;
}
- if ((unsigned)(c - 0x80) < 8) /* if in 0x80..0x87 */
- ms->ms_byteno = 0;
+ if ((c & ~0x0f) == 0x80) { /* if in 0x80..0x8f */
+ if (c & 8)
+ ms->ms_byteno = 1; /* short form (3 bytes) */
+ else
+ ms->ms_byteno = 0; /* long form (5 bytes) */
+ }
/*
* Run the decode loop, adding to the current information.
@@ -143,31 +147,37 @@ ms_rint(c)
return;
case 0:
- /* buttons */
- ms->ms_byteno = 1;
+ /* buttons (long form) */
+ ms->ms_byteno = 2;
ms->ms_mb = (~c) & 0x7;
return;
case 1:
- /* first delta-x */
- ms->ms_byteno = 2;
- ms->ms_dx += (char)c;
+ /* buttons (short form) */
+ ms->ms_byteno = 4;
+ ms->ms_mb = (~c) & 0x07;
return;
case 2:
- /* first delta-y */
+ /* first delta-x */
ms->ms_byteno = 3;
- ms->ms_dy += (char)c;
+ ms->ms_dx += (char)c;
return;
case 3:
- /* second delta-x */
+ /* first delta-y */
ms->ms_byteno = 4;
- ms->ms_dx += (char)c;
+ ms->ms_dy += (char)c;
return;
case 4:
/* second delta-x */
+ ms->ms_byteno = 5;
+ ms->ms_dx += (char)c;
+ break;
+
+ case 5:
+ /* second delta-y */
ms->ms_byteno = -1; /* wait for button-byte again */
ms->ms_dy += (char)c;
break;