From hideyuki@sat.t.u-tokyo.ac.jp  Sun Sep 20 12:35:11 1998
Received: from odin.sat.t.u-tokyo.ac.jp (odin.sat.t.u-tokyo.ac.jp [133.11.156.40])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA22212
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Sep 1998 12:35:07 -0700 (PDT)
          (envelope-from hideyuki@sat.t.u-tokyo.ac.jp)
Received: by odin.sat.t.u-tokyo.ac.jp (8.8.8/8.7.3)
	id EAA21414; Mon, 21 Sep 1998 04:34:36 +0900 (JST)
Message-Id: <199809201934.EAA21414@odin.sat.t.u-tokyo.ac.jp>
Date: Mon, 21 Sep 1998 04:34:36 +0900 (JST)
From: Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp>
Reply-To: hideyuki@sat.t.u-tokyo.ac.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: moused: wheel mode button support
X-Send-Pr-Version: 3.2

>Number:         8001
>Category:       bin
>Synopsis:       moused: wheel mode button support
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 20 12:40:00 PDT 1998
>Closed-Date:    Fri Nov 20 03:22:41 PST 1998
>Last-Modified:  Fri Nov 20 03:23:22 PST 1998
>Originator:     Hideyuki Suzuki
>Release:        FreeBSD 2.2.7-STABLE i386
>Organization:
Univ. of Tokyo
>Environment:

 - FreeBSD 2.2.7-STABLE
 - trackball with wheel mode button, such as Logitech TrackMan Marble FX.

>Description:

I made a patch for moused to have the following option:

     -w N    Treat the physical button N as a wheel mode button.  While this
             button is pressed, X and Y axis movement is reported to be zero
             and Y axis movement is mapped to Z axis.  You may map this move-
             ment to virtual buttons with the -z option.


Wheel mode button on TrackMan Marble FX is reported as a button 4
from normal moused.  But with the -w option,

  moused -p /dev/psm0 -w 4 -z 4

enables you to use scrolling functionality on X Window System.

>How-To-Repeat:

>Fix:
	
Apply the following patch in src/usr.sbin/moused.
moused.c and moused.8 are modified.

I have not checked if this modification works on 3.0-CURRENT environment,
but this patch can be applied cleanly.


Index: moused.8
===================================================================
RCS file: /pub/FreeBSD-CVS/src/usr.sbin/moused/moused.8,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 moused.8
--- moused.8	1998/03/13 11:21:15	1.1.2.5
+++ moused.8	1998/09/20 18:50:19
@@ -273,6 +273,13 @@
 This is the only protocol type available for the PS/2 mouse
 and should be specified for any PS/2 mice, regardless of the brand.
 .El
+.It Fl w Ar N
+Treat the physical button
+.Ar N
+as a wheel mode button.
+While this button is pressed, X and Y axis movement is reported to be zero
+and Y axis movement is mapped to Z axis.
+You may map this movement to virtual buttons with the -z option.
 .It Fl z Ar target
 Map Z axis (roller/wheel) movement to another axis or to virtual buttons.
 Valid
Index: moused.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/usr.sbin/moused/moused.c,v
retrieving revision 1.4.2.7
diff -u -r1.4.2.7 moused.c
--- moused.c	1998/03/13 11:21:18	1.4.2.7
+++ moused.c	1998/09/20 18:01:21
@@ -336,6 +336,7 @@
     int rate;			/* report rate */
     int resolution;		/* MOUSE_RES_XXX or a positive number */
     int zmap;			/* MOUSE_{X|Y}AXIS or a button number */
+    int wmode;			/* wheel mode button number */
     int mfd;			/* mouse file descriptor */
     int cfd;			/* /dev/consolectl file descriptor */
     long clickthreshold;	/* double click speed in msec */
@@ -350,6 +351,7 @@
     rate : 0,
     resolution : MOUSE_RES_UNKNOWN, 
     zmap: 0,
+    wmode: 0,
     mfd : -1,
     cfd : -1,
     clickthreshold : 500,	/* 0.5 sec */
@@ -393,7 +395,7 @@
     int c;
     int	i;
 
-    while((c = getopt(argc,argv,"3C:DF:I:PRS:cdfhi:l:m:p:r:st:z:")) != -1)
+    while((c = getopt(argc,argv,"3C:DF:I:PRS:cdfhi:l:m:p:r:st:w:z:")) != -1)
 	switch(c) {
 
 	case '3':
@@ -473,6 +475,14 @@
 	    rodent.baudrate = 9600;
 	    break;
 
+	case 'w':
+	    i = atoi(optarg);
+	    if ((i <= 0) || (i > MOUSE_MAXBUTTON)) {
+		warnx("invalid argument `%s'", optarg);
+		usage();
+	    }
+	    rodent.wmode = 1 << (i - 1);
+
 	case 'z':
 	    if (strcmp(optarg, "x") == 0)
 		rodent.zmap = MOUSE_XAXIS;
@@ -1560,6 +1570,11 @@
     lbuttons = 0;
 
     act2->obutton = act2->button;
+    if (pbuttons & rodent.wmode) {
+	act1->dz = act1->dy;
+	act1->dx = 0;
+	act1->dy = 0;
+    }
     act2->dx = act1->dx;
     act2->dy = act1->dy;
     act2->dz = act1->dz;
>Release-Note:
>Audit-Trail:

From: Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/8001: moused: wheel mode button support
Date: Mon, 21 Sep 1998 05:00:56 +0900

 Sorry, please insert "break;" before "case 'z':"...
State-Changed-From-To: open->closed 
State-Changed-By: yokota 
State-Changed-When: Fri Nov 20 03:22:41 PST 1998 
State-Changed-Why:  
Support added to 3.0-CURRENT.  Thanks. 
>Unformatted:
