【发布时间】:2016-11-23 21:07:05
【问题描述】:
在the simple tutorial 之后,我可以连接到设备(内置 ADNS-5000 芯片的 USB 光学鼠标)并创建一个 bulkTransfer。
UsbInterface intf = device.getInterface(0);
UsbEndpoint endpoint = intf.getEndpoint(0);
UsbDeviceConnection connection = manager.openDevice(device);
connection.claimInterface(intf, forceClaim);
connection.bulkTransfer(endpoint, bytes, bytes.length, TIMEOUT); //do in another thread
ADNS-5000 规范(可以用谷歌搜索)定义了一些“USB 命令”,例如:
助记符:Get_Status_Device
命令:80 00 00 00 00 00 02 00
注意:正常返回00 00,自供电00 00,远程唤醒02 00
所以我理解为:当我写数据时:
private byte[] bytes = {(byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00};
对于设备,我应该得到0x00, 0x00 或0x00, 0x00 (这可能是规范中的错误,因为此字节序列被定义为两种不同状态的结果) 或0x20, 0x00返回,但我没有看到 api 以任何方式返回任何内容,对吗?
【问题讨论】:
标签: android android-usb usb-hostcontroller