[U-Boot] USB mass storage gadget patch

victor
2012-11-05T06:45:20Z

Lukasz,

>>> 2) Now I can use the patch and process till SCSI MODE_SELECT_6
>>> command, and then problem is encountered. Basically the SCSI
>>> MODE_SELECT_6 is sent to EP1 Out, then data is sent to EP1 out, and
>>> the fsg_main_thread only sees the data. I change the code to force
>>> the CSW.
>>
>>Can you explain further problems which you encounter?
>>
>>I'm using this UMS version internally (the version which you pointed out
with the link) for debugging our targets.
>>
>>I'm using Debian Linux as a host with standard tools like dd and
parted/fdisk. I don't have any problems with it (even with debug messages
enabled).
>>
>>
>
>In cmd_usb_mass_storage.c, do_usb_mass_storage(), the while(1) loop, the
usb_gadget_handle_interrupts() will handle the interrupts that is triggered,
and received data
> from EP1 out, and bh-state >is set to BUF_STATE_FULL in
bulk_out_complete(). And then fsg_main_thread() in file_storage.c is called.
And then get_next_command() is called.
>And then start_transfer() is called. In that function, the bh->state will
be set to BUF_STATE_BUSY. Because of this change, for two consecutive data
from EP1 out, one data is missed.

>I can send the full source code to you if it is helpful. Thanks.

On further research into this, when receiving the SCSI_MODE_SELECT_6
command, in bulk_out_complete(), the bh pointer is 0x1b872e4

====== debug statement from console ======
0x43425355 0x507bc10 0x18 0x15060000 0x18000010 0x0 0x0
bulk_out_complete 0x1b872e4

Then, in get_next_command(), before calling start_transfer(), the bh pointer
becomes 0x1b87304.

This changes in bh pointer can cause data not to be processed by the usb
mass storage gadget code.