From eb240c61920e73c92d13f5e8e2fbe68c4509582c Mon Sep 17 00:00:00 2001 From: gohai Date: Mon, 12 Oct 2015 00:05:34 +0200 Subject: [PATCH] I/O: Don't throw an exception when trying to release unused pins --- java/libraries/io/src/processing/io/GPIO.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/libraries/io/src/processing/io/GPIO.java b/java/libraries/io/src/processing/io/GPIO.java index 12c0a843b..76893a9ea 100644 --- a/java/libraries/io/src/processing/io/GPIO.java +++ b/java/libraries/io/src/processing/io/GPIO.java @@ -492,8 +492,10 @@ public class GPIO { if (ret == -2) { // ENOENT System.err.println("Make sure your kernel is compiled with GPIO_SYSFS enabled"); } - // EINVAL is also returned when trying to unexport pins that weren't exported to begin with - throw new RuntimeException(NativeInterface.getError(ret)); + // EINVAL is returned when trying to unexport pins that weren't exported to begin with, ignore this case + if (ret != -22) { + throw new RuntimeException(NativeInterface.getError(ret)); + } } }