Patch to convert usb2 to use cdev

Hans Petter Selasky hselasky at c2i.net
Sun Nov 9 08:58:05 PST 2008


Hi Rick,

On Sunday 09 November 2008, Rink Springer wrote:
> Hi Hans,
...
>
> > 3) You need to solve the problem about a per-open-call context
> > for /dev/ugenX.Y . This device is supposed to be cloneable, that means
> > multiple processes are allowed to open it and establish independant
> > connections to the USB stack. Here are also some tricky issues with
> > permissions, because I allow trunking of multiple endpoints through the
> > same file-handle, called USB FS, and you have to verify that the current
> > thread has permission to open the endpoint inside an ioctl function.
>
> Well, multiple opens aren't a problem to implement - but I fail the
> permissions problem. I think allowing multiple opens is useful for
> as you can do ioctl() to them - but why would you ever want to be able
> to read/write the same endpoint from multiple processes?

Hi,

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.

--HPS


More information about the freebsd-usb mailing list