Skip to content

Commit 6ced885

Browse files
author
matt
committed
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).
1 parent 265e5c8 commit 6ced885

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

sys/dev/sun/ms.c

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: ms.c,v 1.16 1999/05/14 06:42:02 mrg Exp $ */
1+
/* $NetBSD: ms.c,v 1.17 1999/08/02 01:50:27 matt Exp $ */
22

33
/*
44
* Copyright (c) 1992, 1993
@@ -231,8 +231,13 @@ ms_input(ms, c)
231231
ms->ms_byteno = -1;
232232
return;
233233
}
234-
if ((c & ~7) == 0x80) /* if in 0x80..0x87 */
235-
ms->ms_byteno = 0;
234+
if ((c & ~0x0f) == 0x80) { /* if in 0x80..0x8f */
235+
if (c & 8) {
236+
ms->ms_byteno = 1; /* short form (3 bytes) */
237+
} else {
238+
ms->ms_byteno = 0; /* long form (5 bytes) */
239+
}
240+
}
236241

237242
/*
238243
* Run the decode loop, adding to the current information.
@@ -245,31 +250,37 @@ ms_input(ms, c)
245250
return;
246251

247252
case 0:
248-
/* buttons */
249-
ms->ms_byteno = 1;
253+
/* buttons (long form) */
254+
ms->ms_byteno = 2;
250255
ms->ms_mb = (~c) & 0x7;
251256
return;
252257

253258
case 1:
254-
/* first delta-x */
255-
ms->ms_byteno = 2;
256-
ms->ms_dx += (char)c;
259+
/* buttons (short form) */
260+
ms->ms_byteno = 4;
261+
ms->ms_mb = (~c) & 0x7;
257262
return;
258263

259264
case 2:
260-
/* first delta-y */
265+
/* first delta-x */
261266
ms->ms_byteno = 3;
262-
ms->ms_dy += (char)c;
267+
ms->ms_dx += (char)c;
263268
return;
264269

265270
case 3:
266-
/* second delta-x */
271+
/* first delta-y */
267272
ms->ms_byteno = 4;
268-
ms->ms_dx += (char)c;
273+
ms->ms_dy += (char)c;
269274
return;
270275

271276
case 4:
272277
/* second delta-x */
278+
ms->ms_byteno = 5;
279+
ms->ms_dx += (char)c;
280+
return;
281+
282+
case 5:
283+
/* second delta-y */
273284
ms->ms_byteno = -1; /* wait for button-byte again */
274285
ms->ms_dy += (char)c;
275286
break;

0 commit comments

Comments
 (0)