I have a quick question here that I haven't been able to find the answer to any where else.
To me, I find it odd that RESET_PURGE_RX is used for purging write buffers and that RESET_PURGE_TX is used for read buffers. Should it be the inverse or are the TX/RX lines flipped in Android?
@Override
public void purgeHwBuffers(boolean purgeWriteBuffers, boolean purgeReadBuffers) throws IOException {
if (purgeWriteBuffers) {
int result = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, RESET_REQUEST,
// Purging write buffers but RESET_PURGE_RX?
RESET_PURGE_RX, mPortNumber+1, null, 0, USB_WRITE_TIMEOUT_MILLIS);
if (result != 0) {
throw new IOException("Purge write buffer failed: result=" + result);
}
}
if (purgeReadBuffers) {
int result = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, RESET_REQUEST,
// Purging read buffers but RESET_PURGE_TX?
RESET_PURGE_TX, mPortNumber+1, null, 0, USB_WRITE_TIMEOUT_MILLIS);
if (result != 0) {
throw new IOException("Purge read buffer failed: result=" + result);
}
}
}
I have a quick question here that I haven't been able to find the answer to any where else.
To me, I find it odd that
RESET_PURGE_RX
is used for purging write buffers and thatRESET_PURGE_TX
is used for read buffers. Should it be the inverse or are the TX/RX lines flipped in Android?https://github.com/mik3y/usb-serial-for-android/blob/a9c835bcb07e6e49e346cc1bcd890fabac2161ba/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/FtdiSerialDriver.java#L367C1-L384C10