USB & Windows (XP)

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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
0. 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.



Re: USB & Windows (XP)
Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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.

Re: USB & Windows (XP)
<snip>

Quoted text here. Click to load it

OK thanks. I'll try that.



Re: USB & Windows (XP)
Quoted text here. Click to load it

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



Re: USB & Windows (XP)
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.



Re: USB & Windows (XP)
Quoted text here. Click to load it

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

Re: USB & Windows (XP)
Quoted text here. Click to load it
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.



Re: USB & Windows (XP)
"> 3) 3rd packet is a get_descriptor and is looking for 9 bytes of the
Quoted text here. Click to load it


No, it asks for wTotalLength bytes.

Quoted text here. Click to load it
I
bytes

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

Leo Havm°ller.



Re: USB & Windows (XP)
Quoted text here. Click to load it

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?

Quoted text here. Click to load it
should
all
is

What would cause the OS to ask for 255 bytes?



Re: USB & Windows (XP)
Quoted text here. Click to load it
return

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

Leo Havm°ller.



Site Timeline