bin/94577: Wrong mouse button mapping in bthidd

Krzysztof Jedruczyk beaker at hot.pl
Thu Mar 16 23:21:15 UTC 2006


>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 at 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:


More information about the freebsd-bugs mailing list