Skip to content

Commit a0d5cd7

Browse files
committed
I/O: Improve messaging when user doesn't have permissions to write to LEDs
This is e.g. the case with the newly released Raspbian 2015-09-24.
1 parent 243b4a7 commit a0d5cd7

File tree

1 file changed

+4
-1
lines changed
  • java/libraries/io/src/processing/io

1 file changed

+4
-1
lines changed

java/libraries/io/src/processing/io/LED.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ public LED(String dev) {
8787
String fn = "/sys/class/leds/" + dev + "/trigger";
8888
int ret = NativeInterface.writeFile(fn, "none");
8989
if (ret < 0) {
90-
throw new RuntimeException(fn + ": " + NativeInterface.getError(ret));
90+
if (ret == -13) { // EACCES
91+
System.err.println("You might need to install a custom udev rule to allow regular users to modify /sys/class/leds/*.");
92+
}
93+
throw new RuntimeException(NativeInterface.getError(ret));
9194
}
9295
}
9396

0 commit comments

Comments
 (0)