Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Dec 1997 04:27:14 -0600 (CST)
From:      Dave Bodenstab <imdave@mcs.net>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/5320: moused enhancement for logitech 4-button mouseman plus
Message-ID:  <199712161027.EAA04581@base586.home.org>
Resent-Message-ID: <199712161800.KAA13818@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         5320
>Category:       bin
>Synopsis:       moused enhancement for logitech 4-button mouseman plus
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 16 10:00:01 PST 1997
>Last-Modified:
>Originator:     Dave Bodenstab
>Organization:
home
>Release:        FreeBSD 2.2.5-RELEASE i386
>Environment:

	moused with a logitech mouseman plus 4-button mouse

>Description:

	Logitech is now producing 4-button mice -- some have a goofy
	wheel where the middle button is, and a fourth button inconveniently
	placed on the left side under ones thumb.  I returned that one, and
	replaced it with what at first appeared to be a normal 3-button
	rodent, but it turned out that it still had the fouth button on the side.  

	One would expect that the left, middle and right buttons would
	correspond to buttons 1, 2 and 3.  But no... this is a windoze 95
	mouse... so the left, thumb and right buttons are 1, 2 and 3.  The
	*middle* button is actually the additional fourth button.

	This is very inconvenient since one has to squeeze the mouse with
	ones thumb to press button two.  In addition, it's too easy to 
	accidently press the button as the mouse is moved.

	What drugs were the logitech designers taking when this layout was
	conceived?

	This patch maps the middle button back to button 2.  The thumb button
	becomes a fourth button (using bitmask 0x08.)  I haven't gotten
	X11 running yet -- el cheapo vga card is not supported by xfree --
	so I haven't been able to see what effect this fourth button has
	or even if X11 can be coaxed into using it.  At least I no longer
	get a cramp in my hand from squeezing the dumb thumb button.

>How-To-Repeat:
>Fix:
	
	This patch assumes my previously submitted bug-fix for simultaneous
	button presses is applied.

--- moused.c.orig	Tue Dec 16 03:33:04 1997
+++ moused.c	Tue Dec 16 03:8:12 1997
@@ -76,8 +76,9 @@
 #define R_LOGITECH	4
 #define R_BUSMOUSE	5
 #define R_LOGIMAN	6
-#define R_PS_2		7
-#define R_MMHITAB	8
+#define R_LOGIMAN4	7	/* Logitech Mouseman (4-button) */
+#define R_PS_2		8
+#define R_MMHITAB	9
 
 char	*rnames[] = {
     "xxx",
@@ -87,6 +88,7 @@
     "logitech",
     "busmouse",
     "mouseman",
+    "mouseman+",
     "ps/2",
     "mmhitab",
     NULL
@@ -101,6 +103,7 @@
     (CS8 | CSTOPB	   | CREAD | CLOCAL | HUPCL ),	/* Logitech */
     0,							/* BusMouse */
     (CS7		   | CREAD | CLOCAL | HUPCL ),	/* MouseMan */
+    (CS7		   | CREAD | CLOCAL | HUPCL ),	/* MouseMan 4-button */
     0,							/* PS/2 */
     (CS8		   | CREAD | CLOCAL | HUPCL ),	/* MMHitTablet */
 };
@@ -375,11 +378,11 @@
      */
 
   
