USB: how do I switch between interfaces within one configuration

hi

I have a USB device that has one configuration but two interfaces. The first interface exposes a interrupt in endpoint and the second interface exposes bulk in and a bulk out endpoints. There are no alternate settings for the interfaces.

(1) In a USB function driver, how do I switch between the two interfaces? I assume I have to make an explicit call. The documentation for UsbBuildSelectInterfaceRequest indicates it is for alternative setting selection, so I don’t think I can use it (or maybe the documentation just is misleading and I am supposed to use it).

General questions:
(2) When you switch between interfaces does the data transfer on the endpoint pipes stop?

For my example, if data was being transmitted on the interrupt in pipe (endpoint 3), and I switched to the second interface (that doesn’t have endpoint 3 in use), would the pipe close?

If you had endpoint 3 defined as an interrupt in endpoint for both interfaces, and you switched from one interface to the other, and data was being transmitted for endpoint 3 pipe, would switching interfaces stop the data transmission and close the pipe?

(3) What is the benefit for having more than one interface? I know there are composite device power management issues. Is it just a matter of allocating bandwidth between endpoints that you know you need?

thanks in advance…

The whole point of multiple interfaces on one configuration is that they are independent of each other. Each interface has its own set of endpoints that are not affected by setting changes in other interfaces on the same configuration. When you select a new alternate interface you should make sure you are not sending transfers to the endpoints.

What you are describing should be one interface with 2 alternate settings if only want the interrupt or bulk endpoints active, 2 interfaces with no alternative settings are just static interfaces.

Are you sure that both interfaces are being given to your device object in the first place? If your device as the interface association descriptor (IAD) and you are running on an usb core that supports it (xp sp2 I think), the usb core will give you all the interface. Otherwise, the usb core will split each interface into its own device stack using the generic parent driver (usbhub on win2k, usbgccp on xp and later). The only way to override this is to match on the USB HW ID that does not end with MI_XX, ie you match on USB\VID_045E&PID_002D and not USB\VID_045E&PID_002D&MI_00.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 3:27 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB: how do I switch between interfaces within one configuration

hi
?
I have a USB device that has one configuration but two interfaces. The first interface exposes a interrupt in endpoint and the second interface exposes? bulk in and a bulk out endpoints. There are no alternate settings for the interfaces.
?
(1) In a USB function driver, how do I switch between the two interfaces? I assume I have to make an explicit call. The documentation?for UsbBuildSelectInterfaceRequest indicates it is for alternative setting selection, so I don’t think I can use it (or maybe the documentation just is misleading and I am supposed to use it).
?
General questions:
(2) When you switch between interfaces does the data transfer on the endpoint pipes stop?
?
For my example, if data was being transmitted on the interrupt in pipe (endpoint 3), and I switched to the second interface (that doesn’t have endpoint 3 in use), would the pipe close?
?
If you had endpoint 3 defined as an interrupt in endpoint for both interfaces, and you switched from one interface to the other, and data was being transmitted for endpoint 3 pipe, would switching interfaces stop the data transmission and close the pipe?
?
(3) What is the benefit for having more than one interface? I know there are composite device power management issues.? Is it just a matter of allocating bandwidth between endpoints that you know you need?
?
thanks in advance…


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

hi Doron:

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. 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.

