Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What configuration is the device in after it resets? #36

Open
kenchris opened this issue Feb 3, 2016 · 2 comments
Open

What configuration is the device in after it resets? #36

kenchris opened this issue Feb 3, 2016 · 2 comments

Comments

@kenchris
Copy link

@kenchris kenchris commented Feb 3, 2016

From spec ISSUE 1

@kenchris

This comment has been minimized.

Copy link
Author

@kenchris kenchris commented Feb 3, 2016

After reset the state should become "default" where after you can set address and get into "adressed" state. At this point you can set a configuration, if the device has one.

This is where Windows usually selects 1.

You can also use the value 0 to deconfigure a device.

As you are suppose to set it anyway, does it matter what configuration is set? Shouldn't it not just stay unset?

@terrillmoore

This comment has been minimized.

Copy link

@terrillmoore terrillmoore commented Aug 21, 2019

Very old issue, but... with all real USB host stacks, the stack is going to take care of assigning the address. A user mode application will only be able to talk to the device once it's in the Addressed state. The owning kernel-mode component might, or might not, assign a default configuration before a user-mode component can join the party. The design of the API should be agnostic to the current configuration of the device -- the client should be able to query the current config value, and then set what it likes. Be aware that bConfigurationValue (the value you write to select a configuration) != the index of GetDescriptor(CONFIG_DESCRIPTOR, index). The configuration descriptor index is strictly 1..n, where n is the number of configurations reported in the device descriptor. But bConfigurationValue can be any non-zero number. Windows selects the configuration described by the first configuration descriptor (index 1), but writes whatever is in the config descriptor bConfigurationValue.

Even more unfortunately, some devices have bConfigurationValue in a config descriptor set to zero, and you have to write 0 to select the first configuration. Of course, you can't then get the device back to the Default state other than via USB Reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.