-    if (rodent.rtype == R_LOGIMAN)
+    if (rodent.rtype == R_LOGIMAN || rodent.rtype == R_LOGIMAN4)
     {
-	setmousespeed(1200, 1200, rodentcflags[R_LOGIMAN]);
+	setmousespeed(1200, 1200, rodentcflags[rodent.rtype]);
 	write(rodent.mfd, "*X", 2);
-	setmousespeed(1200, rodent.baudrate, rodentcflags[R_LOGIMAN]);
+	setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
     } else {
 	if ((rodent.rtype != R_BUSMOUSE) && (rodent.rtype != R_PS_2))
 	{
@@ -469,6 +472,7 @@
     {	0xe0,	0x80,	0x80,	0x00,	3	},  /* Logitech */
     {	0xf8,	0x80,	0x00,	0x00,	5	},  /* BusMouse */
     { 	0x40,	0x40,	0x40,	0x00,	3 	},  /* MouseMan */
+    { 	0x40,	0x40,	0x40,	0x00,	3 	},  /* MouseMan 4-button */
     {	0xc0,	0x00,	0x00,	0x00,	3	},  /* PS/2 mouse */
     {	0xe0,	0x80,	0x80,	0x00,	3	},  /* MM_HitTablet */
     };
@@ -508,7 +512,8 @@
 	(rBuf & proto[rodent.rtype][0]) != proto[rodent.rtype][1])
     {
 	/*
-	 * Hack for Logitech MouseMan Mouse - Middle button
+	 * Hack for Logitech MouseMan Mouse - Middle button, and Logitech
+	 * MouseMan - Middle button and thumb button
 	 *
 	 * Unfortunately this mouse has variable length packets: the standard
 	 * Microsoft 3 byte packet plus an optional 4th byte whenever the
@@ -533,6 +538,22 @@
 	    return(&act);
 	}
 
+	/*
+	 * The 4-button mouseman treats what one would expect to be the middle
+	 * button as an additional button: 0x00/0x10.  What used to be button 2 is
+	 * the obnoxious button on the side of the mouse (under ones right thumb).
+	 * Since this is totally inconsistent with what one would expect, we
+	 * will swap these two buttons.
+	 */
+	if (rodent.rtype == R_LOGIMAN4 && (char)(rBuf & ~0x33) == 0)
+	{
+	    act.buttons = ((int)(rBuf & 0x20) >> 2)  /* thumb button == button 4 */
+	        | ((int)(rBuf & 0x10) >> 3)	     /* middle button == button 2 */
+		| (rodent.lastbuttons & 0x05);
+	    rodent.lastbuttons = act.buttons;	/* save new button state */
+	    return(&act);
+	}
+
 	return(NULL);				/* skip package */
     }
         
@@ -561,6 +582,19 @@
 	act.dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
 	act.dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
 	break;
+
+    case R_LOGIMAN4:		/* MouseMan with thumb button */
+	if (rodent.flags & ChordMiddle)
+	    act.buttons = (((int) pBuf[0] & 0x30) == 0x30) ? 2 :
+		           ((int)(pBuf[0]&0x20)>>3) | ((int)(pBuf[0]&0x10)>>4);
+	else
+	    act.buttons =   (rodent.lastbuttons & 0x0a)
+		          | ((int)(pBuf[0] & 0x20) >> 3)
+		          | ((int)(pBuf[0] & 0x10) >> 4);
+	rodent.lastbuttons = act.buttons;	/* save new button state */
+	act.dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
+	act.dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
+	break;
       
     case R_MOUSESYS:		/* Mouse Systems Corp */
 	act.buttons = (~pBuf[0]) & 0x07;
@@ -698,7 +732,8 @@
 		cfsetospeed(&tty, B1200);
 	}
 
-	if (rodent.rtype == R_LOGIMAN || rodent.rtype == R_LOGITECH)
+	if (rodent.rtype == R_LOGIMAN || rodent.rtype == R_LOGIMAN4 ||
+	    rodent.rtype == R_LOGITECH)
 	{
 		if (write(rodent.mfd, c, 2) != 2)
 		{
--- moused.8.orig	Mon Sep 29 01:36:12 1997
+++ moused.8	Tue Dec 16 03:04:09 1997
@@ -84,6 +84,8 @@
 A bus mouse
 .It mouseman
 Logitech MouseMan and TrackMan
+.It mouseman+
+Logitech MouseMan with thumb button (as button 4)
 .It ps/2
 PS/2 mouse
 .It mmhittab

>Audit-Trail:
>Unformatted:



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