I have a 12-slot USB tester here, running WinXP Pro SP1. I'm using the
Host enumeration method documented in UsbView to determine what devices
are present after powering up the machine. I'm having a problem, though.
Windows is busy trying to detect these devices at the same time as I am,
and it takes a Looooong time to finish the job, especially when it's
never seen any of the specific devices before (i.e., 30-50 seconds to
finish processing 12 devices, if they all have new serial numbers).
The problem that I've found is this; if I put a long delay in the code,
and make sure Windows is done before I start enumerating devices,
everything works fine. However, if I start off calling the enumeration
functions before Windows is done, various problems occur; either Windows
does not ultimately register some of the devices properly, or they appear
to work but don't get normal data transfer rates, or various other
anomalies.
Details: My enumeration process is: call the UsbView enumeration
functions (which are DeviceIOControl calls with various IOCTL_USB_
variants). If any of them fail, stop and wait five seconds, then try
again. BTW, this is all being done from a user application, not a device
driver.
Once this works successfully, I open the devices using CreateFile, and do
some other data collection. However, in this case, I'm not going that
far. I'm finding that just calling these enumeration functions while
Windows is still busy working on the devices, is suffient to cause
problems later, as I described previously.
So, my questions are these:
1. Is there some way I can programmatically determine when Windows is
done doing its work, without me accessing the devices themselves, so I
can tell when its okay for me to proceed??
2. Is there some way to speed up Windows' enumeration processes?? Having
to wait 30-50 seconds each time a new bank of parts is inserted, is not
going to be a good thing in a production environment.
I would be *very* grateful for assistance with these problems.
Dan Miller