try { UsbDeviceConnection connection = manager.openDevice(device); UsbInterface intf = device.getInterface(0); UsbEndpoint endpoint = intf.getEndpoint(0); int direction = endpoint.getDirection(); Toast.makeText(StartActivity.this,"Direction Of Data Transfer :"+direction,Toast.LENGTH_SHORT).show(); ByteBuffer recvBuffer = ByteBuffer.allocate(endpoint.getMaxPacketSize()); recvBuffer.clear(); UsbRequest request = new UsbRequest(); request.initialize(connection, endpoint); UsbRequest finishReq; while ((finishReq = connection.requestWait()) != request) { if (finishReq == null) throw new IOException("Request failed."); int res = connection.bulkTransfer(endpoint,b,"Hello".length(), 100); if(res==1) Toast.makeText(this, "Failed :" , Toast.LENGTH_LONG).show(); Thread.sleep(100); } } catch(Exception e) { Toast.makeTest(this,"Exception :"+e.getMessagage,Toast.LENGTH_LONG).show(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)