Following a simple tutorial , I can connect to the device (usb optical mouse with an ADNS-5000 chip inside) and make 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
The ADNS-5000 specification (can be disabled) defines a certain set of "USB commands", among which there are, for example:
Mnemonics: Get_Status_Device
Team: 80 00 00 00 00 00 00 02 00
Notes: Usually returns 00 00, Power 00 00, Remote Awakening 02 00
So, I understand this as: when I write data:
private byte[] bytes = {(byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00};
I should get either 0x00, 0x00 , or 0x00, 0x00 to the device (this is probably an error in spec, because this sequence of bytes is defined as the result for two different statuses) or 0x20, 0x00 in return , but I donโt see any way api returned something, am i right?
android android-usb usb-hostcontroller
Marian paลบdzioch
source share