Skip to content

Commit

Permalink
Workaround for errno being overwritten by JVM (Linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed Oct 23, 2022
1 parent 2e939fe commit 77801a4
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ public void transferOut(int endpointNumber, byte[] data, int timeout) {
int err = IO.getErrno();
if (err == errno.ETIMEDOUT())
throw new USBTimeoutException("Transfer out aborted due to timeout");
// TODO: remove below code if 'errno' is no longer overwritten by JVM
if (err == 2)
throw new USBTimeoutException("Transfer in aborted due to timeout");
throwException(err, "USB OUT transfer on endpoint %d failed", endpointNumber);
}
}
Expand All @@ -246,6 +249,9 @@ public byte[] transferIn(int endpointNumber, int timeout) {
int err = IO.getErrno();
if (err == errno.ETIMEDOUT())
throw new USBTimeoutException("Transfer in aborted due to timeout");
// TODO: remove below code if 'errno' is no longer overwritten by JVM
if (err == 2)
throw new USBTimeoutException("Transfer in aborted due to timeout");
throwException(err, "USB IN transfer on endpoint %d failed", endpointNumber);
}

Expand Down

0 comments on commit 77801a4

Please sign in to comment.