Hi, >> However, the USB-2 spec says (section 9.2.6.4) that devices should be >> able to carry out requests with no Data stage (such as Set-Config) >> within 50 ms. Does your gadget really take longer than that to handle >> the exception? >> >> To find out, collect a usbmon trace showing what happens when your new >> driver is plugged into a Linux host. >> >>> I have set the NAK and >>> stall the endpoint 0 after receiving Set-Config request, however, >> >> That doesn't make sense. Stalling the endpoint means sending a STALL >> packet. You can't send both a STALL and a NAK. >> >>> Get-Config request is still sent out by USBCV host immediately. >> >> There should be at least a 50-ms delay, unless the UDC driver is doing >> something wrong. > > The latest usbmon trace is attached. From the trace, the timing is > within 50ms from Set-Config request to the next request. > >> Does your gadget really take longer than that to handle the exception? > Yes, i think there is a delay before gadget calls the > handle_exception() routine. So the problem is before > handle_exception() of Set-Config request is called, the next request > is sent out already by the host. So if the next request is Get-Config, > it will not return the latest config value. As can be seen in the gadget driver log below, after Set-Config request is received, another two more requests are received before handle_exception() is called. If there is a way to call handle_exception() immediately after Set-Config request, it would be very helpful. g_file_storage gadget: ep0-setup, length 8: 00000000: 00 09 01 00 00 00 00 00 g_file_storage gadget: set configuration and stall endpoint g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 04 03 09 04 ff 00 g_file_storage gadget: get string descriptor ept0 in queue len 0x1a, buffer 0xc1297800 ep0_complete g_file_storage gadget: ep0-in, length 26: 00000000: 1a 03 53 00 65 00 6c 00 66 00 2d 00 70 00 6f 00 00000010: 77 00 65 00 72 00 65 00 64 00 g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 05 03 09 04 ff 00 g_file_storage gadget: get string descriptor ept0 in queue len 0x1a, buffer 0xc1297800 ep0_complete g_file_storage gadget: ep0-in, length 26: 00000000: 1a 03 4d 00 61 00 73 00 73 00 20 00 53 00 74 00 00000010: 6f 00 72 00 61 00 67 00 65 00 handle_exception begin handle_exception wait until handle_exception old_state 4 g_file_storage gadget: set interface 0 g_file_storage gadget: high-speed config #1 FSG_STATE_CONFIG_CHANGE 19 21 0 g_file_storage gadget: in handle_exception loop Thanks, victor -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html