On Tue, 2 Jul 2013, Victor Yeo wrote: > Hi, > > > No, that's not right. Set-Config has only two stages, Setup and > > Status; there is no Data stage. The flow is: > > > > Host Device > > ----- Setup Packet ---> | > > ----- Data0 Packet ---> |== Setup stage > > <---- Ack Packet ------ | > > > > ----- In Packet ------> | > > <---- Data1 Packet ---- |== Status stage > > ----- Ack Packet -----> | > > > > > >> "ACK the Status stage of an OUT control transfer", is it referring to > >> the Third ACK packet? So UDC driver should ACK only after Data1 packet > >> is sent via the usb_ep_queue()? > > > > I meant the Data1 packet above. The UDC driver should not send this > > packet until the gadget driver tells it to (by calling usb_ep_queue). > > Until then, it should send NAK in respond to the In packet. > > Is the Data1 packet above containing no data, such as this? > > PID !PID CRC Yes. > I do not see the gadget driver calling usb_ep_queue() for sending the > Data1 packet. Please see the log below. Is there similar code in > net2280.c handle_stat0_irqs() that handles Set-Config? net2280.c does not handle Set-Config; it passes those requests to the gadget driver. > g_file_storage gadget: ep0-setup, length 8: > 00000000: 00 09 00 00 00 00 00 00 > g_file_storage gadget: set configuration > after kagen2_ep_queue > kagen2_ep_queue 31 64 31 > [kagen2_ep_queue] 43425355 899e1008 > g_file_storage gadget: bulk-out, length 31: > 00000000: 55 53 42 43 08 10 9e 89 00 00 00 00 00 00 0a 35 > 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > g_file_storage gadget: SCSI command: SYNCHRONIZE CACHE; Dc=10, Dn=0; > Hc=10, Hn=0 > g_file_storage gadget: ep0-setup, length 8: > 00000000: 80 08 00 00 00 00 01 00 > g_file_storage gadget: get configuration > ept0 in queue len 0x1, buffer 0xc1289800 > ep0_complete > g_file_storage gadget: ep0-in, length 1: > 00000000: 01 > attention condition I can't tell what's going on in your log. Look at the FSG_STATE_CONFIG_CHANGE case in handle_exception(). Here's the code: rc = do_set_config(fsg, new_config); if (fsg->ep0_req_tag != exception_req_tag) break; if (rc != 0) // STALL on errors fsg_set_halt(fsg, fsg->ep0); else // Complete the status stage ep0_queue(fsg); break; It calls do_set_config(). After that, fsg->ep0_req_tag should be equal to exception_req_tag and rc should be equal to 0. Therefore the code will call ep0_queue(), which calls usb_ep_queue(). You can add some debugging printk statements to make sure it really does behave this way. 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