Re: USB drivers

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Wed, 04 Aug 2004 21:22:42 -0600 (MDT)
In message: <4110F5AE.6030403_at_tellme3times.com>
            Chris <chris_at_tellme3times.com> writes:
: First I would like to know if there is a technical reason why two 
: different divers cannot attach to the same device. If each driver works 
: well independently, what is the reason to prevent the second one from 
: attaching? I would assume that if you attempted to use both drivers at 
: the same time you would get a device busy error.

Because there's only one pointer.

: Am I misunderstanding something here? I see ulpt: and unlpt: attaching 
: to the same device and the choice of which one to use is up to the user 
: and the hardware they have. If we have two drivers attach in one case 
: why, and where, do we prevent other drivers from attaching if they meet 
: the minimum requirements?

You misunerstand what's actually happening.  There's no case in the
tree where two drivers are attached, at the same time, to the same
device node.  There's only one set of pointers.  However, with USB,
there can be reasons why multiple things can attach to the same
driver.  The usb code tries to do smart things for devices that have
multiple configurations.

With USB and multi-function devices, here's the code that we use:

	/* First try with device specific drivers. */
	probe and attach driver with a config # of -1 (usegeneric = 0)
		return if successful
	/* Next try with interface drivers. */
	foreach valid configuration
		foreach interface
			probe and attach driver
	/* Finally try the generic driver. */
	probe and attach driver with a config # of -1 (usegeneric = 1)
		return if successful

I'm not familiar with the specific instance of ulpt and unlpt.

> What I am looking to accomplish is to attach uscanner and ulpt to an 
> EPSON CX5400. While each driver works great by itself I am unable to 
> attach both at the same time. I was told on this list that we may not 
> attach two drivers to the same device. If this is not correct then I 
> would appreciate a little help in attaching existing drivers or writing 
> a new one.

You might want to look at the above probing order to see if there
might be multiple configurations that the EPSON implements.

Warner
Received on Thu Aug 05 2004 - 01:22:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:04 UTC