Merge branch 'root' of github.com:limelight-stream/limelight-android into root

This commit is contained in:
Cameron Gutman 2014-09-17 19:31:07 -07:00
commit 9d4ca6293f
2 changed files with 12 additions and 2 deletions

View File

@ -10,6 +10,7 @@ public class EvdevHandler {
private String absolutePath; private String absolutePath;
private EvdevListener listener; private EvdevListener listener;
private boolean shutdown = false; private boolean shutdown = false;
private int fd = -1;
private Thread handlerThread = new Thread() { private Thread handlerThread = new Thread() {
@Override @Override
@ -19,7 +20,7 @@ public class EvdevHandler {
// system-wide input problems. // system-wide input problems.
// Open the /dev/input/eventX file // Open the /dev/input/eventX file
int fd = EvdevReader.open(absolutePath); fd = EvdevReader.open(absolutePath);
if (fd == -1) { if (fd == -1) {
LimeLog.warning("Unable to open "+absolutePath); LimeLog.warning("Unable to open "+absolutePath);
return; return;
@ -130,7 +131,6 @@ public class EvdevHandler {
} }
} finally { } finally {
// Close the file // Close the file
LimeLog.warning("Evdev handler is terminating for: "+absolutePath);
EvdevReader.close(fd); EvdevReader.close(fd);
} }
} }
@ -146,6 +146,13 @@ public class EvdevHandler {
} }
public void stop() { public void stop() {
// Close the fd. It doesn't matter if this races
// with the handler thread. We'll close this out from
// under the thread to wake it up
if (fd != -1) {
EvdevReader.close(fd);
}
shutdown = true; shutdown = true;
handlerThread.interrupt(); handlerThread.interrupt();

View File

@ -67,6 +67,9 @@ public class EvdevWatcher {
// Rundown existing files // Rundown existing files
File devInputDir = new File(PATH); File devInputDir = new File(PATH);
File[] files = devInputDir.listFiles(); File[] files = devInputDir.listFiles();
if (files == null) {
return new File[0];
}
// Set desired permissions // Set desired permissions
String[] filePaths = new String[files.length]; String[] filePaths = new String[files.length];