Attaching ugen to all usb devices

Bernd Walter ticso at cicely12.cicely.de
Mon Dec 25 15:41:55 PST 2006


On Mon, Dec 25, 2006 at 08:55:33PM +0000, Joao Barros wrote:
> On 12/25/06, M. Warner Losh <imp at bsdimp.com> wrote:
> >In message: <200612251456.42770.amistry at am-productions.biz>
> >            Anish Mistry <amistry at am-productions.biz> writes:
> >:       Many usb devices can be attached as different devices along with
> >: being functional with some libusb app that requires ugen.
> >: eg.  HP PSC Printers will attach as ulpt, if ulpt isn't loaded umass
> >: can attach to access the card slot, if neither of these are loaded
> >: ugen will attach which is required to run the hplip vendor software
> >: so that the printer, scanner, and fax machine can be accessed.
> >
> >You should review how the device presents itself to the system.  If
> >both umass and ulpt attach to it, it should be possible to make them
> >both attach at the same time.
> >
> >As for ugen, one could easily hack uhub to allow this kind of access.
> >ugen really shouldn't be attaching to any device at all, but instead
> >the usb bus (aka uhub) should allow ugen-like acess to each of the
> >devices.
> >
> >:       It would be very helpful to allow ulpt, umass, and ugen to all 
> >attach
> >: to the device.  This would allow full functionality.  Simultaneous
> >: access isn't necessary, but might be nice in the future.
> >
> >That would be a nightmare.  Trust me.  I've looked into it in the past
> >it was scary.
> >
> >:       The closest thing I can think of that allows similar behavior is
> >: vgapci that allow acpi_video and a drm driver to both access the
> >: video card.
> >
> >Well, it doesn't really.  newbus has a very strong notion of each node
> >in the tree has one and only one (or zero) devices attached.
> >
> >Warner
> 
> My Huawei E220 USB HSDPA modem presents 3 devices to the system. If I
> connect the modem I get the virtual storage device, but if I load
> ubsec into the kernel I will only get the ubsec device. I haven't yet
> tried to access the 3rd device, it's another serial port.
> I think the goal here it to be able to access all the devices.

A single device only presents a single device to the system.
A device can have multiple functions as in yours.
Drivers can claim a device or a single function.
umass and ulpt are function drivers so they can coexist on a single
device.
If ubsec claims the whole device no other driver can claim any function.
It is ubsec's decision to claim exclusive device access.
Fix ubsec to just claim the function it really needs and you are done
with it.

ugen is special - it is a fallback device driver and allows generic
access to a whole device only.
But ugen is still a hack IMHO, which is most usefull in testing devices
befor writing real drivers.
There are many points in which ugen can't work because USB devices can
be so different that generic access always has to be a tradeoff.
E.g. in the given ulpt, umass, something combo it is best to write a
function driver for the unsupported function, instead of trusting for a
generic fallback.

-- 
B.Walter                http://www.bwct.de      http://www.fizon.de
bernd at bwct.de           info at bwct.de            support at fizon.de


More information about the freebsd-usb mailing list