On Wed, 27 Mar 2013, victor yeo wrote: > Thanks, the halt feature is ok now. The SCSI_READ_10 command has a > problem. The reply value from do_read is -5, which means -EIO. The > for(;;) loop in do_read() was probably broken at "if (amount_left == > 0)". Is this if-statement valid? Yes, it is. do_read() is supposed to return -EIO. This tells the code at the end of do_scsi_command() that the final reply buffer has already been set up. The final buffer is sent to the host by the finish_reply() routine. > Here is the gadget log when receiving SCSI_READ_10 from Linux host. > > g_file_storage gadget: bulk-out, length 31: > 00000000: 55 53 42 43 0f 00 00 00 00 10 00 00 80 00 0a 28 > 00000010: 00 00 00 00 00 00 00 08 00 00 00 00 e0 f8 02 > SCSI CDB: 28 00 00 00 00 00 00 00 08 00 > g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=4096; Hc=10, Hi=4096 > <.... driver read from SD card .....> > g_file_storage gadget-lun0: file read 4096 @ 0 -> 4096 > READ_10 reply -5 *** printk added by me*** > g_file_storage gadget: bulk-in, length 13: > 00000000: 55 53 42 53 0f 00 00 00 00 00 00 00 00 This all looks right. 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