I made a module with a G120. In order to be able to sell it, we made some EMC test to make a CE certification. During the tests we encountered a bug, that I want to share with you.
My application is a custom PCB with two usb port on it. The first one is an USB device used to connect to a pc as an HID keyboard. The second is an USB host in which a keyboard is connected. The objectif of the module is to get the key hited on the keyboard, and after compute transmit the same or an other key to the pc.
The problems we have is, that even if the g120 and the custom board behave well, the keyboard used, reboots on some test. And after a reboot of the keyboard, the connection between the g120 and the keyboard is lost. After some test, I figure that no events were raised when the keyboard reboots.
In order to detect that the g120 and the keyboard lost connection I send some data with the SendSetupTransfer() methods. If the connection is lost, this throw an exception. I try-catch the SendSetupTransfer(), and in the catch i read the last error with USBHostController.GetLastError(), if the error is CompletionCode_NoResponse I reset the USBHostController. This work around works pretty well, after few seconds the keyboard is available again.
But I feel this is more an hack than a solution.
My question is: Is there a simplier way to know that the device reboots, or an automatic way for the usbhostcontroller to handle this ?
If you need more explanations or something is not understandable, I can clarify some points.
Sorry for my bad english, and thanks in advance for your answers.
19 dec -> Modification of some sentences.