(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?

(2) If you have one interface with multiple alternates, does the endpoint communication pipe get closed?
( a ) Can you get around this by defining the same endpoint type for each alternate?

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?

thanks in advance…

----- Original Message -----
From: Doron Holanmailto:xxxxx
To: Windows System Software Devs Interest Listmailto:xxxxx
Sent: Tuesday, August 02, 2005 3:52 PM
Subject: RE: [ntdev] USB: how do I switch between interfaces within one configuration

The whole point of multiple interfaces on one configuration is that they are independent of each other. Each interface has its own set of endpoints that are not affected by setting changes in other interfaces on the same configuration. When you select a new alternate interface you should make sure you are not sending transfers to the endpoints.

What you are describing should be one interface with 2 alternate settings if only want the interrupt or bulk endpoints active, 2 interfaces with no alternative settings are just static interfaces.

Are you sure that both interfaces are being given to your device object in the first place? If your device as the interface association descriptor (IAD) and you are running on an usb core that supports it (xp sp2 I think), the usb core will give you all the interface. Otherwise, the usb core will split each interface into its own device stack using the generic parent driver (usbhub on win2k, usbgccp on xp and later). The only way to override this is to match on the USB HW ID that does not end with MI_XX, ie you match on USB\VID_045E&PID_002D and not USB\VID_045E&PID_002D&MI_00.

d

________________________________________
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 3:27 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB: how do I switch between interfaces within one configuration

hi

I have a USB device that has one configuration but two interfaces. The first interface exposes a interrupt in endpoint and the second interface exposes bulk in and a bulk out endpoints. There are no alternate settings for the interfaces.

(1) In a USB function driver, how do I switch between the two interfaces? I assume I have to make an explicit call. The documentation for UsbBuildSelectInterfaceRequest indicates it is for alternative setting selection, so I don’t think I can use it (or maybe the documentation just is misleading and I am supposed to use it).

General questions:
(2) When you switch between interfaces does the data transfer on the endpoint pipes stop?

For my example, if data was being transmitted on the interrupt in pipe (endpoint 3), and I switched to the second interface (that doesn’t have endpoint 3 in use), would the pipe close?

If you had endpoint 3 defined as an interrupt in endpoint for both interfaces, and you switched from one interface to the other, and data was being transmitted for endpoint 3 pipe, would switching interfaces stop the data transmission and close the pipe?

(3) What is the benefit for having more than one interface? I know there are composite device power management issues. Is it just a matter of allocating bandwidth between endpoints that you know you need?

thanks in advance…


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx</mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

Separate interfaces are independent of each other. Interface 0 will not affect interface 1. that means that when you select interface on interface 0, interface 1 continues to chug along. Even more so, since you have no alternative settings for either interface, you can just call select config with both interfaces and you are done, never to select an alternate setting again.

(1) If you have multiple interfaces (no alternate settings), what call do you make to switch to them?
Like I said, you don’t switch to them. They each run along independent of each other. You don’t switch to them. Typically, you let the generic parent split each interface into its own PDO. That means that an FDO loads for each interface. For some device classes (like Bluetooth or CDC) which define a multiple interface device, you don’t let the generic parent load and the driver handles each interface on its own, all in one FDO

( a ) When you switch between interfaces, the endpoint communication gets pipe gets closed? Is this correct?
Pipes get closed when you change alternate settings on a particular interface, so in your setup, no.

(2) If you have one interface with multiple alternates, does the endpoint communication pipe get closed?
EP communication will get closed when you select a different alternate setting.

( a ) Can you get around this by defining the same endpoint type for each alternate?
No, doesn’t work that way.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 6:21 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] USB: how do I switch between interfaces within one configuration

hi Doron:
?
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. 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.
?
(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?
?
(2) If you have one interface with multiple alternates, does the endpoint communication pipe get closed?
( a ) Can you get around this by defining the same endpoint type for each alternate?
?
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?
?
thanks in advance…
?
?
----- Original Message -----
From: Doron Holan
To: Windows System Software Devs Interest List
Sent: Tuesday, August 02, 2005 3:52 PM
Subject: RE: [ntdev] USB: how do I switch between interfaces within one configuration

The whole point of multiple interfaces on one configuration is that they are independent of each other.? Each interface has its own set of endpoints that are not affected by setting changes in other interfaces on the same configuration.? When you select a new alternate interface you should make sure you are not sending transfers to the endpoints.

What you are describing should be one interface with 2 alternate settings if only want the interrupt or bulk endpoints active, 2 interfaces with no alternative settings are just static interfaces.

Are you sure that both interfaces are being given to your device object in the first place?? If your device as the interface association descriptor (IAD) and you are running on an usb core that supports it (xp sp2 I think), the usb core will give you all the interface.? Otherwise, the usb core will split each interface into its own device stack using the generic parent driver (usbhub on win2k, usbgccp on xp and later).? The only way to override this is to match on the USB HW ID that does not end with MI_XX, ie you match on USB\VID_045E&PID_002D and not USB\VID_045E&PID_002D&MI_00.

d


From: xxxxx@listsosr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 3:27 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB: how do I switch between interfaces within one configuration

hi

I have a USB device that has one configuration but two interfaces. The first interface exposes a interrupt in endpoint and the second interface exposes bulk in and a bulk out endpoints. There are no alternate settings for the interfaces.

(1) In a USB function driver, how do I switch between the two interfaces? I assume I have to make an explicit call. The documentation for UsbBuildSelectInterfaceRequest indicates it is for alternative setting selection, so I don’t think I can use it (or maybe the documentation just is misleading and I am supposed to use it).

General questions:
(2) When you switch between interfaces does the data transfer on the endpoint pipes stop?

For my example, if data was being transmitted on the interrupt in pipe (endpoint 3), and I switched to the second interface (that doesn’t have endpoint 3 in use), would the pipe close?

If you had endpoint 3 defined as an interrupt in endpoint for both interfaces, and you switched from one interface to the other, and data was being transmitted for endpoint 3 pipe, would switching interfaces stop the data transmission and close the pipe?

(3) What is the benefit for having more than one interface? I know there are composite device power management issues. Is it just a matter of allocating bandwidth between endpoints that you know you need?

thanks in advance…


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@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@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

Thanks for the great info! - That answers all my questions.

----- Original Message -----
From: Doron Holanmailto:xxxxx
To: Windows System Software Devs Interest Listmailto:xxxxx
Sent: Tuesday, August 02, 2005 11:15 PM
Subject: RE: [ntdev] USB: how do I switch between interfaces within one configuration

Separate interfaces are independent of each other. Interface 0 will not affect interface 1. that means that when you select interface on interface 0, interface 1 continues to chug along. Even more so, since you have no alternative settings for either interface, you can just call select config with both interfaces and you are done, never to select an alternate setting again.

> (1) If you have multiple interfaces (no alternate settings), what call do you make to switch to them?
Like I said, you don’t switch to them. They each run along independent of each other. You don’t switch to them. Typically, you let the generic parent split each interface into its own PDO. That means that an FDO loads for each interface. For some device classes (like Bluetooth or CDC) which define a multiple interface device, you don’t let the generic parent load and the driver handles each interface on its own, all in one FDO

( a ) When you switch between interfaces, the endpoint communication gets pipe gets closed? Is this correct?
Pipes get closed when you change alternate settings on a particular interface, so in your setup, no.

(2) If you have one interface with multiple alternates, does the endpoint communication pipe get closed?
EP communication will get closed when you select a different alternate setting.

( a ) Can you get around this by defining the same endpoint type for each alternate?
No, doesn’t work that way.

d


From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 6:21 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] USB: how do I switch between interfaces within one configuration

