mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
More bugfixes for Evdev code. Enable ROOT_BUILD since it's the root branch.
This commit is contained in:
parent
364a9fa7d7
commit
bc166a713d
@ -45,7 +45,7 @@ Java_com_limelight_binding_input_evdev_EvdevReader_isMouse(JNIEnv *env, jobject
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_limelight_binding_input_evdev_EvdevReader_read(JNIEnv *env, jint fd, jbyteArray buffer) {
|
||||
Java_com_limelight_binding_input_evdev_EvdevReader_read(JNIEnv *env, jobject this, jint fd, jbyteArray buffer) {
|
||||
jint ret;
|
||||
jbyte *data = (*env)->GetByteArrayElements(env, buffer, NULL);
|
||||
if (data == NULL) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
package com.limelight;
|
||||
|
||||
public class LimelightBuildProps {
|
||||
public static final boolean ROOT_BUILD = false;
|
||||
public static final boolean ROOT_BUILD = true;
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ public class EvdevHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
LimeLog.info("Grabbed device for raw mouse input: "+absolutePath);
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocate(EvdevEvent.EVDEV_MAX_EVENT_SIZE);
|
||||
|
||||
try {
|
||||
|
@ -5,6 +5,10 @@ import java.nio.ByteBuffer;
|
||||
import com.limelight.LimeLog;
|
||||
|
||||
public class EvdevReader {
|
||||
static {
|
||||
System.loadLibrary("evdev_reader");
|
||||
}
|
||||
|
||||
// Requires root to chmod /dev/input/eventX
|
||||
public static native boolean setPermissions(String fileName, int octalPermissions);
|
||||
|
||||
|
@ -3,6 +3,8 @@ package com.limelight.binding.input.evdev;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.limelight.LimeLog;
|
||||
|
||||
import android.os.FileObserver;
|
||||
|
||||
public class EvdevWatcher {
|
||||
@ -16,6 +18,10 @@ public class EvdevWatcher {
|
||||
private FileObserver observer = new FileObserver(PATH, FileObserver.CREATE | FileObserver.DELETE) {
|
||||
@Override
|
||||
public void onEvent(int event, String fileName) {
|
||||
if (fileName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fileName.startsWith(REQUIRED_FILE_PREFIX)) {
|
||||
return;
|
||||
}
|
||||
@ -26,6 +32,8 @@ public class EvdevWatcher {
|
||||
}
|
||||
|
||||
if ((event & FileObserver.CREATE) != 0) {
|
||||
LimeLog.info("Starting evdev handler for "+fileName);
|
||||
|
||||
EvdevHandler handler = new EvdevHandler(PATH + "/" + fileName, listener);
|
||||
handler.start();
|
||||
|
||||
@ -33,6 +41,8 @@ public class EvdevWatcher {
|
||||
}
|
||||
|
||||
if ((event & FileObserver.DELETE) != 0) {
|
||||
LimeLog.info("Halting evdev handler for "+fileName);
|
||||
|
||||
EvdevHandler handler = handlers.get(fileName);
|
||||
if (handler != null) {
|
||||
handler.notifyDeleted();
|
||||
|
Loading…
x
Reference in New Issue
Block a user