简体   繁体   English

libusb与USB大容量存储通信

[英]libusb communicate with USB mass storage

I'm currently writing a javax-usb (JSR-80) implementation using libusb 0.1 as a backend. 我目前正在编写一个使用libusb 0.1作为后端的javax-usb(JSR-80)实现。 I need to test the bulk transfer functionality and my guess is that the easiest way to do this is to communicate with a USB mass storage device like a USB flash drive. 我需要测试批量传输功能,我的猜测是,最简单的方法是与USB大容量存储设备(如USB闪存驱动器)进行通信。 Unfortunately I have no idea how these devices are working. 不幸的是,我不知道这些设备如何工作。 I guess there is some kind of protocol and I have to send some USB control requests before I can initiate a transfer on the bulk endpoints. 我想这里有某种协议,我必须先发送一些USB控制请求,然后才能在批量端点上发起传输。

I'm not interested in writing a full USB mass storage driver or something like that so even file system stuff doesn't matter. 我对写一个完整的USB大容量存储驱动程序或类似的东西不感兴趣,所以即使文件系统的东西也没关系。 My only purpose is to transfer some data via some bulk endpoint so I can compare my implementation with the reference implementation. 我唯一的目的是通过一些批量端点传输一些数据,这样我就可以将我的实现与参考实现进行比较。

What I need is some example code (Language doesn't matter and most likely it even doesn't matter if it uses libusb or something different) or a specification of USB mass storage which is easy to understand for programmers (I'm no hardware specialist). 我需要的是一些示例代码(语言并不重要,如果它使用libusb或其他东西,它甚至无关紧要)或USB大容量存储器的规范,这对程序员来说很容易理解(我不是硬件)专家)。 I already searched the web but haven't found anything useful so far. 我已经在网上搜索过但到目前为止还没有找到任何有用的内容。

The USB device class specifications are really not all that difficult to read assuming you know the basics of USB (since you're writing a USB driver, I assume you do). 假设您了解USB的基础知识,那么USB设备类规范实际上并不是那么难读(因为您正在编写USB驱动程序,所以我认为您已经知道)。 Mass Storage Bulk Only v1.0 is probably the document you want. 大容量大容量存储v1.0可能是您想要的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM