USB & Windows (XP)

Jul 06, 2004 9 Replies

Hi All



Got a little question about the enumeration process in WinXP. I have a USB design and have noted the following;



1) 1st packet received is a get_descriptor and it's requesting 64 bytes of the device_descriptor.
2) 2nd packet received is a get_descriptor and it's looking for 18 bytes.
3) 3rd packet is a get_descriptor and is looking for 9 bytes of the configuration_descriptor.
4) 4th packet is a get_decriptor and it's looking for 255 bytes of the config_desc. I understand that this process is typical for WinXP, but in step 4, should I reply with a 255 bytes packet that contains the config_descriptor and all subsequent desciptors that follow (interface & endpoints), or just 32 bytes (which is the length of the 4 descriptors in question)?

Moving on, it then asks for a 255 bytes of the string_descriptor with index



  1. This is the LANGID. Again, should I reply with a 255 packet (valid data + loads of garbage), or just the 4 bytes required to specify a single language?

WinXP never asks for a string_desc with an index other than 0. Even if I specify strings in the device and config descriptors, WinXP will never ask for them (but it does make several requests for the LANGID).



I can verify that the device_desc is returned to the host ok, as I can see the registry entries update (with the corerct vendor & product IDs).



I'm pretty stuck here without any of your valuable feedback. TIA.


If your descriptor is shorter than requested, only return the number of bytes in the descriptor. If the descriptor size is an exact multiple of the control endpoint packet size, you'll have to ensure that an empty packet is transmitted after the descriptor data.

I've never worked with USB on WinXP, but have on Win98 and Win2000 which I would expect to work similarly. The string descriptor requests will not occur if there was a problem earlier in the enumeration process. But since it is requesting string index 0 repeatedly, your problem may be there. If you are returning more than four bytes, that's probably the cause. The only other thing I could think of is to make sure that the language ID is legitimate and in little-endian order.

"> 3) 3rd packet is a get_descriptor and is looking for 9 bytes of the

No, it asks for wTotalLength bytes.

I

bytes

It will never ask for more than wTotalLength i.e. your config descriptor is wrong.

Leo Havmøller.

All of the information I have read regarding enumeration says that the OS WILL ask for 255 bytes. The question I'm asking is, whether I should return

255 bytes (including some garbage) or only the valid descriptors?

should

all

is

What would cause the OS to ask for 255 bytes?

return

You are right, it does ask for 255 bytes. Return your descriptor and zero-terminate.

Leo Havmøller.

Tried, and it works ! :-) Thanks again.

Following on from your excellent earlier advice, do you happen to know what is the correct response to a host sending a set_config packet (00 09 01 00

00 00 00 00)? What should I send back to the host? As always, TIA.

An empty packet will indicate that the configuration was set. You can stall the endpoint if there was a problem.

what

00

Thanks. Is there a good book that I should read to tell me all of this? I've had a read of a couple, but they were very bloaty with not much in-depth facts.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required