Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 1997 18:12:47 -0500
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        current@FreeBSD.org
Subject:   update for usr.sbin/moused.c
Message-ID:  <199703162312.SAA00362@whizzo.transsys.com>

next in thread | raw e-mail | index | archive | help
This is a multipart MIME message.

--==_Exmh_7211520040
Content-Type: text/plain; charset=us-ascii


I've once again merged my changes into moused.c to support the ALPS Glidepoint
pointing device after doing a 'make world', and having my mouse stop
working again.  Could someone please commit them?  They've been well
tested here.

louie


--==_Exmh_7211520040
Content-Type: application/octet-stream ; name="moused.c.diff"
Content-Description: moused.c.diff
Content-Disposition: attachment; filename="moused.c.diff"

--- /usr/src/usr.sbin/moused/moused.c	Sat Feb 22 11:06:42 1997
+++ moused.c	Sat Mar 15 21:15:34 1997
@@ -75,6 +75,7 @@
 #define R_LOGIMAN	6
 #define R_PS_2		7
 #define R_MMHITAB	8
+#define	R_GLIDEPOINT	9
 
 char	*rnames[] = {
     "xxx",
@@ -86,6 +87,7 @@
     "mouseman",
     "ps/2",
     "mmhitab",
+    "glidepoint",
     NULL
 };
 
@@ -100,6 +102,7 @@
     (CS7		   | CREAD | CLOCAL | HUPCL ),	/* MouseMan */
     0,							/* PS/2 */
     (CS8		   | CREAD | CLOCAL | HUPCL ),	/* MMHitTablet */
+    0,							/* Glidepoint */
 };
 
     
@@ -219,6 +222,7 @@
 	    rodent.portname = "/dev/mse0";
 	break;
     case R_PS_2:
+    case R_GLIDEPOINT:
 	if (!rodent.portname)
 	    rodent.portname = "/dev/psm0";
 	break;
@@ -280,6 +284,8 @@
 void
 usage(void)
 {
+    int i;
+
     fprintf(stderr,
 	    " Usage is %s [options] -p <port> -t <mousetype>\n"
 	    "  Options are   -s   Select 9600 baud mouse.\n"
@@ -290,15 +296,10 @@
 	    "                -D   Lower DTR\n"
 	    "                -S baud  Select explicit baud (1200..9600).\n"   
 	    "  <mousetype> should be one of :\n"
-	    "                microsoft\n"
-	    "                mousesystems\n"
-	    "                mmseries\n"
-	    "                logitech\n"
-	    "                busmouse\n"
-	    "                mouseman\n"
-	    "                ps/2\n"
-	    "                mmhittab\n"
 	    ,progname);
+    
+    for (i = 1; rnames[i]; i++)
+	fprintf(stderr,  "                %s\n", rnames[i]);
  
     exit(1);
 }
@@ -399,7 +400,8 @@
 	write(rodent.mfd, "*X", 2);
 	setmousespeed(1200, rodent.baudrate, rodentcflags[R_LOGIMAN]);
     } else {
-	if ((rodent.rtype != R_BUSMOUSE) && (rodent.rtype != R_PS_2))
+	if ((rodent.rtype != R_BUSMOUSE) && (rodent.rtype != R_PS_2)
+	    && (rodent.rtype != R_GLIDEPOINT))
 	{
 	    /* try all likely settings */
 	    setmousespeed(9600, rodent.baudrate, rodentcflags[rodent.rtype]);
@@ -489,6 +491,7 @@
     { 	0x40,	0x40,	0x40,	0x00,	3 	},  /* MouseMan */
     {	0xc0,	0x00,	0x00,	0x00,	3	},  /* PS/2 mouse */
     {	0xe0,	0x80,	0x80,	0x00,	3	},  /* MM_HitTablet */
+    {	0xc0,	0x00,	0x00,	0x00,	3	},  /* glidepoint */
     };
   
     debug("received char 0x%x",(int)rBuf);
@@ -610,6 +613,16 @@
 	act.buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
 	              (pBuf[0] & 0x02) >> 1 | /* Right */
 		      (pBuf[0] & 0x01) << 2; /* Left */
+	act.dx = (pBuf[0] & 0x10) ?    pBuf[1]-256  :  pBuf[1];
+	act.dy = (pBuf[0] & 0x20) ?  -(pBuf[2]-256) : -pBuf[2];
+	break;
+
+    case R_GLIDEPOINT:		/* Glidepoint */
+	act.buttons = ((pBuf[0] & 0x04) ? MIDDLE_BUTTON : 0) |
+	              ((pBuf[0] & 0x02) ? RIGHT_BUTTON : 0)  |
+		      (((pBuf[0] & 0x01) ||
+			((pBuf[0] & 0x08) == 0)) ? LEFT_BUTTON : 0);
+
 	act.dx = (pBuf[0] & 0x10) ?    pBuf[1]-256  :  pBuf[1];
 	act.dy = (pBuf[0] & 0x20) ?  -(pBuf[2]-256) : -pBuf[2];
 	break;

--==_Exmh_7211520040--





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703162312.SAA00362>