protected void testConnection(boolean full, String msg) throws IOException {
        if(mUsbRequest == null) {
            throw new IOException("Connection closed");
        }
        if(!full) {
            return;
        }
        byte[] buf = new byte[2];
        int len = mConnection.controlTransfer(0x80 /*DEVICE*/, 0 /*GET_STATUS*/, 0, 0, buf, buf.length, 200);
        if(len < 0)
            throw new IOException(msg);
    }
use simple USB request supported by all devices to test if connection is still valid
usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/CommonUsbSerialPort.java