From owner-freebsd-usb@FreeBSD.ORG Sun Mar 21 13:16:50 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 B3460106567A for ; Sun, 21 Mar 2010 13:16:50 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.freebsd.org (Postfix) with ESMTP id 1683E8FC17 for ; Sun, 21 Mar 2010 13:16:49 +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=ndaoGXS1AAAA:8 a=xop-n2nfJ5BEqttttw4A:9 a=sLA89lM4hXAW5sfiND2AZUo4qTMA:4 a=wPNLvfGTeEIA:10 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 1347328556; Sun, 21 Mar 2010 14:16:48 +0100 From: Hans Petter Selasky To: Martin Laabs Date: Sun, 21 Mar 2010 14:15:03 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-STABLE; KDE/4.3.4; amd64; ; ) References: <4BA52239.8000300@martinlaabs.de> <201003211134.28085.hselasky@c2i.net> <4BA60B0A.3040005@martinlaabs.de> In-Reply-To: <4BA60B0A.3040005@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: <201003211415.03564.hselasky@c2i.net> 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 13:16:50 -0000 On Sunday 21 March 2010 13:03:22 Martin Laabs wrote: > Hello Hans, Hi Martin, > > 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. That is not true. Search Google for cuse4bsd :-) > > 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: addr 2> > 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) > > > 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? This should be quite trivial, if cuse4bsd does not help anything. Just an idea: Maybe we can import the linux-js driver into the webcamd framework? Could you have a look at it. Then the code changes will be minimal! --HPS http://www.selasky.org/hans_petter/video4bsd