AnsweredAssumed Answered

How to handle write protection/errors in MSD in unified USBv2 stack?

Question asked by Kolja Waschk on Dec 12, 2016
Latest reply on Dec 13, 2016 by Daniel Chen



I'm using the usb_v2 stack in a MQX4.2-based project on K70 with a SD card slot. Let's say it's an USB card reader.


I would like to allow the USB host access to the SD card content in two different modes: Read-only for access to drivers and documentation of the product, and Read/Write for writing setup and parametrization data. But the MSD implementation in the stack seems to support only Read/Write and no error handling?


There is no possibility to communicate to the host whether there is a medium present at all and whether it is write-protected?? Everything in this regard is hardcoded. The TEST_UNIT_READY handler in msc_test_unit_ready_command() doesn't call any custom callback. The callback for WRITE doesn't check for any errors during the operation.


If you have any hints for me how to add such functionality or derivatives of the USB stack that already support it, I'd really appreciate it!


Thanks in advance