Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Sep 1998 04:34:36 +0900 (JST)
From:      Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8001: moused: wheel mode button support
Message-ID:  <199809201934.EAA21414@odin.sat.t.u-tokyo.ac.jp>

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

>Number:         8001
>Category:       bin
>Synopsis:       moused: wheel mode button support
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 20 12:40:00 PDT 1998
>Last-Modified:
>Originator:     Hideyuki Suzuki
>Organization:
Univ. of Tokyo
>Release:        FreeBSD 2.2.7-STABLE i386
>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;
>Audit-Trail:
>Unformatted:

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



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