From owner-freebsd-usb@FreeBSD.ORG Sun Nov 9 15:58:03 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6369A106564A; Sun, 9 Nov 2008 15:58:03 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.swip.net [212.247.154.225]) by mx1.freebsd.org (Postfix) with ESMTP id 96B8D8FC16; Sun, 9 Nov 2008 15:58: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=FVM5Q_DoANwoGtWqb9oA:9 a=Vo0Yl0eysTpf8LqmnMEA:7 a=vp6WGYIvxjnnhARfuOBSHwA9N5cA:4 a=50e4U0PicR4A:10 Received: from [62.113.135.6] (account mc467741@c2i.net [62.113.135.6] verified) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.6) with ESMTPA id 1144733230; Sun, 09 Nov 2008 16:58:00 +0100 From: Hans Petter Selasky To: Rink Springer Date: Sun, 9 Nov 2008 17:00:05 +0100 User-Agent: KMail/1.9.7 References: <20081109120257.GA78524@rink.nu> <200811091515.26123.hselasky@c2i.net> <20081109154722.GC78524@rink.nu> In-Reply-To: <20081109154722.GC78524@rink.nu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811091700.06932.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 15:58:03 -0000 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