As you know, as a USB client driver we mustimplement the function USBDeviceAttach. This function to check if the interfacematch this driver.


But in this function we should not usetransfer command(IN/OUT packet) to set/get information(like descriptors)to/from USB device. Because in function USBDeviceAttach we need to avoid thecase of USB device detach.


Normally it should be OK, any command youcan issuing to the specific interface when running the attach function, but atsome cases such as stress testing, you will find the function hung up.


As I suggest,you can do so much to meet therequirement in the attaching fucntion by the parameters transferred from USBcore but not to do any actual transfer with USB device. USB core call theUSBDeviceAttach, and give us so many parameters, that is enough for us to meetthe function of attach.


You can issuing the actual transfer withUSB device after the function USBDeviceAttach return.


Another information, USB core using thethread with priority 104 to process detaching.