Date: Mon, 15 Sep 2014 14:43:36 +0300 From: Vitaly Magerya <vmagerya@gmail.com> To: freebsd-usb@freebsd.org Subject: How to obtain the "ugen" that corresponds to an "ums", "uep" or "uhid"? Message-ID: <5416D0E8.3030806@gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, folks. Is there a way to obtain the name of an ugen device that corresponds to a particular ums/uep/uhid device? 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<unit>.<address> dump_device_desc The question is how should the script obtain these <unit> and <address> 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 <address> number in the "devaddr" variable, but the correct <unit> number is nowhere to be found. So, again, given an ums/uep/uhid device name (and, possibly <address> number), how should one fine what to pass into usbconfig's "ugen<unit>.<address>" parameter? (This question is triggered by the discussion in PR 183478 [1]). [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183478
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5416D0E8.3030806>