On Fri, May 07, 2010 at 01:58:13AM +0400, Alex Deiter wrote:
> Hi,
> 
> Bluetooth mouse support is broken after Revision 205728:
> 
> http://svn.freebsd.org/viewvc/base?view=revision&revision=205728
> 
> When I move the mouse  - cursor stays in same place but moves the
> current position of the console.
> 
> Proposed patch as an attachment. Could you please revew this ?

Hi Alex,

If we adopt your patch, usbhidctl(1) and usbhidaction(1) will be
broken again on device with multiple report IDs.

Could you please try if the attached patch for the bthidd(8)
daemon works as well?

Thanks,
Kai
Index: usr.sbin/bluetooth/bthidd/hid.c
===================================================================
--- usr.sbin/bluetooth/bthidd/hid.c     (revision 207113)
+++ usr.sbin/bluetooth/bthidd/hid.c     (working copy)
@@ -130,7 +130,7 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in
        hid_item_t      h;
        int32_t         report_id, usage, page, val,
                        mouse_x, mouse_y, mouse_z, mouse_butt,
-                       mevents, kevents;
+                       mevents, kevents, i;
 
        assert(s != NULL);
        assert(s->srv != NULL);
@@ -150,8 +150,8 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in
        }
 
        report_id = data[1];
-       data += 2;
-       len -= 2;
+       data ++;
+       len --;
 
        hid_device = get_hid_device(&s->bdaddr);
        assert(hid_device != NULL);
@@ -202,17 +202,11 @@ hid_interrupt(bthid_session_p s, uint8_t *data, in
                                if (val && val < kbd_maxkey())
                                        bit_set(s->keys1, val);
 
-                               data ++;
-                               len --;
-
-                               len = min(len, h.report_size);
-                               while (len > 0) {
+                               for (i = 1; i < h.report_count; i++) {
+                                       h.pos += h.report_size;
                                        val = hid_get_data(data, &h);
                                        if (val && val < kbd_maxkey())
                                                bit_set(s->keys1, val);
-
-                                       data ++;
-                                       len --;
                                }
                        }
                        break;
_______________________________________________
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to