From owner-freebsd-usb@FreeBSD.ORG Mon Sep 15 12:07:29 2014 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00C0F740 for ; Mon, 15 Sep 2014 12:07:28 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8061987 for ; Mon, 15 Sep 2014 12:07:28 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 42A831FE027; Mon, 15 Sep 2014 14:07:26 +0200 (CEST) Message-ID: <5416D673.5010001@selasky.org> Date: Mon, 15 Sep 2014 14:07:15 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Vitaly Magerya , freebsd-usb@freebsd.org Subject: Re: How to obtain the "ugen" that corresponds to an "ums", "uep" or "uhid"? References: <5416D0E8.3030806@gmail.com> In-Reply-To: <5416D0E8.3030806@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2014 12:07:29 -0000 On 09/15/14 13:43, Vitaly Magerya wrote: > Hi, folks. Is there a way to obtain the name of an ugen device that > corresponds to a particular ums/uep/uhid device? Hi, Have you tried: usbconfig show_ifdrv > The situation I'm working with is this: there's a (custom) DEVD > rule that executes a script when any new "ums" or "uhid" device is > created. This script has access to the device name (and any other > info DEVD provides), and needs to figure out manufacturer name, > product name and ID numbers of this device. To do that, it parses > the output of this command: > > usbconfig -d ugen.
dump_device_desc > > The question is how should the script obtain these and >
numbers? > > Now, when a new device is attached DEVD receives a message like this: > > +uhid0 at bus=1 hubaddr=1 port=3 devaddr=2 interface=0 > vendor=0x0079 product=0x0011 devclass=0x00 devsubclass=0x00 > sernum="" release=0x0106 mode=host intclass=0x03 intsubclass=0x00 > intprotocol=0x00 on uhub0 > > (The correct ugen for this device happens to be ugen3.2). > > ... or a message like this: > > +ums0 at bus=0 hubaddr=2 port=2 devaddr=3 interface=1 > vendor=0x046d product=0xc52b devclass=0x00 devsubclass=0x00 > sernum="" release=0x1201 mode=host intclass=0x03 intsubclass=0x01 > intprotocol=0x02 on uhub3 > > (In this case the correct ugen is ugen0.3). > > It seems that we have the correct
number in the "devaddr" > variable, but the correct number is nowhere to be found. > That might be a bug. We can easily add a unit=%d argument to the devd events, if not already there. > So, again, given an ums/uep/uhid device name (and, possibly >
number), how should one fine what to pass into > usbconfig's "ugen.
" parameter? > > (This question is triggered by the discussion in PR 183478 [1]). > > [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183478 --HPS