问题
My question is quite simple: I operate 20 CP210x (Silicon Lab) devices over an industrial 20 Port USB Hub.
In one of about 1000 trials to open the port I get a problem: The call to
CreateFile(portName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
is blocking and doesn't return. In this case it doesn't help to repeat or to restart my software. Only plugging out/in the device helps. Of course the port name is including backslashes, as required for higher COM Port numbers. The port is closed without getting an error after each communication by
CloseHandle(comport_p);
I could give more details on my source, but think, that the relevant parts are the mentioned lines. Is there something else I have to consider in my software or could there be a driver problem?
来源:https://stackoverflow.com/questions/49688772/usb-vcp-connection-fails-occasionally