From owner-freebsd-usb@FreeBSD.ORG Tue Aug 25 01:59:01 2009 Return-Path: Delivered-To: freebsd-usb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3797106568B; Tue, 25 Aug 2009 01:59:01 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id 423C48FC14; Tue, 25 Aug 2009 01:59:01 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.69) (envelope-from ) id 1MflJN-0006TG-1p; Tue, 25 Aug 2009 05:59:01 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 73999B860; Tue, 25 Aug 2009 05:58:59 +0400 (MSD) Received: by hades.panopticon (Postfix, from userid 1000) id C6714108842; Tue, 25 Aug 2009 05:58:45 +0400 (MSD) Date: Tue, 25 Aug 2009 05:58:45 +0400 From: Dmitry Marakasov To: gavin@FreeBSD.org Message-ID: <20090825015845.GB26981@hades.panopticon> References: <200908241557.n7OFvuT1052755@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200908241557.n7OFvuT1052755@freefall.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-usb@FreeBSD.org Subject: Re: usb/101761: [usb67] [patch] [request] usb.h: increase maximal size of report descriptor X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 01:59:01 -0000 * gavin@FreeBSD.org (gavin@FreeBSD.org) wrote: > To submitter: I'm not sure what the state is of this PR. It looks like the > problem has not yet been fixed in FreeBSD 6 or 7, but I don't know if it is > still an issue with the new USB stack in 8.x. Do you happen to know if this > PR is still valid against the new USB stack? Thanks! ...after some digging.... First of all, my joystick seem to have at least two reports. Report #0 is empty, report #1 has actual axis/button/... data. With regard to that, usbhidctl is buggy. First of all, static int reportid variable is never written to but is read in 3 places. It seems like it's initialized with zero, and thus the utility tries to work with report #0, giving no data. It seems like reportid should be initialized to -1 which I suppose reports all report secrs. Also, there should be a way to select specific report id with command line flags (likely that was intended usege for this variable). After initializing reportid to -1 I can get report descriptor, and yes, answering original question, it is not truncated. Judging from code rc/lib/libusbhid/descr.c:hid_get_report_desc, the upper limit is now 65535 bytes, which is enough for my device with 1343 byte report descr. However, after using -1 as reportid, usbhidctl still reports wrong sizes: Total input size 0 bytes Total output size 0 bytes Total feature size 0 bytes likely that's because hid_report_size() is called with id=0 (not even reportid). Seems like it doesn't work with id=-1 as well, so the correct way is likely to get sizes from hid_item structs. In either case, libusbhid seems to lack a way to get a number of reports to be able to parse them one by one. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru