Skip to content

Commit

Permalink
The Tadpole 3GX uses a modified Sun Mouse protocol. Instead of
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
matt committed Aug 2, 1999
1 parent 265e5c8 commit 6ced885
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions sys/dev/sun/ms.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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;
Expand Down

0 comments on commit 6ced885

Please sign in to comment.