Sunday, July 7, 2013

[android-developers] Re: USBConnection: bulkTransfer OUT => after sending 10-15 x Data's every 4 seconds = USB is disconnected, every time.

UsbDeviceConnection usbConnection = usbManager.openDevice(device);


UsbInterface usbInterface = device.getInterface(0);


UsbEndpoint usbEndpointIN = null;

UsbEndpoint usbEndpointOUT = null;


for (int e = 0; e < usbInterface.getEndpointCount(); e++) {


UsbEndpoint ep = usbInterface.getEndpoint(e);


if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {

if (ep.getDirection() == UsbConstants.USB_DIR_IN) usbEndpointIN = ep;

else usbEndpointOUT = ep;

}

}

int receive = -1;

temp = ByteBuffer.allocate(16);

while(true) {


int send = usbConnection.bulkTransfer(usbEndpointOUT, buf, buf.length, 1000);


Log.i("Test","" + send);

receive = usbConnection.bulkTransfer(usbEndpointIN, buffer.array(), buffer.array().length, 1000);  


Log.i("Test","" + receive);


}

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate