Hi, >> I put printk in fsg_main_thread. After insmod g_file_storage, the >> fsg_main_thread goes to fsg->running. Then it sleeps. > > Do you mean that it executes these lines? > > if (!fsg->running) { > sleep_thread(fsg); > continue; > } > > Here's how it's supposed to work. Initially fsg_main_thread does sleep > there. But when the host sends a Set-Configuration request, > standard_setup_req calls raise_exception, which wakes up > fsg_main_thread (by calling send_sig_info). > > The next time though its big loop, fsg_main_thread calls > handle_exception, which calls do_set_config, which calls > do_set_interface, which sets fsg->running to 1 (near the end of the > do_set_interface routine). > > Then when fsg_main_thread goes through its big loop again, it will call > get_next_command. 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? 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