Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 May 2010 11:57:18 +0200
From:      Kai Wang <kaiwang27@gmail.com>
To:        Alex Deiter <alex.deiter@gmail.com>
Cc:        freebsd-bluetooth@freebsd.org, current@freebsd.org, freebsd-usb@freebsd.org, hps@freebsd.org
Subject:   Re: Revision 205728: broken bluetooth mouse support
Message-ID:  <20100507095718.GA3047@viskning>
In-Reply-To: <o2o9d62ab9a1005061458i77cb4765waa5c0ac035a6bff7@mail.gmail.com>
References:  <o2o9d62ab9a1005061458i77cb4765waa5c0ac035a6bff7@mail.gmail.com>

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

--huq684BweRXVnRxX
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

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

--huq684BweRXVnRxX
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="bthidd.txt"

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;

--huq684BweRXVnRxX--



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