diff --git a/OpenBCI_GUI/Extras.pde b/OpenBCI_GUI/Extras.pde index b6e50c341..c41cfb8a9 100644 --- a/OpenBCI_GUI/Extras.pde +++ b/OpenBCI_GUI/Extras.pde @@ -158,6 +158,34 @@ public boolean isElevationNeeded(String path) { } return result; } +/** +* Determines if user is in elevated group (plugdev). +* +* @return true if user is in group plugdev, false otherwise. + */ +public boolean isInElevatedGroup() { + boolean result = true; + if (isLinux()) { + try { + String command = "groups"; + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + InputStream stdIn = p.getInputStream(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stdIn)); + String[] values = bufferedReader.readLine().split(" "); + for (int idx=0; idx