hi Doron:

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. 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.

(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?

(2) If you have one interface with multiple alternates, does the endpoint communication pipe get closed?
( a ) Can you get around this by defining the same endpoint type for each alternate?

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?

thanks in advance…

----- Original Message -----
From: Doron Holan
To: Windows System Software Devs Interest List
Sent: Tuesday, August 02, 2005 3:52 PM
Subject: RE: [ntdev] USB: how do I switch between interfaces within one configuration

The whole point of multiple interfaces on one configuration is that they are independent of each other. Each interface has its own set of endpoints that are not affected by setting changes in other interfaces on the same configuration. When you select a new alternate interface you should make sure you are not sending transfers to the endpoints.

What you are describing should be one interface with 2 alternate settings if only want the interrupt or bulk endpoints active, 2 interfaces with no alternative settings are just static interfaces.

Are you sure that both interfaces are being given to your device object in the first place? If your device as the interface association descriptor (IAD) and you are running on an usb core that supports it (xp sp2 I think), the usb core will give you all the interface. Otherwise, the usb core will split each interface into its own device stack using the generic parent driver (usbhub on win2k, usbgccp on xp and later). The only way to override this is to match on the USB HW ID that does not end with MI_XX, ie you match on USB\VID_045E&PID_002D and not USB\VID_045E&PID_002D&MI_00.

d


From: xxxxx@listsosr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Tuesday, August 02, 2005 3:27 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB: how do I switch between interfaces within one configuration

hi

I have a USB device that has one configuration but two interfaces. The first interface exposes a interrupt in endpoint and the second interface exposes bulk in and a bulk out endpoints. There are no alternate settings for the interfaces.

(1) In a USB function driver, how do I switch between the two interfaces? I assume I have to make an explicit call. The documentation for UsbBuildSelectInterfaceRequest indicates it is for alternative setting selection, so I don’t think I can use it (or maybe the documentation just is misleading and I am supposed to use it).

General questions:
(2) When you switch between interfaces does the data transfer on the endpoint pipes stop?

For my example, if data was being transmitted on the interrupt in pipe (endpoint 3), and I switched to the second interface (that doesn’t have endpoint 3 in use), would the pipe close?

If you had endpoint 3 defined as an interrupt in endpoint for both interfaces, and you switched from one interface to the other, and data was being transmitted for endpoint 3 pipe, would switching interfaces stop the data transmission and close the pipe?

(3) What is the benefit for having more than one interface? I know there are composite device power management issues. Is it just a matter of allocating bandwidth between endpoints that you know you need?

thanks in advance…


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@listsosr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@listsosr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx</mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

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.

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@lists.osr.com

The usb core specs definitely talk about composite devices (and compound devices etc) and what it means to have separate interfaces vs multiple alternates. Usb.org has forums in which you can ask usb specific questions if you want to ask there.

If your device is using an INT endpoint as a heartbeat, that is a poorly designed board. There is a heartbeat on the usb bus, but it does not show up as i/o transfers. The device must assume there is a driver out there if it was configured and endpoints are active, there is no other way for the config to occur otherwise.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Thursday, August 04, 2005 12:38 AM
To: Windows System Software Devs Interest List
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

S. Drasnin wrote:

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.

It’s mostly a matter of reading the specs and on-the-job training.
Everybody learns in a different way. For me, I picked up much of what I
know about USB by single-stepping and debug-printing through some simple
drivers and watching what happens. That’s a productive educational
environment for me.

The mechanics of configurations, interfaces, and pipes are in the
specs. The details about how XP drivers get loaded to handle those are
something you’d have to pick up from the sample drivers and by trying it.

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 controller looks for electrical changes in the lines to learn when a
device has been added or removed. Once a device is plugged in and
enumerated, there is no handshaking. The host controller won’t know
that a device has gone dead until it fails to respond to a packet. For
bulk pipes, that won’t happen until you do I/O. For interrupt and
isochronous pipes, it happens when it is their “turn”.

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.

Remember that USB is 100% host-driven. The device cannot send anything
on its own. It can only respond to requests from the host. For an
interrupt pipe, the device will be asked to supply data at whatever
interval is specified in the pipe descriptor. If the interval is 4
frames, as long as there is an IRP queued up, the host controller will
ask for data every 4 milliseconds. It may be that your device simply
responds with garbage if nothing else is ready, although that’s somewhat
unusual.

What kind of device is this?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks for the reply back. I will poke around the specs some more. I’d like to find out about the heart beat.

----- Original Message -----
From: Doron Holanmailto:xxxxx
To: Windows System Software Devs Interest Listmailto:xxxxx
Sent: Thursday, August 04, 2005 7:59 AM
Subject: RE: [ntdev] USB: how do I switch between interfaces within one configuration

The usb core specs definitely talk about composite devices (and compound devices etc) and what it means to have separate interfaces vs multiple alternates. Usb.org has forums in which you can ask usb specific questions if you want to ask there.

If your device is using an INT endpoint as a heartbeat, that is a poorly designed board. There is a heartbeat on the usb bus, but it does not show up as i/o transfers. The device must assume there is a driver out there if it was configured and endpoints are active, there is no other way for the config to occur otherwise.

d

________________________________________
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Thursday, August 04, 2005 12:38 AM
To: Windows System Software Devs Interest List
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.commailto:xxxxx
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: xxxxx@msn.commailto:xxxxx
To unsubscribe send a blank email to xxxxx@listsosr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx</mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

From what I remember - several interfaces on the same USB device (let’s forget about configurations - Windows only supports configuration 0 :slight_smile: ) - 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

hi

Thanks for the reply with helpful info. Thanks to everyone else who have replied as well.

The device is an off the shelf embedded development board that runs a small, commercial RTOS with provided sample code (embedded drivers) that sits on top of the OS. I would love to go in there and change the code myself, but that’s not my decision, especially since the sample code is tested/certified. Once we evaluate performance, then I can make a more concrete argument as to all the performance issues and the need for change to resolve them.

----- Original Message -----
From: Tim Roberts
To: Windows System Software Devs Interest List
Sent: Thursday, August 04, 2005 9:16 AM
Subject: Re: [ntdev] USB: how do I switch between interfaces within one configuration

S. Drasnin wrote:

> 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.

It’s mostly a matter of reading the specs and on-the-job training.
Everybody learns in a different way. For me, I picked up much of what I
know about USB by single-stepping and debug-printing through some simple
drivers and watching what happens. That’s a productive educational
environment for me.

The mechanics of configurations, interfaces, and pipes are in the
specs. The details about how XP drivers get loaded to handle those are
something you’d have to pick up from the sample drivers and by trying it.

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 controller looks for electrical changes in the lines to learn when a
device has been added or removed. Once a device is plugged in and
enumerated, there is no handshaking. The host controller won’t know
that a device has gone dead until it fails to respond to a packet. For
bulk pipes, that won’t happen until you do I/O. For interrupt and
isochronous pipes, it happens when it is their “turn”.

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.

Remember that USB is 100% host-driven. The device cannot send anything
on its own. It can only respond to requests from the host. For an
interrupt pipe, the device will be asked to supply data at whatever
interval is specified in the pipe descriptor. If the interval is 4
frames, as long as there is an IRP queued up, the host controller will
ask for data every 4 milliseconds. It may be that your device simply
responds with garbage if nothing else is ready, although that’s somewhat
unusual.

What kind of device is this?


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@lists.osr.com