Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2000 19:37:03 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Kazukata Yokota <yokota@FreeBSD.org>
Cc:        hackers@FreeBSD.org
Subject:   [PATCH] 3-button microsoft-type serial mouse
Message-ID:  <20000821193703.A15158@sunbay.com>

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

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii

Hi!

I have a 3-button microsoft-type serial mouse (I do not know the vendor,
only FCC ID if needed) which generates the `middle button down' event as
previous `button down/up' event (any).  Attached are:

1. the script(1) output of unmodified moused(8) with comments on events.
2. the patch that makes my mouse's 3rd button work.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="moused.script"

Script started on Mon Aug 21 18:55:26 2000
perl# moused -d -f -p /dev/cuaa1
moused: PnP COM device rev 1.0 probe...
moused: modem status 03
moused: alternate probe...
moused: pnpwakeup2(): valid response.
moused: M 4d
moused: non-PnP mouse 'M'
moused: PnP serial mouse: 'PNP0F01' '' ''
moused: proto params: 40 40 40 00 3 dc 00
moused: port: /dev/cuaa1  interface: serial  type: microsoft  model: generic

Left button pressed:

moused: received char 0x60
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 60,0,0,0,0,0,0,0
moused: tv:  966873379 603859
moused:   :  966873377 3320
moused: flags:00000001 buttons:00000001 obuttons:00000000
moused: activity : buttons 0x00000001  dx 0  dy 0  dz 0
moused: mstate[0]->count:1
moused: button 1  count 1

Left button released:

moused: received char 0x40
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 40,0,0,0,0,0,0,0
moused: tv:  966873380 693550
moused: flags:00000001 buttons:00000000 obuttons:00000001
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[0]->count:1
moused: button 1  count 0

Right button pressed:

moused: received char 0x50
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 50,0,0,0,0,0,0,0
moused: tv:  966873382 523875
moused:   :  966873377 3320
moused: flags:00000004 buttons:00000004 obuttons:00000000
moused: activity : buttons 0x00000004  dx 0  dy 0  dz 0
moused: mstate[2]->count:1
moused: button 3  count 1

Right button released:

moused: received char 0x40
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 40,0,0,0,0,0,0,0
moused: tv:  966873383 493579
moused: flags:00000004 buttons:00000000 obuttons:00000004
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[2]->count:1
moused: button 3  count 0

Middle button pressed:

moused: received char 0x40
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 40,0,0,0,0,0,0,0

Middle button released:

moused: received char 0x40
moused: received char 0x0
moused: received char 0x0
moused: assembled full packet (len 3) 40,0,0,0,0,0,0,0
perl# exit

Script done on Mon Aug 21 18:56:28 2000

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="moused.c.patch"

Index: moused.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/moused/moused.c,v
retrieving revision 1.45
diff -u -p -r1.45 moused.c
--- moused.c	2000/04/21 14:20:25	1.45
+++ moused.c	2000/08/21 16:09:44
@@ -1660,8 +1660,7 @@ r_protocol(u_char rBuf, mousestatus_t *a
 		? MOUSE_BUTTON2DOWN 
 		: butmapmss[(pBuf[0] & MOUSE_MSS_BUTTONS) >> 4];
 	else
-	    act->button |= (act->obutton & MOUSE_BUTTON2DOWN)
-		| butmapmss[(pBuf[0] & MOUSE_MSS_BUTTONS) >> 4];
+	    act->button |= butmapmss[(pBuf[0] & MOUSE_MSS_BUTTONS) >> 4];
         
 	/* Send X10 btn events to remote client (ensure -128-+127 range) */
 	if ((rodent.rtype == MOUSE_PROTO_X10MOUSEREM) && 
@@ -1676,6 +1675,10 @@ r_protocol(u_char rBuf, mousestatus_t *a
 
 	act->dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
 	act->dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
+
+	if (act->button == act->obutton && !act->dx && !act->dy)
+		act->button |= MOUSE_BUTTON2DOWN;
+
 	break;
 
     case MOUSE_PROTO_GLIDEPOINT:	/* GlidePoint */

--8t9RHnE3ZwKMSgU+--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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