public void setDevice(UsbManager usbManager, UsbDevice usbDevice) { // Log.d(TAG, "setDevice " + usbDevice); device = usbDevice; if (device != null) { usbDeviceDump(usbDevice); UsbInterface controlInterface = device.getInterface(1); endpoint = controlInterface.getEndpoint(0); UsbDeviceConnection connection = usbManager.openDevice(device); if (connection != null && connection.claimInterface(controlInterface, true)) { controlConnection = connection; serial = UsbSerialDevice.createUsbSerialDevice(device, controlConnection); boolean t = serial.open(); Log.d("Set DEVICE : ", "" + t); serial.setBaudRate(9600); serial.setParity(UsbSerialInterface.PARITY_NONE); serial.setStopBits(UsbSerialInterface.STOP_BITS_1); serial.setDataBits(UsbSerialInterface.DATA_BITS_8); } else { Log.e(TAG, "open connection FAIL"); controlConnection = null; } } }