From owner-freebsd-usb@FreeBSD.ORG Tue Jul 28 15:50:04 2009 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33797106566C for ; Tue, 28 Jul 2009 15:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0812A8FC08 for ; Tue, 28 Jul 2009 15:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n6SFo3Hf084606 for ; Tue, 28 Jul 2009 15:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n6SFo3va084603; Tue, 28 Jul 2009 15:50:03 GMT (envelope-from gnats) Date: Tue, 28 Jul 2009 15:50:03 GMT Message-Id: <200907281550.n6SFo3va084603@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Eygene Ryabinkin Cc: Subject: Re: usb/137189: [usb][patch] create and use sysctl nodes for HID report descriptors X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eygene Ryabinkin List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2009 15:50:04 -0000 The following reply was made to PR usb/137189; it has been noted by GNATS. From: Eygene Ryabinkin To: bug-followup@FreeBSD.org, freebsd-usb@FreeBSD.org Cc: hselasky@c2i.net Subject: Re: usb/137189: [usb][patch] create and use sysctl nodes for HID report descriptors Date: Tue, 28 Jul 2009 19:40:27 +0400 HPS wrote: > > I can, but how to relate the device name under devfs to the descriptor > > to be retrieved? > > By unit number and device address, like usbconfig. Yes, but these numbers are the ugen ones; on my system, for example, ums0 maps to ugen5.3.0. >> I can enumerate all HID descriptors via libusb, but I > > can't currently say which device uses them. > > Try: > > usbconfig show_ifdrv Yes, that's better. But can I rely that the first item in the output of the libusb20_dev_get_iface_desc() will be the device name? And still, to get the report descriptor from one device, I should walk the entire USB tree until I'll find the device I am interested in. May be there are some other ways? I understand that enumeration is the principle of the USB bus, but may be there are another ways to directly grab 'struct libusb20_device *' or alike for the devfs node I am interested in? > > Why do you dislike the sysctl approach? It is simple and reliable. > > It's duplicating access to data. There is not that much wrong about > it, except it will not work if the device is of another kind. I.E. you > would have to patch the HID sysctl node into every driver accessing > HID descriptors? Just now -- yes, I'll need it. But probably I can move this functionality into the USB bus level -- it will automatically create this sysctl node for all HID children and will dispose it on the detach. usb_probe_and_attach() is a candidate for such functionality. Will it be bad? -- Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook {_.-``-' {_/ #