Subject: Re: amd64 and bluetooth -current
To: Juan RP <juan@xtrarom.org>
From: Iain Hibbert <plunky@rya-online.net>
List: current-users
Date: 08/15/2007 21:39:37
On Wed, 15 Aug 2007, Juan RP wrote:

> On Wed, 15 Aug 2007 18:22:47 +0100 (BST)
> Iain Hibbert <plunky@rya-online.net> wrote:
>
> > my memory was fine, the spec does say that the bluetooth packet is
> > supposed to be contained in a single USB transaction. I wonder if packets
> > are being catenated somehow, can you post the output when the attached
> > patch is applied to ubt.c?
>
> Hi, sure... but you forgot to attach the patch.

whoops :)

iain

--- /usr/src/sys/dev/usb/ubt.c	2007-03-31 14:37:33.000000000 +0100
+++ ubt.c	2007-08-15 18:16:54.000000000 +0100
@@ -1434,6 +1434,22 @@
 			DPRINTF("dumped undersized packet (%d)\n", count);
 			sc->sc_unit.hci_stats.err_rx++;
 		} else {
+			hci_acldata_hdr_t hdr;
+
+			memcpy(&hdr.con_handle, buf, sizeof(hdr) - 1);
+			hdr.length = le16toh(hdr.length);
+			if (hdr.length + sizeof(hdr) != count + 1) {
+				int c = count;
+				uint8_t *b = buf;
+
+				printf("ACL hdr.length (%d) does not match xfer count (%d)\n", hdr.length, count);
+
+				while (c-- > 0)
+					printf("%02x ", *b++);
+
+				printf("\n");
+			}
+
 			sc->sc_unit.hci_stats.acl_rx++;
 			sc->sc_unit.hci_stats.byte_rx += count;