Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years ago.
USBHost library
I see the library itself and the sample program for the host responding to a mouse. I'm actually interested in responding to a Wii remote but my question is general. How can the host software recognize when a particular device is attached? How can the host software ignore a device it is not interested in? Each attached device has its identifying information in its device descriptor or one of its endpoint descriptors, so maybe there are functions for fetching fields in those descriptors. I'd like the host software to be able to query attached devices and do transfers to only certain ones.
I'll give you a clue. I'm not holding back, I'm just not real sure of how it all works and a full explanation in any event would be lengthy.
Go into MBED\USBHostMouse_HelloWorld\USBHost\USBHostHID\USBHostMouse.cpp. Go to USBHostMouse::connect. It calls enumerate in USBHost.cpp which calls parseConfDescr. When an endpoint is encountered it calls a callback that's back in usbmouse. The call to that callback is "if( pEnumerator->useEndpoint( ...". This scheme allows the mouse logic to see all of the endpoints that are currently connected, and the mouse logic can do anything it wants as it encounters them.
posted by Alfred Hume 04 Dec 2017