On Tue, May 3, 2011 at 12:23 PM, David Demelier
<[email protected]> wrote:
>>>>> I'm sorry to disturb you again.. I'm still guessin where to search how
>>>>> to
>>>>> get these horizontal events with my bluetooth mouse. I thing the
>>>>> mouse_info
>>>>> structure does not need to be extended I have a USB mouse that has the
>>>>> same
>>>>> horizontal buttons and they just works !
>>>>>
>>>>> They sends 7 and 8 events to X (checked with xev)
>>>>>
>>>>> What can I do to extend bthidd and this button support ?
>>>>
>>>> like i said before, you need to decode AC_Pan data from the report. i
>>>> just took a quick look at ums(4) driver and, it appears, that AC_Pan
>>>> events are translated into button events, i.e. values<    0 is mask (1
>>>> <<    3) and values>    0 is mask (1<<    4) . you can add identical
>>>> translation to bthidd(8) to see if it works. you will need to modify
>>>> hid_interrupt() function in hid.c
>>>
>>> Max,
>>>
>>> I successfully made the patch but it's not the same mask. This diff just
>>> works!
>>>
>>> --- hid.c.orig  2011-05-02 22:09:48.000000000 +0200
>>> +++ hid.c       2011-05-03 20:57:46.000000000 +0200
>>> @@ -168,6 +168,16 @@
>>>                usage = HID_USAGE(h.usage);
>>>                val = hid_get_data(data,&h);
>>>
>>> +               /* Horizontal buttons */
>>> +               if (page == HUP_CONSUMER&&  usage == HUC_AC_PAN) {
>>> +                       if (val<  0)
>>> +                               mouse_butt |= (1<<  5);
>>> +                       else if (val>  0)
>>> +                               mouse_butt |= (1<<  6);
>>> +
>>> +                       mevents ++;
>>> +               }
>>> +
>>>                switch (page) {
>>>                case HUP_GENERIC_DESKTOP:
>>>                        switch (usage) {
>>>
>>> Do you think it's a diff suitable to commit ?
>>>
>>> I'm so happy to make my horizontal buttons working :):)
>>
>> ah, i see you already figured it out :) i can commit something like
>> this, i suppose. i would just move the statement into switch() below.
>> i suppose we could just document that ac_pan is encoded as 8 and 9
>> button presses.
>>
>
> Yes but why is the mask different from the ums ones ? Also can you commit
> this to -STABLE thus I'll be able to use it without patching it.

i *think* its because usb mouse operates on level1 (see mouse(4) for
details), and, status for "extended" mouse buttons reported
separately, i.e. from mouse(4) man page: byte 8, bits 0-6 reflect the
state of the buttons 4-10.

i can not commit this directly to -stable. i need to commit this to
-head first and then mfc it after a week or so.

i'm attaching a slightly different patch (dont worry you still get all
the credit). please try it and let me know if it works for you.

thanks,
max
Index: hid.c
===================================================================
--- hid.c       (revision 221400)
+++ hid.c       (working copy)
@@ -229,6 +229,16 @@
                                break;
 
                        switch (usage) {
+                       case HUC_AC_PAN:
+                               /* Horizontal scroll */
+                               if (val < 0)
+                                       mouse_butt |= (1 << 5);
+                               else
+                                       mouse_butt |= (1 << 6);
+
+                               mevents ++;
+                               break;
+
                        case 0xb5: /* Scan Next Track */
                                val = 0x19;
                                break;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "[email protected]"

Reply via email to