I'm working on a design that will use the M3 side of the concerto as a USB host. It will connect to a hub that could have several devices connected to it. I've been able to confirm that i can host a flash drive, keyboard, and various other usb devices.
One device in particular will function as follows. It will be connected as a usb device and communicate. After some setup routines via host control transfers from the M3 to the device, it will re-enumerate on the bus with a new VID, PID, and interface class. After re-enumerating, the M3 will see it as a new device and allocate another hub port to it. Which is great.
Here's my problem. The original connection on the previous port never gets cleaned up. It's still allocated so i end up with two ports set aside for one device. If i physically pull the usb cable from the hub, it will disconnect only from the second port while the original port still is allocated. If i reconnect, then a new port is used. After re-enumeration another port is set aside leaving now two unused ports as allocated.
Now the question is what is the best way to go about cleaning up after the re-enumeration while using usblib in the MWare? It's not always guaranteed that i will be connected to a hub, but in this case i am.
Is it acceptable to call HubDriverDeviceDisconnect() from outside the usblib? Is there a better way?