From owner-FreeBSD-users-jp@jp.freebsd.org  Mon Mar 22 17:13:07 1999
Received: (from daemon@localhost)
	by jaz.jp.freebsd.org (8.9.2+3.1W/8.7.3) id RAA16189;
	Mon, 22 Mar 1999 17:13:07 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from work.mzaki.nom (104.pool6.tokyo.att.ne.jp [165.76.23.119])
	by jaz.jp.freebsd.org (8.9.2+3.1W/8.7.3) with ESMTP id RAA16184
	for <FreeBSD-users-jp@jp.freebsd.org>; Mon, 22 Mar 1999 17:13:04 +0900 (JST)
	(envelope-from mzaki@e-mail.ne.jp)
Received: from localhost (localhost [127.0.0.1])
	by work.mzaki.nom (8.9.2/8.9.2) with ESMTP id RAA07404
	for <FreeBSD-users-jp@jp.freebsd.org>; Mon, 22 Mar 1999 17:15:12 +0900 (JST)
	(envelope-from mzaki@e-mail.ne.jp)
To: FreeBSD-users-jp@jp.freebsd.org
X-Mailer: Mew version 1.94b7 on XEmacs 21.0 (20 minutes to Nikko)
X-fingerprint: BD 86 CD D9 66 FD 75 B0  A8 43 4B C4 E2 1B F5 B5
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
	boundary="--Next_Part(Mon_Mar_22_17:15:08_1999_809)--"
Content-Transfer-Encoding: 7bit
Message-Id: <19990322171511V.mzaki@e-mail.ne.jp>
Date: Mon, 22 Mar 1999 17:15:11 +0900
From: Motomichi Matsuzaki <mzaki@e-mail.ne.jp>
X-Dispatcher: imput version 990212(IM106)
Lines: 202
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+981115
X-Sequence: FreeBSD-users-jp 40053
Subject: [FreeBSD-users-jp 40053] SUPER POINTER
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org
X-Originator: mzaki@e-mail.ne.jp

----Next_Part(Mon_Mar_22_17:15:08_1999_809)--
Content-Type: Text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ree86 $B$G$b!"$^$!$H$j$"$($:$O;H$($F$$$^$9!#(B

+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|  $B>>:j(B $BAGF;(B (Motomichi Matsuzaki/maki)                                   |
|  mailto:mzaki@e-mail.ne.jp            $BEl5~Bg3XM}3XIt@8J*3X2JF0J*3X2]Dx(B  |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+


----Next_Part(Mon_Mar_22_17:15:08_1999_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Description: moused-superpointer.patch
Content-Disposition: attachment; filename="moused-superpointer.patch"
Content-Transfer-Encoding: 7bit

diff -u /usr/src/sys/i386/include/mouse.h /usr/include/machine/mouse.h
--- /usr/src/sys/i386/include/mouse.h	Fri Nov 20 20:22:06 1998
+++ /usr/include/machine/mouse.h	Mon Mar 22 16:59:14 1999
@@ -142,6 +142,7 @@
 #define MOUSE_PROTO_SYSMOUSE	12	/* /dev/sysmouse */
 #define MOUSE_PROTO_X10MOUSEREM	13	/* X10 MouseRemote, 3 bytes */
 #define MOUSE_PROTO_KIDSPAD	14	/* Genius Kidspad */
+#define MOUSE_PROTO_SUPERPOINT	15	/* Super Pointer */
 
 #define MOUSE_RES_UNKNOWN	(-1)
 #define MOUSE_RES_DEFAULT	0
diff -u /usr/src/usr.sbin/moused/moused.8~ /usr/src/usr.sbin/moused/moused.8
--- /usr/src/usr.sbin/moused/moused.8~	Fri Nov 20 20:22:16 1998
+++ /usr/src/usr.sbin/moused/moused.8	Mon Mar 22 15:37:10 1999
@@ -262,6 +262,8 @@
 X10 MouseRemote.
 .It Ar kidspad
 Genius Kidspad and Easypad protocol.
+.It Ar superpointer
+Super Gate Technology SUPER POINTER protocol.
 .El
 .Pp
 For the bus and InPort mouse:
diff -u /usr/src/usr.sbin/moused/moused.c~ /usr/src/usr.sbin/moused/moused.c
--- /usr/src/usr.sbin/moused/moused.c~	Mon Dec 14 08:26:21 1998
+++ /usr/src/usr.sbin/moused/moused.c	Mon Mar 22 15:23:36 1999
@@ -190,6 +190,8 @@
     "kidspad",
 #if notyet
     "mariqua",
+#else
+    "superpointer",
 #endif
     NULL
 };
@@ -333,6 +335,8 @@
     (CS8 | PARENB | PARODD | CREAD | CLOCAL | HUPCL ),	/* kidspad etc. */
 #if notyet
     (CS8 | CSTOPB	   | CREAD | CLOCAL | HUPCL ),	/* Mariqua */
+#else
+    (CS8                   | CREAD | CLOCAL | HUPCL ),	/* Super Pointer */
 #endif
 };
 
@@ -409,6 +413,7 @@
 static void	mremote_clientchg(int add);
 
 static int kidspad(u_char rxc, mousestatus_t *act);
+static int superpoint(u_char rxc, mousestatus_t *act);
 
 void
 main(int argc, char *argv[])
@@ -887,6 +892,8 @@
     {	0x80,	0x80,	0x00,	0x00,	5,    0x00,  0xff }, /* KIDSPAD */
 #if notyet
     {	0xf8,	0x80,	0x00,	0x00,	5,   ~0x2f,  0x10 }, /* Mariqua */
+#else
+    {	0x80,	0x80,	0x00,	0x00,	5,    0x00,  0xff }, /* Super Pointer */
 #endif
 };
 static unsigned char cur_proto[7];
@@ -1175,6 +1182,11 @@
         }
 	break;
 
