From 80453e84baeb5855d7f9f137516bcc32b3c61033 Mon Sep 17 00:00:00 2001 From: gohai Date: Tue, 10 Jul 2018 10:16:46 -0700 Subject: [PATCH] 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. --- java/libraries/io/src/processing/io/I2C.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/libraries/io/src/processing/io/I2C.java b/java/libraries/io/src/processing/io/I2C.java index 1d0bfac31..2e5dedb4e 100644 --- a/java/libraries/io/src/processing/io/I2C.java +++ b/java/libraries/io/src/processing/io/I2C.java @@ -125,7 +125,7 @@ public class I2C { transmitting = false; out = null; if (ret < 0) { - if (ret == -5) { // EIO + if (ret == -5 | ret == -121) { // EIO | EREMOTEIO System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); } throw new RuntimeException(NativeInterface.getError(ret)); @@ -185,7 +185,7 @@ public class I2C { transmitting = false; out = null; if (ret < 0) { - if (ret == -5) { // EIO + if (ret == -5 | ret == -121) { // EIO | EREMOTEIO System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); } throw new RuntimeException(NativeInterface.getError(ret));