Hi, >> >> g_file_storage gadget: SCSI command: Unknown xa1; Dc=12, Du=0; Hc=12, Hi=512 >> >> g_file_storage gadget: bulk-in, length 0: >> >> [start_transfer] 43425355 12 >> >> ept1 in queue len 0x0, buffer 0xc12ac000 >> >> g_file_storage gadget: bulk-in set halt >> >> I think here is the problem: the bulk-in of length 0. This zero >> length packet is never sent out nor received by the host. What is this >> zero length packet? > > A data packet has three parts: > > a Packet ID (PID) byte, which is either DATA0 or DATA1 for > bulk transfers; > > some variable number N of data bytes; > > two Cyclic Redundancy Check (CRC) bytes. > > A zero-length data packet is one in which N = 0. Such packets contain > exactly three bytes: a PID and two CRC bytes. See Sections 8.3 and > 8.4.4 of the USB-2.0 specification. I modified the UDC driver to send out zero length data packet. Now the linux host is able to see the USB gadget as a mass storage device and read from USB gadget. However, writing to USB gadget fails. The SCSI_WRITE_10 command often receives (-104). The usbmon trace showing this failure is attached. Is the bulk-out endpoint unable to receive command and data continuously, due to error in UDC driver? Also, as in UDC driver log, sometimes the same SCSI_READ_10 command is received repeatedly. It is strange behavior. Thanks, victor
g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 330: 0x53425355 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 5124: 0x2020544f g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 5120: 0x53425355 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 01 00 00 00 02 00 00 80 00 0a 28 00000010: 00 00 00 20 00 00 00 01 00 00 00 00 f8 9e 33 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=512; Hc=10, Hi=512 g_file_storage gadget-lun0: file read 512 @ 4194304 -> 512 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 01 00 00 00 00 00 00 00
Attachment:
scsi_write_10.log
Description: Binary data