Multiple WinUSB devices

Hi,
I’m using WinUSB to communicate with my device.
When connecting multiple instances of such a device to the PC I can see several entries in the Device-Manager.
My PC application uses the regular WinUSB API to communicate with these devices and it supports detecting and communicating with multiple devices simultaneously.
Up until here everything is sweet - works fine.

Now to my problem - Sometimes, when the devices are connected to the PC on the same USB hub, when one of the devices is reset and generates a re-enumeration, this re-enumeration causes the OTHER devices to fail on a WinUsb_ReadPipe or WinUsb_WritePipe command with error code 31 (“A device attached to the system is not functioning.”).

Is this a known issue? Am I missing anything? Do I need to add any special handling in my application for such a scenario?

Thanks,
Guy.

My guess is the device reset puts the physical hub they share into a bad state. Does it repro with different types of hubs?

d

dent from pjone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?12/?2/?2012 7:13 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Multiple WinUSB devices

Hi,
I’m using WinUSB to communicate with my device.
When connecting multiple instances of such a device to the PC I can see several entries in the Device-Manager.
My PC application uses the regular WinUSB API to communicate with these devices and it supports detecting and communicating with multiple devices simultaneously.
Up until here everything is sweet - works fine.

Now to my problem - Sometimes, when the devices are connected to the PC on the same USB hub, when one of the devices is reset and generates a re-enumeration, this re-enumeration causes the OTHER devices to fail on a WinUsb_ReadPipe or WinUsb_WritePipe command with error code 31 (“A device attached to the system is not functioning.”).

Is this a known issue? Am I missing anything? Do I need to add any special handling in my application for such a scenario?

Thanks,
Guy.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron,

Thanks for the quick response.
Actually, this happens even when using the same PC Root-Hub (not an external hub). I mean if I plug in 2 devices into the USB slots in the front of the PC, then this issue repros, but if one device is plugged in at the front and the other at the back, then it works fine.

Thanks,
Guy.

Open device manager and view by connection, I am betting the ports in the front are on a different controller than the ones on the back. Test with a downstream hub too

d

dent from pjone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?12/?2/?2012 10:32 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Multiple WinUSB devices

Hi Doron,

Thanks for the quick response.
Actually, this happens even when using the same PC Root-Hub (not an external hub). I mean if I plug in 2 devices into the USB slots in the front of the PC, then this issue repros, but if one device is plugged in at the front and the other at the back, then it works fine.

Thanks,
Guy.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Yes we’ve checked in the device manager that the back & front ports are on different controllers. As you said, this could indicate that the problem is actually some kind of “bad state” in the physical hub.
Question is, is this something that can be caused by the way my application accesses the device? Is there some way my application can recover from such an error?

Thanks,
Guy.

Your app shouldn’t be able to do this, so no, I don’t think it is the app’s fault. As such, I don’t think you can recover from it from within the app. I would take a usb core stack ETL trace and repro the issue, perhaps your device is doing something non compliant on the wire.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, December 03, 2012 12:06 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Multiple WinUSB devices

Yes we’ve checked in the device manager that the back & front ports are on different controllers. As you said, this could indicate that the problem is actually some kind of “bad state” in the physical hub.
Question is, is this something that can be caused by the way my application accesses the device? Is there some way my application can recover from such an error?

Thanks,
Guy.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

OK, problem found.
It seems that we had a timing issue when handling the USB device handles when a certain device restarted (and re-enumerated). Apparently, this timing issue caused the application to try and access our USB device via a handle that was no longer relevant, hence the error-code 31.
Doron - thanks for your assistance.
Guy.