espressif / esp-usb

Other
15 stars 9 forks source link

USB Host MSC: Add request sense feature #34

Closed peter-marcisovsky closed 2 weeks ago

peter-marcisovsky commented 1 month ago

Closing IDF-9890

Added request sense feature for MCS driver.

After each BOT command execution a CSW is checked for possible errors. If an error is present in the MSC device a bCSWStatus is returned to the Host as non zero. Ref: USB Mass Storage Class – Bulk Only Transport table 5.3. But a current MSC Host driver does not allow the user to find out what is causing the error.

This MR adds a feature to the MSC Host to issue a request sense to the MSC device each time, after checking CSW for errors. The request sense command returns specific error code. Ref: USB Mass Storage Class – UFI Command Specification Chapter 4.11 and Table 51

peter-marcisovsky commented 4 weeks ago

@roma-jam Coul you please take a look at the failing CI? It looks like it's related to the recent enumeration refactoring. I tried running the pytest locally on esp-idf master and reproduced the same error as in the CI.

2024-06-05 13:21:44 [dut-1] D (1418) ENUM: [0:0] CHECK_FULL_PROD_STR_DESC OK
2024-06-05 13:21:44 [dut-1] D (1428E (1428) USBH: Dev 1 EP 0 STALL
2024-06-05 13:21:44 [dut-1] ) ENUM: [0:0] GET_SHORT_SER_STR_DESC OK
2024-06-05 13:21:44 [dut-0] W (12908) tusb_desc: String index (3) points to NULL, check your string descriptor
2024-06-05 13:21:44 [dut-1] D (1428) USBH: Processing actions 0xc
2024-06-05 13:21:44 [dut-1] D (1438) USBH: Default pipe device 1
2024-06-05 13:21:44 [dut-1] E (1438) ENUM: [0:0] Control transfer failed, status=4
2024-06-05 13:21:44 [dut-1] D (1448) ENUM: [0:0] CANCEL OK
tore-espressif commented 2 weeks ago

@peter-marcisovsky Please let me know if we should wait for the CI pass or whether I can force merge 🥇

peter-marcisovsky commented 2 weeks ago

@tore-espressif we are only waiting for GitLab master branch sync to GH, to pass the CI. So This MR is ready to be merged

roma-jam commented 2 weeks ago

@peter-marcisovsky @tore-espressif CI unlocked, feel free to merge :rocket: