From owner-freebsd-usb@FreeBSD.ORG Sun Nov 9 16:46:04 2008 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00871106568C; Sun, 9 Nov 2008 16:46:04 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe13.swip.net [212.247.155.129]) by mx1.freebsd.org (Postfix) with ESMTP id 369D38FC1C; Sun, 9 Nov 2008 16:46:02 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=MdMrz2CnUUkA:10 a=d6BVkb5LuPPVEe4iNQMLyA==:17 a=T0YFZMV6NusNvlpCoTQA:9 a=JTT4-4WaAcZvEnkw9hnbDhrwkH8A:4 a=LY0hPdMaydYA:10 Received: from [62.113.135.6] (account mc467741@c2i.net [62.113.135.6] verified) by mailfe13.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 756766916; Sun, 09 Nov 2008 17:46:01 +0100 From: Hans Petter Selasky To: Rink Springer Date: Sun, 9 Nov 2008 17:48:05 +0100 User-Agent: KMail/1.9.7 References: <20081109120257.GA78524@rink.nu> <200811091700.06932.hselasky@c2i.net> <20081109162835.GE78524@rink.nu> In-Reply-To: <20081109162835.GE78524@rink.nu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811091748.05863.hselasky@c2i.net> Cc: usb@freebsd.org, freebsd-usb@freebsd.org Subject: Re: Patch to convert usb2 to use cdev 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, 09 Nov 2008 16:46:04 -0000 On Sunday 09 November 2008, Rink Springer wrote: > Hi Hans, > > On Sun, Nov 09, 2008 at 05:00:05PM +0100, Hans Petter Selasky wrote: > > It is not the same endpoint, but multiple different endpoints on the same > > device through the same file handle. Instead of one endpoint per file, > > you have one file handle for each set of endpoints you need for your USB > > userland driver, like LibUSB. Then there is only one file-handle to poll. > > Actually there are two modes in UGEN now. Maybe you were not aware. Let > > me quickly explain: > > > > 1) Simple read/write mode that works with cat & dd. > > > > 2) Special USB FS mode which exposes the full USB features to userland. > > This mode does not use read/write, but rather copyin, copyout and a set > > of software USB descriptors. > > Hmm, I think I see what you mean. Basically, you just > open("/dev/ugenX.Y") and you can use the USB_FS_xxx ioctl's to have > fine-grained control. However, if you open("/dev/ugen.X.Y.Z"), you'd > talk with endpoint Z on USB device X.Y.. this is actually quite cool, > guess I should have studied usb2_generic.c more :-) That's correct. > > I think it makes sense to say that if /dev/ugenX.Y is opened, you > shouldn't be able to open /dev/ugenX.Y.Z, right? However, what happends > if /dev/ugenX.Y.Z is opened? I'd think that opening /dev/ugenX.Y would > be fine, but any ioctl() dealing with the corresponding endpoint Z > should be denied. I would say it be allowed to open the endpoint both ways at the same time. It can make debugging easier. But there can be two different processes opening /dev/ugenX.Y at the same time, accessing different endpoints! --HPS