+    case MOUSE_PROTO_SUPERPOINT:
+        rodent.baudrate = 9600;
+        setmousespeed(9600, rodent.baudrate, rodentcflags[rodent.rtype]);
+	break;
+
     case MOUSE_PROTO_SYSMOUSE:
 	if (rodent.hw.iftype == MOUSE_IF_SYSMOUSE)
 	    setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
@@ -1268,6 +1280,8 @@
     debug("received char 0x%x",(int)rBuf);
     if (rodent.rtype == MOUSE_PROTO_KIDSPAD)
 	return kidspad(rBuf, act) ;
+    if (rodent.rtype == MOUSE_PROTO_SUPERPOINT)
+        return superpoint(rBuf, act);
 
     /*
      * Hack for resyncing: We check here for a package that is:
@@ -2367,6 +2381,72 @@
     }
     b_prev = buf[0] ;
     return act->flags ;
+}
+
+/*
+ * code to read from the Super Pointer.
+
+The pointer puts out 5 bytes.
+
+byte 0 is button status (11LRM000).
+The next 4 bytes are used for coordinates xl, xh, yl, yh (0-642, 7 bits valid).
+
+Only absolute coordinates are returned.
+
+ *
+ */
+
+static int
+superpoint(u_char rxc, mousestatus_t *act)
+{
+    static u_char buf[5];
+    static int p;
+    int x, y;
+    static int b_prev = 0 , x_prev = -1, y_prev = -1;;
+
+    if (p > 0 && (rxc & 0x80) ) {
+	fprintf(stderr, "invalid code %d 0x%x\n", p, rxc);
+	p = 0;
+    }
+    if (p == 0 && (rxc & 0x80) != 0x80 ) {
+	fprintf(stderr, "invalid code 0 0x%x\n", rxc);
+	return 0; /* invalid code, no action */
+    }
+    buf[p++] = rxc;
+    if (p < 5)
+	return 0;
+
+    p = 0; /* for next time... */
+
+    x = (buf[2]<<7) + buf[1];
+    y = (buf[4]<<7) + buf[3];
+    x *= 2;
+    y *= 2;
+    fprintf(stderr, "absolute (%d,%d)\n", x, y);
+
+    act->flags = 0;
+    act->obutton = act->button;
+    act->dx = x - x_prev;
+    act->dy = y - y_prev;
+    act->dz = 0;
+
+    if (act->dx || act->dy)
+	act->flags |= MOUSE_POSCHANGED;
+    if (b_prev != 0 && b_prev != buf[0]) { /* possibly record button change */
+	act->button = 0;
+	if ( buf[0] & 0x20 )
+	    act->button |= MOUSE_BUTTON1DOWN;
+	if ( buf[0] & 0x08 )
+	    act->button |= MOUSE_BUTTON2DOWN;
+	if ( buf[0] & 0x10 )
+	    act->button |= MOUSE_BUTTON3DOWN;
+	act->flags |= MOUSE_BUTTONSCHANGED;
+    }
+
+    x_prev = x;
+    y_prev = y;
+    b_prev = buf[0];
+    return act->flags;
 }
 
 static void 

----Next_Part(Mon_Mar_22_17:15:08_1999_809)----
