Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2006 15:31:40 GMT
From:      Krzysztof Jedruczyk <beaker@hot.pl>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/94577: Wrong mouse button mapping in bthidd
Message-ID:  <200603161531.k2GFVexq037551@www.freebsd.org>
Resent-Message-ID: <200603162320.k2GNKb5o016469@freefall.freebsd.org>

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

>Number:         94577
>Category:       bin
>Synopsis:       Wrong mouse button mapping in bthidd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 16 23:20:37 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Krzysztof Jedruczyk
>Release:        6.1-PRERELEASE
>Organization:
>Environment:
FreeBSD pipboy2000 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #3: Wed Mar 15 12:59:31 CET 2006     beaker@pipboy2000:/usr/obj/usr/src/sys/PIPBOY  i386
>Description:
Connecting bluetooth mouse through bthidd daemon gives wrong button mapping: right button is swapped with middle button.

Looking at HID Usage Tables and 'xev' output it seems to me HID that hid "usage" value is incorrectly being used as button index. Since ps2 mouse seems to map right button to 3 and middle button to 2, apropriate fixup has to be done (similar fixup seems to be done in ums.c). Following patch makes all 5 butons work in my setup (including mouse wheel buttons).
>How-To-Repeat:
Just configure bthid mouse and try to invoke right-click action in some graphical interface.
>Fix:
--- /usr/src/usr.sbin/bluetooth/bthidd/hid.c.orig       Sun Mar 12 22:04:51 2006
+++ /usr/src/usr.sbin/bluetooth/bthidd/hid.c    Sun Mar 12 22:04:54 2006
@@ -130,6 +130,8 @@
                        mouse_x, mouse_y, mouse_z, mouse_butt,
                        mevents, kevents;

+#define HID_BUT(i) ((i) < 3 ? (((i) ^ 3) % 3) : (i))
+
        assert(s != NULL);
        assert(s->srv != NULL);
        assert(data != NULL);
@@ -216,7 +218,7 @@
                        break;

                case HUP_BUTTON:
-                       mouse_butt |= (val << (usage - 1));
+                       mouse_butt |= (val << HID_BUT(usage - 1));
                        mevents ++;
                        break;





>Release-Note:
>Audit-Trail:
>Unformatted:



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