Skip to content

Commit 356e700

Browse files
committed
IO: Make I2C errors more verbose
The error code returned from C seems to have changed from -EIO to -EREMOTEIO during some recent kernel version.
1 parent 5ccb321 commit 356e700

File tree

1 file changed

+2
-2
lines changed
  • java/libraries/io/src/processing/io

1 file changed

+2
-2
lines changed

java/libraries/io/src/processing/io/I2C.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void endTransmission() {
125125
transmitting = false;
126126
out = null;
127127
if (ret < 0) {
128-
if (ret == -5) { // EIO
128+
if (ret == -5 | ret == -121) { // EIO | EREMOTEIO
129129
System.err.println("The device did not respond. Check the cabling and whether you are using the correct address.");
130130
}
131131
throw new RuntimeException(NativeInterface.getError(ret));
@@ -185,7 +185,7 @@ public byte[] read(int len) {
185185
transmitting = false;
186186
out = null;
187187
if (ret < 0) {
188-
if (ret == -5) { // EIO
188+
if (ret == -5 | ret == -121) { // EIO | EREMOTEIO
189189
System.err.println("The device did not respond. Check the cabling and whether you are using the correct address.");
190190
}
191191
throw new RuntimeException(NativeInterface.getError(ret));

0 commit comments

Comments
 (0)