From owner-freebsd-usb@FreeBSD.ORG Tue Oct 25 09:53:29 2005 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F038B16A41F for ; Tue, 25 Oct 2005 09:53:29 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe12.swip.net [212.247.155.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 525F343D46 for ; Tue, 25 Oct 2005 09:53:28 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-217-134-70.daxnet.no ([193.217.134.70] verified) by mailfe12.swip.net (CommuniGate Pro SMTP 4.3.8) with ESMTP id 40001240; Tue, 25 Oct 2005 11:53:06 +0200 From: Hans Petter Selasky To: "Loren M. Lang" Date: Tue, 25 Oct 2005 11:54:11 +0200 User-Agent: KMail/1.7 References: <20051023095137.GC18930@alzatex.com> <200510242254.31406.hselasky@c2i.net> <20051025073853.GA4759@alzatex.com> In-Reply-To: <20051025073853.GA4759@alzatex.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510251154.12709.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: LibUSB fails to enumerate all devices X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2005 09:53:30 -0000 On Tuesday 25 October 2005 09:38, Loren M. Lang wrote: > On Mon, Oct 24, 2005 at 10:54:30PM +0200, Hans Petter Selasky wrote: > > On Monday 24 October 2005 21:51, Brian K. White wrote: > > > ----- Original Message ----- > > > From: "Loren M. Lang" > > > To: > > > Sent: Sunday, October 23, 2005 5:51 AM > > > Subject: LibUSB fails to enumerate all devices > > > > > > I am developing a USB device which has two interfaces, one interface > > > uses a standard HID protocol, the other is completely custom at the > > > moment. FreeBSD attaches appropriately to the HID interface and works > > > correctly. For the custom interface, I was going to write a device > > > driver in userspace using libusb, but I can't seem to find it. I wrote > > > a program to enumerate all devices on all busses, but the only device I > > > see is the one device I don't have any driver loaded for. Does FreeBSD > > > not allow a userspace to access an interface of a usb device when any > > > of it's interfaces are grabbed by a kernel driver even though the > > > interface I want is not grabbed? > > > > No. ugen, which is the device libusb is searching for, is only created > > when no subdevices has been attached. It is not impossible to have a > > shadow "ugen" hanging on all USB devices, but it is a little complicated, > > because you get two applications that can set the configuration: ugen and > > the USB device driver. Whenever the configuration number is set, all ugen > > devices in /dev must be re-created, and one should detach existing, > > attached USB sub-devices. > > So LibUSB can only access USB devices that have an associated ugen > device? Yes. > And a usb device which has a kernel driver attached to any > interface will not have a ugen device available? Yes, if "ugen" is present/loaded. > Is there any way, LibUSB or not, to access the second interface of > my device from userspace or would it require a kernel driver? Currently the easiest is to make a loadable kernel module that attaches to your custom interface. Though it is not impossible to have a "ugen" shadow attached, only that things become slightly more complicated. In some situations I see that it is desireable to let a user application select the configuration number, through "ugen". For example some "ipods" support "umass" and "uhid", but not at the same time. --HPS