From owner-freebsd-usb@FreeBSD.ORG Sun Mar 21 12:03:29 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 1D49F1065679 for ; Sun, 21 Mar 2010 12:03:29 +0000 (UTC) (envelope-from mailinglists@martinlaabs.de) Received: from relay01.alfahosting-server.de (relay01.alfahosting-server.de [80.86.191.73]) by mx1.freebsd.org (Postfix) with ESMTP id A184E8FC20 for ; Sun, 21 Mar 2010 12:03:28 +0000 (UTC) Received: by relay01.alfahosting-server.de (Postfix, from userid 1001) id DEE792006DC23; Sun, 21 Mar 2010 13:03:26 +0100 (CET) X-Spam-DCC: : X-Spam-Level: X-Spam-Status: No, score=0.3 required=7.0 tests=FORGED_RCVD_HELO, NO_DNS_FOR_FROM autolearn=disabled version=3.1.7-deb3 Received: from alfa3018.alfahosting-server.de (alfa3018.alfahosting-server.de [82.197.146.36]) by relay01.alfahosting-server.de (Postfix) with ESMTP id 4282D2006DB6C; Sun, 21 Mar 2010 13:03:24 +0100 (CET) Received: from pc.martinlaabs.de (p5B0EE50D.dip.t-dialin.net [91.14.229.13]) by alfa3018.alfahosting-server.de (Postfix) with ESMTP id 04818515C778; Sun, 21 Mar 2010 13:03:23 +0100 (CET) Message-ID: <4BA60B0A.3040005@martinlaabs.de> Date: Sun, 21 Mar 2010 13:03:22 +0100 From: Martin Laabs User-Agent: Thunderbird 2.0.0.23 (X11/20091224) MIME-Version: 1.0 To: hselasky@c2i.net References: <4BA52239.8000300@martinlaabs.de> <201003211134.28085.hselasky@c2i.net> In-Reply-To: <201003211134.28085.hselasky@c2i.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Status: No X-Virus-Checker-Version: clamassassin 1.2.4 with ClamAV 0.94.2/10603/Sat Mar 20 23:42:52 2010 Cc: freebsd-usb@freebsd.org 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 12:03:29 -0000 Hello Hans, Hans Petter Selasky wrote: > 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. Unfortunately the linux-js driver creates a new device in /dev/input which is IMHO impossible for a userland program. So I have to detect the usb devices in kernel space. If that is not desirable, we > can add that information like an IOCTL. usbconfig show_ifdrv might also give > you some clues. Yes - in fact. I.e. the output I am interested in is ugen2.2.0: uhid0: Now I could figure out that ugen2.2.0 has idVendor=0x046d idProduct=0xc215 with usbconfig dump_device_desc. After that the driver would check that ids against its database and if it would match it would use the /dev/uhid0 device. (with kopen - see below) > Doesn't the linux-js joystick driver already have a parser for HID descriptors > and more? No. Unfortunately it has a database of vendor and product IDs of devices it supports. > You might find the following function useful to detach the /dev/uhidX driver. Well. As far as I understand the linux-js driver for now it relies on the uhid driver. After checking the /dev/uhidX devices agains its vendor/product database it opens the /dev/uhidX device via kopen an do its manipulations on it. A bit crapy but that way it can support many different physical ports without having to much overhead. (Soundcard joystick port, serial, parallel and also the usb port) Do you think it is much effort to add a ioctl to the uhid driver that reports the corresponding usb_device_info struct? This would make porting the linux-js driver much more simple for me. Or is there a (simple accessible) data structure inside the kernel where I can get the information which vendor/product id correspond to a uhidX attached device? Thank you, Martin Laabs