From 0bb5b77328d738abfd06b838596187a566280669 Mon Sep 17 00:00:00 2001 From: gohai Date: Thu, 28 Jun 2018 15:31:39 -0700 Subject: [PATCH] IO: Add a 100ms timeout to I2C to allow communication with Arduino Note this currently does not include the compiled binary for linux-arm64 --- java/libraries/io/src/native/impl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/libraries/io/src/native/impl.c b/java/libraries/io/src/native/impl.c index 7d554bc27..522aa310f 100644 --- a/java/libraries/io/src/native/impl.c +++ b/java/libraries/io/src/native/impl.c @@ -323,6 +323,9 @@ JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferI2c packets.nmsgs++; } + // set the timeout to 100ms - this helps slow devices such as the + // Arduino Uno to keep up + ioctl(handle, I2C_TIMEOUT, 10); int ret = ioctl(handle, I2C_RDWR, &packets); if (ret < 0) { ret = -errno;