Date: Sun, 9 Nov 2008 17:48:05 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: Rink Springer <rink@freebsd.org> Cc: usb@freebsd.org, freebsd-usb@freebsd.org Subject: Re: Patch to convert usb2 to use cdev Message-ID: <200811091748.05863.hselasky@c2i.net> In-Reply-To: <20081109162835.GE78524@rink.nu> References: <20081109120257.GA78524@rink.nu> <200811091700.06932.hselasky@c2i.net> <20081109162835.GE78524@rink.nu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811091748.05863.hselasky>