I/O: Don't throw an exception when trying to release unused pins

This commit is contained in:
gohai
2015-10-12 00:05:34 +02:00
parent 61e68fb1e5
commit eb240c6192
@@ -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));
}
}
}