mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-16 22:01:14 +00:00
Remove automatic detection logic for CONFIG_JOYSTICK_XPAD_LEDS=y
It doesn't work due to Android app sandboxing
This commit is contained in:
@@ -265,31 +265,19 @@ public class UsbDriverService extends Service implements UsbDriverListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We know we have a kernel that should set Xbox 360 wireless LEDs, but we still don't
|
// We know we have a kernel that should set Xbox 360 wireless LEDs, but we still don't
|
||||||
// know if CONFIG_JOYSTICK_XPAD_LEDS was enabled during the kernel build. To detect this,
|
// know if CONFIG_JOYSTICK_XPAD_LEDS was enabled during the kernel build. Unfortunately
|
||||||
// we will look for an xpad LED device. If we find even a single match here, that tells us
|
// it's not possible to detect this reliably due to Android's app sandboxing. Reading
|
||||||
// that CONFIG_JOYSTICK_XPAD_LEDS is enabled and we can assume (based on our version check
|
// /proc/config.gz and enumerating /sys/class/leds are both blocked by SELinux on any
|
||||||
// above) that the kernel will handle setting LEDs on the wireless controllers on its own.
|
// relatively modern device. We will assume that CONFIG_JOYSTICK_XPAD_LEDS=y on these
|
||||||
//
|
// kernels and users can override by using the settings option to claim all devices.
|
||||||
// NB: This will be inaccurate when called without any Xbox 360 or Xbox 360 wireless gamepad
|
return true;
|
||||||
// attached, but it will be correct when it matters (when we're actually checking a real
|
|
||||||
// matching device).
|
|
||||||
File systemDir = new File("/sys/class/leds");
|
|
||||||
File[] files = systemDir.listFiles();
|
|
||||||
if (files != null) {
|
|
||||||
for (File f : files) {
|
|
||||||
if (f.getName().startsWith("xpad")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldClaimDevice(UsbDevice device, boolean claimAllAvailable) {
|
public static boolean shouldClaimDevice(UsbDevice device, boolean claimAllAvailable) {
|
||||||
return ((!kernelSupportsXboxOne() || !isRecognizedInputDevice(device) || claimAllAvailable) && XboxOneController.canClaimDevice(device)) ||
|
return ((!kernelSupportsXboxOne() || !isRecognizedInputDevice(device) || claimAllAvailable) && XboxOneController.canClaimDevice(device)) ||
|
||||||
((!isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360Controller.canClaimDevice(device)) ||
|
((!isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360Controller.canClaimDevice(device)) ||
|
||||||
((!kernelSupportsXbox360W() || !isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360WirelessDongle.canClaimDevice(device));
|
// We must not call isRecognizedInputDevice() because wireless controllers don't share the same product ID as the dongle
|
||||||
|
((!kernelSupportsXbox360W() || claimAllAvailable) && Xbox360WirelessDongle.canClaimDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start() {
|
private void start() {
|
||||||
|
|||||||
Reference in New Issue
Block a user