This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

M3 hosting usb device that re-enumerates

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?

  • Hi Jeff,

    I think HubDriverDeviceDisconnect() should free the port and change it to Idle.

    I have not tried to reproduce this, but do you know what disconnect function is being called when you disconnect from the Hub?

    Can you set breakpoints in HubDriverDeviceDisconnect(), HubDriverClose(), and HubDriverReset() to see if there are being called from the disconnect interrupt?

    sal
  • Just now getting back to this...

    The device is a tablet which is put into Android Open Accessory mode.  There is a soft disconnect when the device removes itself and enumerates again with a new VID and PID.  When this happens the HUB driver would not release the hub port.  Each time i connected it would leak a port until they were all marked used.

    I added USBHCDHubDeviceDisconnected() after issuing the control transfer to put the table in AOA mode.  This is working so far.

  • Jeff,

    Thanks for the update!

    -Ozino