I'm using OHCI, and giving the IN bulk endpoint a memory buffer of 8 bytes. Unless the SCSI spec says that the response should be big endian, I have no idea how this is possible. Surely the USB controller isn't swapping bytes on the fly...
Googling for "SCSI big endian little endian", first hit says:
Sonofa........ okay. I'm going to edit the Wiki page tonight to add a SCSI page, that simply says "SCSI devices are Big Endian", and click save.Other CPUs, such as the Sun SPARC system, IBM's PowerPC, and Hewlett-Packard Precision Architecture systems, as well as SCSI devices and network protocols use a "big endian" model, where the most significant byte is at the lowest address in memory.
Okay... second question. The Bulk-Only USB Mass Storage Device specifications state that:
I'm not exactly sure what this is trying to say, as it is a little ambiguous. Is it saying that, in my case (SCSI READ CAPACITY above), I should send 31 bytes to the OUT endpoint, then read 8 bytes from the IN endpoint to get the data from the SCSI device, then read 13 bytes from the IN endpoint to get the status block from the USB device?The CBW shall start on a packet boundary and shall end as a
short packet with exactly 31 (1Fh) bytes transferred. Fields
appear aligned to byte offsets equal to a multiple of their byte
size. All subsequent data and the CSW shall start at a new
packet boundary.
The CSW shall start on a packet boundary and shall end as a short packet with exactly 13 (0Dh) bytes
transferred. Fields appear aligned to byte offsets equal to a multiple of their byte size.
I tried sending 31 bytes to the OUT endpoint, and reading 21 bytes from the IN endpoint, and the command failed.
What do the specs above mean by "shall start on a packet boundary", if the out packet is 31 bytes, the response data is 8 bytes, and the response status block is 13 bytes? Does it mean that I should read 13 data bytes as well, so that it will be "aligned"? (I highly doubt that...)
Thanks, guys.