KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I found a question posted for reading of USB data for FTDI devices. Transferring data USB I used this code for prolific device, and the usb can be detected, etc except that the the conn.bulkTransfer() gives a -1. private class UsbRunnable implements Runnable { private final UsbDevice mDevice; UsbRunnable(UsbDevice dev) { mDevice = dev; } public void run() {//here the main USB functionality is implemented UsbDeviceConnection conn = mUsbManager.openDevice(mDevice); if (!conn.claimInterface(mDevice.getInterface(1), true)) { l("in run(), no connection"); return; } l("in run(), connection"); conn.controlTransfer(0x40, 0, 0, 0, null, 0, 0);// reset // mConnection.controlTransfer(0×40, // 0, 1, 0, null, 0, // 0);//clear Rx conn.controlTransfer(0x40, 0, 2, 0, null, 0, 0);// clear Tx conn.controlTransfer(0x40, 0x02, 0x0000, 0, null, 0, 0);// flow // control // none conn.controlTransfer(0x40, 0x03, 0xC04E, 0, null, 0, 0);// baudrate // 38400 conn.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0);// data bit // 8, parity // none, // stop bit // 1, tx off UsbEndpoint epIN = null; UsbEndpoint epOUT = null; byte counter=0; //conn.bulkTransfer(epOUT, new byte[]{msData}, 1, 0); UsbInterface usbIf = mDevice.getInterface(0); for (int i = 0; i < usbIf.getEndpointCount(); i++) { l("EP: " + String.format("0x%02X", usbIf.getEndpoint(i) .getAddress())); l("Type:"+usbIf.getEndpoint(i).getType()); if (usbIf.getEndpoint(i).getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {
Tags (comma-separated)
Save Edits
Cancel