usb/101761: [patch] usb.h: increase maximal size of report descriptor

Dmitry Marakasov amdmi3 at mail.ru
Thu Aug 10 14:50:25 UTC 2006


>Number:         101761
>Category:       usb
>Synopsis:       [patch] usb.h: increase maximal size of report descriptor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 10 14:50:24 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 6.1-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 #1: Tue Aug 8 17:11:07 MSD 2006 amdmi3 at hades.panopticon:/usr/obj/usr/src/sys/HADES i386

>Description:
In the struct usb_ctl_report_desc there's hardcoded limit to report descriptor size (1024 bytes).
That's theoretically bad, as maximum descriptor size is not defined in the HID spec and descriptor may not fit into 1024 bytes.
In practice, I have at least one device that has descriptor size > 1024.
That's `uhid1: Microsoft SideWinder Force Feedback 2 Joystick, rev 1.10/a.00, addr 3, iclass 3/0', and it has 1343 byte long report descriptor. So, as a temporal fix, I suggest to double maximum report size.

Maybe the number should be risen even more (64k should be enough for any sane report descriptor), as I don't know if there's any way to dynamically allocate buffer for the descriptor.
Note, that this change will break ABI compatibility (as value of USB_GET_REPORT_DESC depends of sizeof(struct usb_ctl_report_desc)), and all software that includes <dev/usb/usb.h> should be recompiled, so UPDATING entry should be added.

>How-To-Repeat:
>Fix:

--- usb.h.patch begins here ---
--- src/sys/dev/usb/usb.h.orig	Thu Aug 10 18:22:01 2006
+++ src/sys/dev/usb/usb.h	Thu Aug 10 18:21:32 2006
@@ -589,7 +589,7 @@
 
 struct usb_ctl_report_desc {
 	int	ucrd_size;
-	u_char	ucrd_data[1024];	/* filled data size will vary */
+	u_char	ucrd_data[2048];	/* filled data size will vary */
 };
 
 typedef struct { u_int32_t cookie; } usb_event_cookie_t;
--- usb.h.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-usb mailing list