Hi, >>>> > the parameter is file=/dev/mmcblk0p1 >>> >>> Perhaps you have already realized this... mmcblk0p1 is the first >>> partition of the mmcblk0 device. Block 0 of the partition is the boot >>> sector, not the MBR. The MBR is block 0 of the mmcblk0 device. So >>> perhaps you really meant to use: >>> >>> file=/dev/mmcblk0 >>> >>>> I see a problem here. The first 32 bytes of the boot sector is >>>> correct. The rest of the bytes are 00000000, which is wrong. See the >>>> usbmon trace below. >>>> >>> >>> Are you certain this is wrong? All those 0's could be unoccupied >>> entries in a FAT. >> >> For testing purpose, i would like to create a backing file, and then >> use it with g_file_storage, such as below: >> >> # modprobe g_file_storage file=/tmp/backing_file >> >> Can i use an ordinary text file as the backing file? > > I find a link which contains answers to my question above. > > http://www.linux-usb.org/gadget/file_storage.html >
Now i insmod g_file_storage gadget with file=/mnt/sd/backing_file, the SCSI_READ_10 command is still not working properly. See the gadget log below. The g_file_storage gadget receives "SCSI command: Unknown xa1" from the Linux host near the end of the log. Something is wrong. Thanks, victor g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 00 01 00 00 12 00 g_file_storage gadget: get device descriptor g_file_storage gadget: ep0-in, length 18: 00000000: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02 00000010: 00 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 00 02 00 00 20 00 g_file_storage gadget: get configuration descriptor g_file_storage gadget: ep0-in, length 32: 00000000: 09 02 20 00 01 01 04 c0 01 09 04 00 00 02 08 06 00000010: 50 05 07 05 81 02 00 02 00 07 05 01 02 00 02 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 00 09 01 00 00 00 00 00 g_file_storage gadget: set configuration 00000010: 00 00 00 24 00 00 00 00 00 00 00 00 07 00 00 g_file_storage gadget: reset config g_file_storage gadget: reset interface g_file_storage gadget: set interface 0 g_file_storage gadget: high-speed config #1 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 02 00 00 00 00 00 00 00 00 00 06 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 g_file_storage gadget: SCSI command: TEST UNIT READY; Dc=6, Dn=0; Hc=6, Hn=0 attention condition g_file_storage gadget: sending command-failure status g_file_storage gadget: sense data: SK x06, ASC x29, ASCQ x00; info x0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 02 00 00 00 00 00 00 00 01 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 03 00 00 00 12 00 00 00 80 00 06 03 00000010: 00 00 00 12 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: REQUEST SENSE; Dc=6, Di=18; Hc=6, Hi=18 g_file_storage gadget: bulk-in, length 18: 00000000: 70 00 06 00 00 00 00 0a 00 00 00 00 29 00 00 00 00000010: 00 00 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 03 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 04 00 00 00 00 00 00 00 00 00 06 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: TEST UNIT READY; Dc=6, Dn=0; Hc=6, Hn=0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 04 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 05 00 00 00 24 00 00 00 80 00 06 12 00000010: 00 00 00 24 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: INQUIRY; Dc=6, Di=36; Hc=6, Hi=36 g_file_storage gadget: bulk-in, length 36: 00000000: 00 00 02 02 1f 00 00 00 4c 69 6e 75 78 20 20 20 00000010: 46 69 6c 65 2d 53 74 6f 72 20 47 61 64 67 65 74 00000020: 30 33 33 33 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 05 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 06 00 00 00 00 00 00 00 00 00 06 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: TEST UNIT READY; Dc=6, Dn=0; Hc=6, Hn=0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 06 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 07 00 00 00 08 00 00 00 80 00 0a 25 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ CAPACITY; Dc=10, Di=8; Hc=10, Hi=8 g_file_storage gadget: bulk-in, length 8: 00000000: 00 00 07 ff 00 00 02 00 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 07 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 08 00 00 00 c0 00 00 00 80 00 06 1a 00000010: 00 3f 00 c0 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: MODE SENSE(6); Dc=6, Di=192; Hc=6, Hi=192 g_file_storage gadget: bulk-in, length 16: 00000000: 0f 00 00 00 08 0a 04 00 ff ff 00 00 ff ff ff ff g_file_storage gadget: bulk-in set halt g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 08 00 00 00 b0 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 09 00 00 00 00 00 00 00 00 00 06 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: TEST UNIT READY; Dc=6, Dn=0; Hc=6, Hn=0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 09 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0a 00 00 00 08 00 00 00 80 00 0a 25 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ CAPACITY; Dc=10, Di=8; Hc=10, Hi=8 g_file_storage gadget: bulk-in, length 8: 00000000: 00 00 07 ff 00 00 02 00 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0a 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0b 00 00 00 c0 00 00 00 80 00 06 1a 00000010: 00 3f 00 c0 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: MODE SENSE(6); Dc=6, Di=192; Hc=6, Hi=192 g_file_storage gadget: bulk-in, length 16: 00000000: 0f 00 00 00 08 0a 04 00 ff ff 00 00 ff ff ff ff g_file_storage gadget: bulk-in set halt g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0b 00 00 00 b0 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0c 00 00 00 00 10 00 00 80 00 0a 28 00000010: 00 00 00 00 00 00 00 08 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=4096; Hc=10, Hi=4096 g_file_storage gadget-lun0: file read 4096 @ 0 -> 4096 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0c 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0d 00 00 00 00 00 00 00 00 00 06 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 g_file_storage gadget: SCSI command: TEST UNIT READY; Dc=6, Dn=0; Hc=6, Hn=0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0d 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0e 00 00 00 00 10 00 00 80 00 0a 28 00000010: 00 00 00 00 00 00 00 08 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=4096; Hc=10, Hi=4096 g_file_storage gadget-lun0: file read 4096 @ 0 -> 4096 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0e 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 0f 00 00 00 08 00 00 00 80 00 0a 25 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ CAPACITY; Dc=10, Di=8; Hc=10, Hi=8 g_file_storage gadget: bulk-in, length 8: 00000000: 00 00 07 ff 00 00 02 00 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 0f 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 10 00 00 00 00 10 00 00 80 00 0a 28 00000010: 00 00 00 00 00 00 00 08 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: READ(10); Dc=10, Di=4096; Hc=10, Hi=4096 g_file_storage gadget-lun0: file read 4096 @ 0 -> 4096 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 10 00 00 00 00 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 11 00 00 00 c0 00 00 00 80 00 06 1a 00000010: 00 3f 00 c0 00 00 00 00 00 00 00 00 74 f9 02 g_file_storage gadget: SCSI command: MODE SENSE(6); Dc=6, Di=192; Hc=6, Hi=192 g_file_storage gadget: bulk-in, length 16: 00000000: 0f 00 00 00 08 0a 04 00 ff ff 00 00 ff ff ff ff g_file_storage gadget: bulk-in set halt g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 11 00 00 00 b0 00 00 00 00 g_file_storage gadget: bulk-out, length 31: 00000000: 55 53 42 43 12 00 00 00 00 02 00 00 80 00 0c a1 00000010: 08 2e 00 01 00 00 00 00 ec 00 00 00 13 00 00 g_file_storage gadget: SCSI command: Unknown xa1; Dc=12, Du=0; Hc=12, Hi=512 g_file_storage gadget: bulk-in, length 0: g_file_storage gadget: bulk-in set halt g_file_storage gadget: sending command-failure status g_file_storage gadget: sense data: SK x05, ASC x20, ASCQ x00; info x0 g_file_storage gadget: bulk-in, length 13: 00000000: 55 53 42 53 12 00 00 00 00 02 00 00 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 00 01 00 00 40 00 g_file_storage gadget: get device descriptor g_file_storage gadget: ep0-in, length 18: 00000000: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02 00000010: 00 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 00 01 00 00 12 00 g_file_storage gadget: get device descriptor g_file_storage gadget: ep0-in, length 18: 00000000: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02 00000010: 00 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 80 06 00 02 00 00 20 00 g_file_storage gadget: get configuration descriptor g_file_storage gadget: ep0-in, length 32: 00000000: 09 02 20 00 01 01 04 c0 01 09 04 00 00 02 08 06 00000010: 50 05 07 05 81 02 00 02 00 07 05 01 02 00 02 01 g_file_storage gadget: ep0-setup, length 8: 00000000: 00 09 01 00 00 00 00 00 g_file_storage gadget: set configuration -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html