From owner-freebsd-current@FreeBSD.ORG Thu Jan 22 12:25:25 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2D6A106564A for ; Thu, 22 Jan 2009 12:25:25 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe15.tele2.se [212.247.155.193]) by mx1.freebsd.org (Postfix) with ESMTP id 4314C8FC08 for ; Thu, 22 Jan 2009 12:25:24 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=ZeQXTuWxVp8A:10 a=9SoDCewf83AA:10 a=6I5d2MoRAAAA:8 a=wFY8NPiWzHpwMhGTkKQA:9 a=_RFrpVCOhL5KX3PPFOAA:7 a=ElBhBl80HBhwSud5mx87V6s6y6cA:4 a=LY0hPdMaydYA:10 Received: from [85.19.218.115] (account mc467741@c2i.net HELO [10.37.1.92]) by mailfe15.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 438301621; Thu, 22 Jan 2009 13:25:23 +0100 From: Hans Petter Selasky To: freebsd-current@freebsd.org Date: Thu, 22 Jan 2009 13:27:45 +0100 User-Agent: KMail/1.9.7 References: <4978598E.80800@ongs.co.jp> In-Reply-To: <4978598E.80800@ongs.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901221327.47634.hselasky@c2i.net> Cc: Daichi GOTO , Masanori OZAWA Subject: Re: USB2: ugd round bug? including patch to solve. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2009 12:25:25 -0000 On Thursday 22 January 2009, Daichi GOTO wrote: > Hi USB2 folks ;-) > > First I should show you my big respect. Thank you very much for your > great usb2 work. That works very well. > > Using usb2, I have found a issue around uhid. ugd will be zero-cleared > when ioctl(fd, USB_GET_REPORT_DESC, &ugd) is called. > > For example, follow ioctl are used to get information of report descriptor. > > memset(&ugd, 0, sizeof(ugd)); > ugd.ugd_data = malloc(len); > ugd.ugd_maxlen = len; > > ioctl(fd, USB_GET_REPORT_DESC, &ugd) > > The information of report descriptor should be copied to ugd, but ugd is > zero-cleared. > > From my research, perphaps follow patch is good solution to solve this > problem. How do you usb2 guys make of this? Please check and solve > this issue. Thanks :) Hi Daichi! Your patch is absolutely correct! Committed to P4. Will reach -current early next week! http://perforce.freebsd.org/chv.cgi?CH=156515 Thanks for testing and finding bugs! --HPS > --- sys/dev/usb2/include/usb2_ioctl.h.orig 2009-01-22 > 20:11:13.000000000 +0900 +++ sys/dev/usb2/include/usb2_ioctl.h 2009-01-22 > 20:09:35.000000000 +0900 @@ -223,7 +223,7 @@ > #define USB_DEVICEENUMERATE _IOW ('U', 6, int) > > /* Generic HID device */ > -#define USB_GET_REPORT_DESC _IOR ('U', 21, struct > usb2_gen_descriptor) +#define USB_GET_REPORT_DESC _IOWR('U', 21, > struct usb2_gen_descriptor) #define USB_SET_IMMED _IOW > ('U', 22, int) > #define USB_GET_REPORT _IOWR('U', 23, struct > usb2_gen_descriptor) #define USB_SET_REPORT _IOW ('U', 24, > struct usb2_gen_descriptor)