On Mon, 4 Feb 2013, victor yeo wrote: > Thanks, i made a big progress. The udc driver is able to pass the ep1 > data (CBW) to gadget driver, and gadget driver handles the data (which > is SCSI Inquiry command), and udc driver is able to send out the reply > and CSW to host. > > After that, in get_next_command(), in the statement below, the > bh->state is 2 (BUF_STATE_BUSY), and the get_next_command() goes to > sleep and never wakes up. > > while (bh->state != BUF_STATE_EMPTY) { > rc = sleep_thread(fsg); > if (rc) > return rc; > } > > How to set "bh->state" to BUF_STATE_EMPTY after the buffer is processed? It gets set to BUF_STATE_EMPTY in several different places, depending on the purpose the buffer was used for. See bulk_in_complete (your UDC driver should call this routine for every request over a bulk-IN endpoint, when it is safe for the gadget driver to overwrite the data in the transfer buffer and re-use the request). See also get_next_command, the line just after the call to received_cbw. You know, you didn't have to ask me this question. You could have found the answer more easily yourself simply by searching for BUF_STATE_EMPTY in file_storage.c. 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