Hi,
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
Kolja
Hi Coljia:
I think current USB stack not supports this feature. You need to implement it by yourself.
I would suggest you check SCSI command spec which described detailed command transferred on USB bulk endpoints. KSDK USB stack implemented SCSI command protocol.
The medium present and write protect information should be in the sense data which can be returned when you issue request sense command.
Regards
Daniel