From: Tim R. <ti...@pr...> - 2019-11-21 00:12:49
|
On Nov 20, 2019, at 12:58 PM, Michael Bacarella <mic...@gm...> wrote: > > Out of curiosity, if a device has more than one configuration, how would a programmer know which one to pick to set? Is the answer to this too hard to generalize? Yes, and that is one reason why multi-configuration devices are quite rare. It seems like a good idea, but it’s difficult to implement properly; you basically end up unplugging and replugging the whole device, because the new configuration can have entirely different interfaces and need entirely different drivers. The other reason is that Windows does not handle them particularly well. > So, I think I figured this out. My problem was that I'm too ignorant of USB and didn't call recv with the endpoint address that corresponds to interface 4. I had hard-coded endpoint address to 1 in my code and forgotten about it. Not sure why I didn't notice that sooner; I guess my coffee had worn off. Ah! Yes, the endpoint numbers are the critical ones. Interfaces are just a convenient way to group endpoints. > I searched through the active config descriptor for the device and found that, for interface 4, there are two endpoint addresses, 132 and 3. Choosing the first one seems to work now. I get back packets when I move knobs on the controller that look similar to the packets for the other model controller from the same company. So I suspect my issue is solved. > > I'm a little unclear on what the second endpoint address is for. (I'm wondering aloud, I don't expect anyone besides the manufacturer to know the answer). Endpoint numbers are traditionally rendered in hex. That’s 0x03 and 0x84. The top bit of the endpoint number tells you the direction. 0x84 is an input endpoint (device to host), and 0x03 is an output endpoint (host to device). All endpoints (except the single control endpoint) are unidirectional. — Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |