@Override
        public void setFlowControl(FlowControl flowControl) throws IOException {
            byte[] data = new byte[16];
            if(flowControl == FlowControl.RTS_CTS) {
                data[4] |=  0b1000_0000; // RTS
                data[0] |=  0b0000_1000; // CTS
            } else {
                if(rts)
                    data[4] |= 0b0100_0000;
            }
            if(flowControl == FlowControl.DTR_DSR) {
                data[0] |= 0b0000_0010; // DTR
                data[0] |= 0b0001_0000; // DSR
            } else {
                if(dtr)
                    data[0] |= 0b0000_0001;
            }
            if(flowControl == FlowControl.XON_XOFF) {
                byte[] chars = new byte[]{0, 0, 0, 0, CHAR_XON, CHAR_XOFF};
                int ret = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, SILABSER_SET_CHARS_REQUEST_CODE,
                        0, mPortNumber, chars, chars.length, USB_WRITE_TIMEOUT_MILLIS);
                if (ret != chars.length) {
                    throw new IOException("Error setting XON/XOFF chars");
                }
                data[4] |= 0b0000_0011;
                data[7] |= 0b1000_0000;
                data[8] = (byte)128;
                data[12] = (byte)128;
            }
            if(flowControl == FlowControl.XON_XOFF_INLINE) {
                throw new UnsupportedOperationException();
            }
            int ret = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, SILABSER_SET_FLOW_REQUEST_CODE,
                    0, mPortNumber, data, data.length, USB_WRITE_TIMEOUT_MILLIS);
            if (ret != data.length) {
                throw new IOException("Error setting flow control");
            }
            if(flowControl == FlowControl.XON_XOFF) {
                setXON(true);
            }
            mFlowControl = flowControl;
        }
emulate external XON/OFF
@throws IOException
usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.java