Patch to convert usb2 to use cdev

Rink Springer rink at FreeBSD.org
Sun Nov 9 08:28:34 PST 2008


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 :-)

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.

Does this make sense to you?

-- 
Rink P.W. Springer                                - http://rink.nu
"Anyway boys, this is America. Just because you get more votes doesn't
 mean you win." - Fox Mulder


More information about the freebsd-usb mailing list