From what I remember - several interfaces on the same USB device (let’s forget about configurations - Windows only supports configuration 0
) - are a multi-function device, and they are enumerated as 2 independent devices by USBCGP bus driver.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: S. Drasnin
To: Windows System Software Devs Interest List
Sent: Thursday, August 04, 2005 11:38 AM
Subject: Re: [ntdev] USB: how do I switch between interfaces within one configuration
Tim - thanks for your reply as well. I just had to add code to keep track of the pipes in all the interfaces and was then able to access all of them - I was happy it was so simple. It’s XP SP2 and one driver (mine) is handling all interfaces. I’m going to try to find out why one interface wasn’t used in the embedded code, especially since there is no isochronous endpoints. I do remember reading about a problem with power management (entering C3) and handing composite devices.
Where can I find info like this other than asking all you very brainy/knowledgeable people? I don’t see it documented in MSDN and if it’s documented somewhere I’d like to know where, since I bet there is other valuable stuff for me to find out. I’ll dig around at the USB 1.1 and 2.0 specs again, but I don’t think this discussion would be covered in there.
One final question - what sort of handshaking is done between the usb controller on the XP side and the device side to make sure there are both alive and talking? Is there some sort of ACK thing going on? What is the frequency on this? (I will also dig up the USB spec tomorrow.) The reason I ask is that the device I’m using is sending a packet on the interrupt pipe about every 5 - 7 msec and I am guessing (!) that it uses the fact that it got sent ok as a means of saying that the driver is up and running. Needless to say, I don’t like my driver getting bombarded with interrupt in data (the packet contains garbage, as I guess is intentional) so frequently and I know that the OSR sample driver for their cool USB dev board didn’t do that when I continually recycled a IRP waiting on data received in from the interrupt pipe.
So, I was curious on your thoughts on this.
thanks
----- Original Message -----
From: Tim Roberts
To: Windows System Software Devs Interest List
Sent: Wednesday, August 03, 2005 9:51 AM
Subject: Re: [ntdev] USB: how do I switch between interfaces within one configuration
S. Drasnin wrote:
> It is XP SP2. Right now I’m stuck with this device and usbview did
> show two interfaces ( I will run it again tomorrow at work to
> confirm). I have to make my code work for it but long term I can have
> input as to what ends up in the embedded code. I don’t understand why
> only one interface wasn’t used – seems like unnecessary complexity
> but I will get more info to find out what the reasoning was.
>
> For the device I have interface 0 has the interrupt in pipe. Interface
> 1 has 2 bulk endpoints - 1 in and 1 out. I have a notification coming
> in on the interrupt in pipe telling me to get data that’s going to be
> sent in via the bulk in endpoint.
Then this may be a design flaw in your hardware. Interfaces are
supposed to be independent. Effectively, two multiple interfaces are
intended to appear as two separate devices, which are commonly handled
by two separate drivers. Consider a web camera with a microphone and
memory for offline pictures. There will usually be three interfaces:
one for the video, one for the audio, and one for the memory. All of
them are available at all times, and three separate drivers get loaded
to handle them.
I want to read it in via bulk in, but since I’m set up for interface
> 0, I can’t access bulk in.
>
> I do not know physically what happens when you switch between
> interfaces or interface alternates so if you could answer the
> questions below, that would help. Perhaps this is documented somewhere
> but the samples and text all have samples with 1 interface, no alternates.
I am arrogantly going to try to restate what Doron has already said;
sometimes hearing the same thing in two different ways can help.
Assuming your driver is configured to handle the root device, and not
the individual interfaces, the SELECT_CONFIGURATION call returns a list
of all of the interfaces in this configuration. The
USBD_INTERFACE_INFORMATION structure contains all of the pipes in that
interface. You should be able to talk to ANY of the pipes on ANY of the
interfaces at ANY time.
(1) If you have multiple interfaces (no alternate settings), what call
> do you make to switch to them?
> ( a ) When you switch between interfaces, the endpoint communication
> gets pipe gets closed? Is this correct?
You DON’T switch interfaces. All of the pipes on all of the interfaces
are available at all times.
(2) If you have one interface with multiple alternates, does the
> endpoint communication pipe get closed?
Yes. The pipe goes invalid.
( a ) Can you get around this by defining the same endpoint type for
> each alternate?
No. It will be a brand-new pipe.
What is the tradeoffs between a (1) versus (2) - multiple interfaces,
> alternates versus one interface, multiple alternates? Does one give
> you something the other doesn’t?
> Why would I want to do one versus the other?
I gave you one example of a “multiple interface” device above. A
“multiple interface” device basically embeds a USB hub in the device.
In fact, until XP, the default driver for a device with multiple
interfaces was USBHUB.SYS; it would then enumerate the individual
interfaces as separate device nodes and load drivers for them.
In all the devices I have done, alternate interfaces have only been used
with isochronous pipes, to allow the device to operate under varying
loads. A video camera might have alternate interfaces for a 1
megabyte/second pipe, and an 800 kB/s pipe, and a 600 kB/s pipe, and a
400 kB/s pipe, and a 200 kB/s pipe. The driver will try for the largest
value, and if it fails, keep trying smaller values. I’ve seen the same
thing done with audio devices as well. There is no particular reason to
use alternate interfaces with bulk pipes, since you only have to use
what you need.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@listsosr.com
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com