Author Topic: dCBWDataTransferLength value for an Inquiry SCSI Command  (Read 12343 times)

tbol.inq

  • Member
  • ***
  • Posts: 2
dCBWDataTransferLength value for an Inquiry SCSI Command
« on: February 17, 2015, 07:12:55 am »
Hi there,

I'm trying to create a Command Block Wrapper (CBW) with a Command Descriptor Block (CDB) for the SCSI Command: Inquiry and I don't know how to get the dCBWDataTransferLength value of it.
I'v read in "USB Mass Storage Devices - Designing and Programming Devices and Embedded Hosts":
Quote
The dCBWDataTransferLength field indicates how many bytes the host will send or how many bytes the host expects to receive.

and
Quote
The response to an INQUIRY command is at least 36 bytes. [...]

Is it enough to initialize with:
Code: [Select]
struct cbw {
...
uint32_t dCBWDataTransferLength;
...
}cbw_inquiry;
...
cbw_inquiry->dCBWDataTransferLength =  36;

Or better using
Code: [Select]
#define INQUIRY_RESPONSE_LENGTH 0x00000024
cbw_inquiry->dCBWDataTransferLength = INQUIRY_RESPONSE_LENGTH;

How to initalize?



EDIT:
Just one more Question, I've read that the Inquiry Command consists of three transport phases:
  • Command Transport
  • Data Transport
  • Status Transport

I created a URB with a CBW(and a CDB for an Inquiry Command) and submitted it to the out endpoint. Is that the Command Transport Phase?

What I have to do for receiving the Data? Will it be enough to create a CSW (Command Status Wrapper) and listening on the IN endpoint?
« Last Edit: February 17, 2015, 08:46:57 am by tbol.inq »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: dCBWDataTransferLength value for an Inquiry SCSI Command
« Reply #1 on: February 17, 2015, 12:21:33 pm »
You can use an explicit value or constant to specify 36 bytes.

Yes, the command is the Command Transport phase.

To read data in the Data Transport phase, send IN token packets to the bulk IN endpoint.

The Status Transport phase follows the Data Transport phase.

tbol.inq

  • Member
  • ***
  • Posts: 2
Re: dCBWDataTransferLength value for an Inquiry SCSI Command
« Reply #2 on: February 18, 2015, 08:24:39 am »
You can use an explicit value or constant to specify 36 bytes.

Yes, the command is the Command Transport phase.

[...]

The Status Transport phase follows the Data Transport phase.

Thank you, Now I've finished the Command Transport Phase correctly.

[...]
To read data in the Data Transport phase, send IN token packets to the bulk IN endpoint.
[...]

What do you mean when saying "IN token packets"?
Is it right to put a struct of type INQUIRY-DATA Format into a CDB and send it to the bulk IN endpoint or how to grab the Data from the IN-Endpoint?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: dCBWDataTransferLength value for an Inquiry SCSI Command
« Reply #3 on: February 18, 2015, 09:26:51 am »
No, to receive data, the host sends IN token packets to the bulk IN endpoint, and in response, the IN endpoint sends data or NAK to the host. The host ACKs any received data.

A host can't send data to an IN endpoint.