On Fri, 12 Jul 2013, Victor Yeo wrote: > >> 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. handle_exception() _does_ get called immediately after the Set-Config request. Or rather, the main thread gets woken up immediately, and if the CPU isn't busy doing something else then the main thread will run right away. > 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 Why haven't you turned on CONFIG_PRINTK_TIME on your gadget system? I have asked you several times to do this. Without CONFIG_PRINTK_TIME, there is no way to tell how long it took to reach this spot. > 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 Alan Stern -- 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