From nobody@FreeBSD.org  Sun Sep 22 00:19:38 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 52CAD37B401
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 22 Sep 2002 00:19:38 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CB76343E65
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 22 Sep 2002 00:19:37 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g8M7Jb7R096177
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 22 Sep 2002 00:19:37 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g8M7JbuO096175;
	Sun, 22 Sep 2002 00:19:37 -0700 (PDT)
Message-Id: <200209220719.g8M7JbuO096175@www.freebsd.org>
Date: Sun, 22 Sep 2002 00:19:37 -0700 (PDT)
From: Siegbert Baude <siegbert.baude@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: X doesn't receive button #7 from moused's /dev/sysmouse
X-Send-Pr-Version: www-1.0

>Number:         43232
>Category:       ports
>Synopsis:       X doesn't receive button #7 from moused's /dev/sysmouse
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    anholt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 22 00:20:02 PDT 2002
>Closed-Date:    Thu Jan 23 20:26:25 PST 2003
>Last-Modified:  Thu Jan 23 20:26:25 PST 2003
>Originator:     Siegbert Baude
>Release:        RELENG_4
>Organization:
>Environment:
FreeBSD myip.mydomain 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #2: Thu Sep  5 20:02:17 CEST 2002 toor@myip.mydomain:/usr/obj/usr/src/sys/MYCOMP  i386
>Description:
If you map any button to button #7 on the command line of moused, you get the correct events on the console (using the -fd flags for moused). But within X the events of button #7 are simply ignored as you can check with xev.

This is with a Microsoft IntelliMouse Optical on XFree86-4.2.0_1,1 but I saw the same behaviour along the whole XFree86-4.x line. I never checked this for XFree86-3.x

The conventional approach i.e. configuring only X (and no additional -m flags for moused) to map the ZAxis and changing buttons 6/7 with 4/5 with xmodmap works however. All 7 buttons are received then by xev.

Also not using moused at all, but pointing X directly to the correct device works for all seven buttons.
>How-To-Repeat:
root # moused -fd -p /dev/psm0 -t auto -m 7=3
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/psm0  interface: ps/2  type: sysmouse  model: IntelliMouse Explorer
[snip] Pressing mouse button #3 here, which is now mapped to #7
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,0,7f
moused: tv:  1032678418 792660
moused: flags:00000004 buttons:00000000 obuttons:00000004
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[6]->count:1
moused: button 7  count 0


But xev sees only buttons up to #6. #7 is silently ignored.

Relevant lines of /etc/X11/XF86Config:

Section "InputDevice"
        Identifier  "MS IntelliMouse Optical"
        Driver      "mouse"
        Option      "Protocol" "Auto"
        Option      "Device" "/dev/sysmouse"
        Option      "Buttons" "7"
EndSection
>Fix:
      
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->anholt 
Responsible-Changed-By: ijliao 
Responsible-Changed-When: Sun Sep 22 11:07:18 PDT 2002 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43232 

From: Eric Anholt <eta@lclark.edu>
To: Siegbert Baude <siegbert.baude@gmx.de>
Cc: gnats <freebsd-gnats-submit@FreeBSD.ORG>
Subject: Re: ports/43232: X doesn't receive button #7 from moused's
	/dev/sysmouse
Date: 10 Jan 2003 03:41:01 +0000

 --=-IEfg+otynMTzo9eSOaDm
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 
 The following patch fixed it for me, and I'll be submitting it to
 XFree86.  However, due to ports freeze it will have to wait until
 post-5.0.
 
 -- 
 Eric Anholt                                eta@lclark.edu          
 http://people.freebsd.org/~anholt/dri/     anholt@FreeBSD.org
 
 --=-IEfg+otynMTzo9eSOaDm
 Content-Disposition: attachment; filename=xmousediff
 Content-Type: text/x-patch; name=xmousediff; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Index: files/patch-mouse.c
 ===================================================================
 RCS file: /home/ncvs/ports/x11/XFree86-4-libraries/files/patch-mouse.c,v
 retrieving revision 1.1
 diff -u -u -r1.1 patch-mouse.c
 --- files/patch-mouse.c	5 Aug 2002 07:33:22 -0000	1.1
 +++ files/patch-mouse.c	9 Jan 2003 22:48:30 -0000
 @@ -1,11 +1,13 @@
 ---- programs/Xserver/hw/xfree86/input/mouse/mouse.c.orig	Wed Dec 19 08:05:22 2001
 -+++ programs/Xserver/hw/xfree86/input/mouse/mouse.c	Fri Aug  2 15:35:01 2002
 -@@ -1505,7 +1505,7 @@
 +--- programs/Xserver/hw/xfree86/input/mouse/mouse.c.orig	Wed Dec 19 16:05:22 2001
 ++++ programs/Xserver/hw/xfree86/input/mouse/mouse.c	Thu Jan  9 22:48:18 2003
 +@@ -1505,8 +1505,8 @@
   	    dy = - ((char)(pBuf[2]) + (char)(pBuf[4]));
   	    /* FreeBSD sysmouse sends additional data bytes */
   	    if (pMse->protoPara[4] >= 8) {
  -		dz = ((char)(pBuf[5] << 1) + (char)(pBuf[6] << 1)) / 2;
 +-		buttons |= (int)(~pBuf[7] & 0x07) << 3;
  +		dz = ((signed char)(pBuf[5] << 1) + (signed char)(pBuf[6] << 1)) >> 1;
 - 		buttons |= (int)(~pBuf[7] & 0x07) << 3;
 ++		buttons |= (int)(~pBuf[7] & 0x7f) << 3;
   	    }
   	    break;
 + 
 
 --=-IEfg+otynMTzo9eSOaDm--
 
State-Changed-From-To: open->closed 
State-Changed-By: anholt 
State-Changed-When: Thu Jan 23 20:19:13 PST 2003 
State-Changed-Why:  
Fix has been committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43232 
>Unformatted:
