From owner-freebsd-usb@FreeBSD.ORG Wed Jan 9 19:34:22 2008 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF7A16A420 for ; Wed, 9 Jan 2008 19:34:22 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe14.swipnet.se [212.247.155.161]) by mx1.freebsd.org (Postfix) with ESMTP id 99BD313C455 for ; Wed, 9 Jan 2008 19:34:21 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [85.19.218.45] (account mc467741@c2i.net [85.19.218.45] verified) by mailfe14.swip.net (CommuniGate Pro SMTP 5.1.13) with ESMTPA id 25545122; Wed, 09 Jan 2008 19:34:18 +0100 From: Hans Petter Selasky To: Mikhail Teterin Date: Wed, 9 Jan 2008 19:34:53 +0100 User-Agent: KMail/1.9.7 References: <200801090114.56195@aldan> <200801091015.17730@aldan> In-Reply-To: <200801091015.17730@aldan> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801091934.54053.hselasky@c2i.net> Cc: johnjen@reynoldsnet.org, R.Tobin@ed.ac.uk, usb@freebsd.org Subject: Re: BlackBerry (Re: using libusb) 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: Wed, 09 Jan 2008 19:34:22 -0000 On Wednesday 09 January 2008, Mikhail Teterin wrote: > = I'm trying to port a suit called "barry", which provides a library and > some = utilities to work with RIM's BlackBerry devices. > > = It compiles cleanly, but fails to find a connected device at run time. In > = fact, it fails to find _any_ devices, even though ``usbdevs -v'' lists > = several including the BlackBerry > > Ok, I see, what's happening... The current implementation of libusb's BSD > support (bsd.c) ignores all devices other than ``ugen'': > > if (strncmp(di.udi_devnames[0], "ugen", 4) != 0) { > /* best not to play with things we don't understand */ > continue; > > And BlackBerry is identified as ``umass'' here :( > > Not sure, how best to solve this -- commenting out the above-quoted "if" > simply leads to a failure later, because the code will look for > /dev/umassX, which simply would not exist -- umass0 is da3 here. But it > might be da0 somewhere else, and there is no way to know, which is which > :-( > > But even if one could figure this out and specify the device to the tool > explicitly, daX will not understand ugen's ioctls anyway... > > What a retarded mess... > > We really need the low-level (ugen?) interfaces available for all > USB-devices -- even those, which are /also/ handled by higher-level > interfaces (like ulpt, uscan, umass). As things stand, the higher-level > ones are "greedy" and will prevent ugen from appearing, even if one wanted > to. Hi Mikhail, Yes, you are completely right. And this is not very far away from happening. I've wanted to do this for a long time, but have found no time yet. My plan is to extend /dev/usbX so that it becomes a so-called clonable device. When you open up "/dev/usb0.2.3" for example, you open up the device having index 2 on USB bus 0 and endpoint 3. This will need some modifications in libusb. Ugen will still be there, but I plan to move the functionality over to "usb.c". Accessing endpoints will then work regardless of what drivers are hooked on. Some open problems that needs to be resolved: Should we allow parallell access to USB interfaces? And what about rights management? > > Hans, any hope? Thank you! > In the end of the tunnel :-) --HPS