问题
I have a device (an mp3 player) connected to the smartphone through the USB OTG cable. I am trying to find an SDK of some kind which provides some API for file deletion. Right now the only software that was able to work properly is OTG Disk Explorer Pro 3.02. I managed to redirect its debug messages into a file to be able to actually read it. Here is a log:
2019-02-01 11:43:14 :: ODE :: >==< Found device: 0781:74E8 Class 00:00 >==<
2019-02-01 11:43:14 :: ODE :: >==< Device under: /dev/bus/usb/001/003 >==<
2019-02-01 11:43:14 :: ODE :: >==< No permission >==<
2019-02-01 11:43:14 :: ODE :: >==< no more devices found >==<
2019-02-01 11:43:14 :: ODE :: >==< On start. >==<
2019-02-01 11:43:16 :: ODE :: >==< Permission granted >==<
2019-02-01 11:43:16 :: ODE :: >==< Premission:true >==<
2019-02-01 11:43:16 :: ODE :: >==< Interface Count: 1 >==<
2019-02-01 11:43:16 :: ODE :: >==< connecting... >==<
2019-02-01 11:43:16 :: ODE :: >==< Got interface! >==<
2019-02-01 11:43:16 :: ODE :: >==< Claimed interface! >==<
2019-02-01 11:43:16 :: ODE :: >==< Class: 0x08 >==<
2019-02-01 11:43:16 :: ODE :: >==< Sub Class: 0x05 >==<
2019-02-01 11:43:16 :: ODE :: >==< Protocol: 0x50 >==<
2019-02-01 11:43:16 :: ODE :: >==< EP: 0x81 >==<
2019-02-01 11:43:16 :: ODE :: >==< Bulk Endpoint >==<
2019-02-01 11:43:16 :: ODE :: >==< [IN] >==<
2019-02-01 11:43:16 :: ODE :: >==< EP: 0x02 >==<
2019-02-01 11:43:16 :: ODE :: >==< Bulk Endpoint >==<
2019-02-01 11:43:16 :: ODE :: >==< [OUT] >==<
2019-02-01 11:43:16 :: ODE :: >==< USBInterface#0 >==<
2019-02-01 11:43:16 :: FTDI_USB :: >==< readcapacity >==<
2019-02-01 11:43:16 :: FTDI_USB :: >==< Capacity Result:00 fc cf ff 00 00 04 00 >==<
2019-02-01 11:43:16 :: FTDI_USB :: >==< Sectors, Sector Size:16568319, 1024 >==<
2019-02-01 11:43:16 :: ODE :: >==< Sectorsize:1024 >==<
As can be seen, it has 0x08 - Mass Storage Class and 0x50 protocol (Bulk-Only). So the program operates with a device through bulk endpoints. I read USB Mass Storage Bulk Transfer Specification, but it is unclear to me how to do the file deletion. Can you please point me out to the right direction?
来源:https://stackoverflow.com/questions/54485506/usb-otg-file-deletion