Code example for UsbDeviceConnection

Methods: controlTransfer

0
            throw new IllegalArgumentException("Buffer must be array based (should be allocated using allocateBuffer(int)).");
 
        final byte[] bytes = buffer.array();
 
        final UsbDeviceConnection conn = this.getConnection();
        final int read = conn.controlTransfer(requestType, request, value, index, bytes, bytes.length, timeout);
 
        return read;
    } 
 
    @Override 
    public void close() { 
        if (conn == null)
            return; 
 
        conn.close();
        conn = null;
    } 
}