Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Nov 2008 17:00: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:  <200811091700.06932.hselasky@c2i.net>
In-Reply-To: <20081109154722.GC78524@rink.nu>
References:  <20081109120257.GA78524@rink.nu> <200811091515.26123.hselasky@c2i.net> <20081109154722.GC78524@rink.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811091700.06932.hselasky>