Author Topic: [RESOLVED] Compliance Test - Required Commands Test failure  (Read 8771 times)

johsey

  • Member
  • ***
  • Posts: 6
Hello,

I am developing a USB card reader and I am facing issues when executing the USB 2.0 Command Verifier compliance test.

Indeed, the error quoted below occurs in the following tests:

  • TD.2.1 Required Commands Test - INQUIRY (Test variation #3)
  • TD.2.1 Required Commands Test - INQUIRY (Test variation #4)
  • TD.2.1 Required Commands Test - REQUEST SENSE (Test variation #3)

Quote
Op Code 0x should be supported
(5.7.1) All devices must support the commands marked as required in 4.2 based on PDT. Devices that support all the commands marked as required for Bootable devices will be reported as Bootable.

The device implements the USB Mass Storage Bulk-Only Transport protocol which requires the device to return a CSW status of 02h in the case 7 (Hi < Di).

I read in the Compliance Test Specification that the Required Commands Test fails if one or more returned CSW status are other than 00h. However, this is in contradiction with the BOT specification.

Am I missing something? Should the device answer with a CSW status equal to 00h even if the length required by the host for the commands INQUIRY and REQUEST SENSE is lower than the device available data?

Thank you for your answers.



Compliance Test log (INQUIRY and REQUEST SENSE tests)

Code: [Select]
INFO
Start time: Fri Jun 13 15:11:09 2014
INFO
Configuring device, set configuration = 0x1
INFO
NOTE: It is expected the device has reset the data toggles on all Bulk endpoints after the above SetConfiguration call
INFO
Setting device interface, interface number = 0x0 and alternate setting = 0x0
INFO
NOTE: It is expected the device has reset the data toggles on all Bulk endpoints after the above SetInterface call
INFO
Issuing Get Max LUN request
INFO
Max LUN value = 0
INFO
Getting Device Type
INFO
Issuing INQUIRY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x24
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x24
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
INQUIRY - Devicetype = 0x0
INFO
**
INFO
Now testing device 'TEST : PRODUCT_ID ', LUN - 0
INFO
**
INFO
Waiting for device to become ready...
INFO
Issuing TEST UNIT READY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x0
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
Device ready
INFO
Getting Device BlockSize
INFO
Issuing READ_CAPACITY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x8
INFO
|----- CBW CDB Length = 0xa
INFO
|----- CBW CDB-00 = 0x25
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
|----- CBW CDB-06 = 0x0
INFO
|----- CBW CDB-07 = 0x0
INFO
|----- CBW CDB-08 = 0x0
INFO
|----- CBW CDB-09 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
READ_CAPACITY - LBA = 0x1143, BlockSize = 0x200
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #1
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
INFO
Allowing Errors on odd-byte transfers
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #2
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x1
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x1
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
INFO
Allowing Errors on odd-byte transfers
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #3
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x2
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x2
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
ERROR
Op Code 0x should be supported
FAIL
(5.7.1) All devices must support the commands marked as required in 4.2 based on PDT. Devices that support all the commands marked as required for Bootable devices will be reported as Bootable.
INFO
**
INFO
Command set 0x12 is required for device to be considered compliant with
INFO
the Bootability specification.
INFO
**
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #4
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x4
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x4
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
ERROR
Op Code 0x should be supported
FAIL
(5.7.1) All devices must support the commands marked as required in 4.2 based on PDT. Devices that support all the commands marked as required for Bootable devices will be reported as Bootable.
INFO
**
INFO
Command set 0x12 is required for device to be considered compliant with
INFO
the Bootability specification.
INFO
**
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #5
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x5
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x5
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
INFO
Allowing Errors on odd-byte transfers
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #6
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x24
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x24
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
Issuing Command Set Test for Op Code 0x12, Test Variation #7
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0xff
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0xff
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0xdb
INFO
CSW status returned = 0x0
INFO
Getting Device Type
INFO
Issuing INQUIRY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x24
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x12
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x24
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
INQUIRY - Devicetype = 0x0
INFO
**
INFO
Now testing device 'TEST: PRODUCT_ID ', LUN - 0
INFO
**
INFO
Waiting for device to become ready...
INFO
Issuing TEST UNIT READY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x0
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
Device ready
INFO
Getting Device BlockSize
INFO
Issuing READ_CAPACITY
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x8
INFO
|----- CBW CDB Length = 0xa
INFO
|----- CBW CDB-00 = 0x25
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
|----- CBW CDB-06 = 0x0
INFO
|----- CBW CDB-07 = 0x0
INFO
|----- CBW CDB-08 = 0x0
INFO
|----- CBW CDB-09 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
READ_CAPACITY - LBA = 0x1143, BlockSize = 0x200
INFO
Issuing Command Set Test for Op Code 0x03, Test Variation #1
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x3
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
INFO
Allowing Errors on odd-byte transfers
INFO
Issuing Command Set Test for Op Code 0x03, Test Variation #2
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x1
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x3
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x1
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
INFO
Allowing Errors on odd-byte transfers
INFO
Issuing Command Set Test for Op Code 0x03, Test Variation #3
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x2
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x3
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x2
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x2
INFO
CSW reported a phase error, issuing BOT MSC Reset
ERROR
Op Code 0x should be supported
FAIL
(5.7.1) All devices must support the commands marked as required in 4.2 based on PDT. Devices that support all the commands marked as required for Bootable devices will be reported as Bootable.
INFO
**
INFO
Command set 0x3 is required for device to be considered compliant with
INFO
the Bootability specification.
INFO
**
INFO
Issuing Command Set Test for Op Code 0x03, Test Variation #4
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0x12
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x3
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x12
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0x0
INFO
CSW status returned = 0x0
INFO
Issuing Command Set Test for Op Code 0x03, Test Variation #5
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN = 0x0
INFO
|----- CBW Flags = 0x80
INFO
|----- CBW Data Transfer Length = 0xff
INFO
|----- CBW CDB Length = 0x6
INFO
|----- CBW CDB-00 = 0x3
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0xff
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing DATA IN
INFO
Issuing CSW : try 1
INFO
CSW residue returned = 0xed
INFO
CSW status returned = 0x0
« Last Edit: June 18, 2014, 11:39:54 am by johsey »

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Compliance Test - Required Commands Test failure
« Reply #1 on: June 13, 2014, 12:57:44 pm »
Could add a little more detail to your question. What is the test sending you, why do you think this is in error?

If you think you have more inquiry data than the host is asking for, why not just send as much as the host asks for? I'm not sure what the spec says about this situation, but my code has two cases there. If I'm doing REALLYSTRICTVALIDATION, I'd give an error if allocation length is not the length of my data. Otherwise, I'll just return what I have. I never run with REALLYSTRICTVALIDATION.

johsey

  • Member
  • ***
  • Posts: 6
Re: Compliance Test - Required Commands Test failure
« Reply #2 on: June 16, 2014, 03:40:14 am »
Barry,

To be more precise, my device expects sending 36 bytes in the response of an INQUIRY command.

The MSC compliance test sends 7 INQUIRY commands with the following allocation lengths:

  • 1 - Allocation length: 0 byte
  • 2 - Allocation length: 1 byte
  • 3 - Allocation length: 2 bytes
  • 4 - Allocation length: 4 bytes
  • 5 - Allocation length: 5 bytes
  • 6 - Allocation length: 36 bytes
  • 7 - Allocation length: 255 bytes

When receiving the five first INQUIRY commands, my device sends data up to allocation length and returns a CSW status equal to 02h (phase error) as required by the USB Mass-Storage Bulk-Only Transport protocol (thirteen cases, case 7, Hi < Di). This causes the compliance test to fail (it expects to receive a CSW status of 00h, which is not in line with the specification).

The specification says in the case where the device expects to send more data than the host requested:

Quote
If the device either intends to send more data than the host indicated or intends to receive data from
the host, then:

  If the device actually transfers less data than the host indicated, then:
    The device may end the transfer with a short packet.
    The device shall STALL the Bulk-In pipe.

  If the device actually transfers dCBWDataTransferLength then:
    The device may STALL the Bulk-In pipe.

  The device shall set bCSWStatus to 02h

So, my question is, should I design for compliance test (return CSW status 00h even) and thus, not respect the specification?

What do you mean by REALLYSTRICTVALIDATION?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Compliance Test - Required Commands Test failure
« Reply #3 on: June 16, 2014, 10:49:59 am »
"If the device either intends to send more data than the host indicated"

Your device is sending what the host indicated. What the device expected to send isn't relevant.

johsey

  • Member
  • ***
  • Posts: 6
Re: Compliance Test - Required Commands Test failure
« Reply #4 on: June 17, 2014, 03:28:09 am »
Jan,

If I have well understood, it means that the case 7 (Hi < Di) can only occur if the value of the field dCBWDataTransferLength of the received CBW is less than the value of the Allocation Length field of the INQUIRY request. Am I right?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Compliance Test - Required Commands Test failure
« Reply #5 on: June 17, 2014, 09:18:27 am »
That's how I would interpret it...

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Compliance Test - Required Commands Test failure
« Reply #6 on: June 17, 2014, 01:23:45 pm »
What do you mean by REALLYSTRICTVALIDATION?
Sorry, I should have said. I just have a symbol in the code REALLYSTRICTVALIDATION. When that's true, the driver validates everything I could think of and fails commands which not exactly as expected. That's mainly just for debugging. If the symbol is false (the normal state), its more forgiving of what the host asks it to do, it allowing this case.

It basically says when I wrote the driver I thought this case violated the spec, but that there's an easy fix (just send the data you have), which would allow the command to proceed even if the host seems to be out of spec.

johsey

  • Member
  • ***
  • Posts: 6
Re: Compliance Test - Required Commands Test failure
« Reply #7 on: June 18, 2014, 03:48:55 am »
Thank you Jan and Barry for your answers.

I modified the device to interpret it the way I described in my last post and my device pass the compliance test successfully.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: [RESOLVED] Compliance Test - Required Commands Test failure
« Reply #8 on: June 18, 2014, 02:25:40 pm »
Good to know it's passing, thanks for the update!