Re: Some restrictions when using usbtest and g_zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 21 Aug 2015, Peter Chen wrote:

> Thanks.
> 
> I don't have much time to debug this problem deeply today. Below
> are some information:
> 
> - The parameter 'stall' is y for g_mass_storage
> - The stall bulk-IN is from the line 1571 at f_mass_storage.c
> 
> If I do not stall this bulk-IN, and return -EAGAIN, the USB
> CV log like below, and the bus analyzer log at success.png

That's how it's supposed to work.  You should return -EAGAIN because 
the endpoint is busy.

> 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 phase stalled, clear stall on CBW endpoint
> INFO
> Retrieving status on stalled CSW endpoint
> INFO
> CSW endpoint status = 0x1
> INFO
> Issuing CSW : try 2
> INFO
> CSW residue returned = 0xdb
> INFO
> CSW status returned = 0x0
> INFO
> Getting Device Type

Okay, that's all normal.

> If I do stall this bulk-IN, and return 0, the USB
> CV log like below, and the bus analyzer log at failure.png
> 
> 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
> DATA phase stalled

The problem occurs here.  You can't tell from this log, but you can see 
it in the analyzer output.  Your failure.png file shows that the STALL 
occurred before any data was sent (transaction 2585).

That's not supposed to happen.  The gadget should send a 24-byte 
bulk-IN packet before sending the STALL.

When the call to halt_bulk_in_endpoint() occurs on line 1571, the
subroutine should call fsg_set_halt() and get a -EAGAIN error because
the 24-byte response packet is still being sent to the host.  It
appears that your UDC halted the endpoint immediately and did not
return -EAGAIN.  That's the bug.

> INFO
> Retrieving status on stalled bulk endpoint
> INFO
> Bulk endpoint status = 0x1
> INFO
> Issuing CSW : try 1
> INFO
> CSW Bulk Request failed with bus error!

I don't know what this means.  Something went wrong, probably another 
bug in the UDC.

> INFO
> Failed CSW phase : should have been success or stall
> ERROR
> BOTCommonMSCRequest failed:  error=80004005
> INFO
> Re-enumerating device
> INFO
> Detected hard error, issuing BOT MSC Reset
> INFO
> Allowing Errors on odd-byte transfers
> 
> The difference between success and failure routine is, one
> is bulk-in is stalled at CSW stage, the other is at data
> stage.

The data-stage stall is not supposed to happen until _after_ the data
has been sent to the host.  See Case (5) in section 6.7.2 of the 
Bulk-Only Transport spec.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux