From owner-freebsd-usb@FreeBSD.ORG Sun Mar 21 10:36:15 2010 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 AD9E8106566B for ; Sun, 21 Mar 2010 10:36:15 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.swip.net [212.247.154.97]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7398FC0A for ; Sun, 21 Mar 2010 10:36:14 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=DyMvu_kyN-YA:10 a=8nJEP1OIZ-IA:10 a=M8b_wTzEtboA:10 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=ASafugbVwNTpNYR162AA:9 a=f42LVBmSmOtKDKWRJXkA:7 a=R1UsRaeXxtn-73H5FYHHsPLAivIA:4 a=wPNLvfGTeEIA:10 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe04.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 1349469973; Sun, 21 Mar 2010 11:36:12 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sun, 21 Mar 2010 11:34:28 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-STABLE; KDE/4.3.4; amd64; ; ) References: <4BA52239.8000300@martinlaabs.de> In-Reply-To: <4BA52239.8000300@martinlaabs.de> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003211134.28085.hselasky@c2i.net> Cc: Subject: Re: Find Vendor/Product ID from uhid device 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: Sun, 21 Mar 2010 10:36:15 -0000 On Saturday 20 March 2010 20:30:01 Martin Laabs wrote: > Hi, > > I'am currently porting the linux-js joystick driver to the new USB stack. > Since this driver operates on top other drivers (in the case of USB ontop > the uhid driver) it needs to figure out whether /dev/uhid* is a device it > can operate on. > The driver scans all /dev/uhidX entries and compares the vendor and product > id against a table. In the old stack this was possible through scanning all > /dev/ugenX devices, get the device_info struct and compare the > udi_devnames[] against the "uhidX" string. > However - the udi_devname string disappeared in the new usb stack and this > way seems to be not open anymore for me. > Can you give me a hint how to figure the vendor and product id of a > /dev/uhidX device. > Hi, I would recommend you use libusb in userland to do this. Then you get all the information you need for the ID-match and more. If that is not desirable, we can add that information like an IOCTL. usbconfig show_ifdrv might also give you some clues. Currently the libusb20 interface is the most stable. Doesn't the linux-js joystick driver already have a parser for HID descriptors and more? man libusb20 You might find the following function useful to detach the /dev/uhidX driver. Currently only implemented in 9-current, but present in 8-release: libusb20_dev_detach_kernel_driver(pdev, iface_index); --HPS