Code example for UsbDeviceConnection

Methods: bulkTransfer

0
		return _calc_dcs(data, len, 0);
	} 
 
	//////////////////////////////////////////////////// 
	private static synchronized short _port_write(final byte[] data, int len) {
		int ret = mDeviceConnection.bulkTransfer(mEndpointOut, data, len, 500);
		return (short)ret;
	} 
 
	private static synchronized short _port_read(byte[] data, int len) {
		int ret;
		while(true) { 
			ret = mDeviceConnection.bulkTransfer(mEndpointIn, data, len, 0);
			if(ret != -1) {
				break; 
			} else { 
				Log.e(TAG, "USB read fail");
			} 
		} 
		return (short)ret;
	}