diff options
| author | matt <matt@NetBSD.org> | 1999-08-02 01:50:27 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 1999-08-02 01:50:27 +0000 |
| commit | f7141a0ffbe2130cb2d4c596af14710dfea28d2c (patch) | |
| tree | c004590ba41a246485ee7afce4b847a276b4acb4 /sys/dev | |
| parent | 825e233d2e3c2ef1deba17efdca342e68c3e473f (diff) | |
The Tadpole 3GX uses a modified Sun Mouse protocol. Instead of
sending 5 bytes per sample, it sends 3 omitting the 2nd set of
dx/dy updates. You can distinguish between the two forms since
the first byte of 5-bytes seq will be 0b10000xxx which a 3-byte
will have 0b10001xxx. This changes allows the Xsun server to
run unchanged on the Tadpole 3GX (ignoring for now that the
colormap is still broken).
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/sun/ms.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/sys/dev/sun/ms.c b/sys/dev/sun/ms.c index 8a33764e6ee..8854fe54872 100644 --- a/sys/dev/sun/ms.c +++ b/sys/dev/sun/ms.c @@ -1,4 +1,4 @@ -/* $NetBSD: ms.c,v 1.16 1999/05/14 06:42:02 mrg Exp $ */ +/* $NetBSD: ms.c,v 1.17 1999/08/02 01:50:27 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -231,8 +231,13 @@ ms_input(ms, c) ms->ms_byteno = -1; return; } - if ((c & ~7) == 0x80) /* 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. @@ -245,31 +250,37 @@ ms_input(ms, 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) & 0x7; 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; + return; + + case 5: + /* second delta-y */ ms->ms_byteno = -1; /* wait for button-byte again */ ms->ms_dy += (char)c; break; |
