USB OTG File Deletion

♀尐吖头ヾ 提交于 2019-12-13 03:20:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!