mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Don't double count USB attached Xbox One controllers
This commit is contained in:
parent
db5b7ab867
commit
7e21638811
@ -215,9 +215,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
if (PreferenceConfiguration.readPreferences(context).usbDriver) {
|
if (PreferenceConfiguration.readPreferences(context).usbDriver) {
|
||||||
UsbManager usbManager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
|
UsbManager usbManager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
|
||||||
for (UsbDevice dev : usbManager.getDeviceList().values()) {
|
for (UsbDevice dev : usbManager.getDeviceList().values()) {
|
||||||
// We explicitly ask not to claim devices that appear as InputDevices
|
// We explicitly check not to claim devices that appear as InputDevices
|
||||||
// otherwise we will double count them.
|
// otherwise we will double count them.
|
||||||
if (UsbDriverService.shouldClaimDevice(dev, false)) {
|
if (UsbDriverService.shouldClaimDevice(dev, false) &&
|
||||||
|
!UsbDriverService.isRecognizedInputDevice(dev)) {
|
||||||
LimeLog.info("Counting UsbDevice: "+dev.getDeviceName());
|
LimeLog.info("Counting UsbDevice: "+dev.getDeviceName());
|
||||||
mask |= 1 << count++;
|
mask |= 1 << count++;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ public class UsbDriverService extends Service implements UsbDriverListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isRecognizedInputDevice(UsbDevice device) {
|
public static boolean isRecognizedInputDevice(UsbDevice device) {
|
||||||
// On KitKat and later, we can determine if this VID and PID combo
|
// On KitKat and later, we can determine if this VID and PID combo
|
||||||
// matches an existing input device and defer to the built-in controller
|
// matches an existing input device and defer to the built-in controller
|
||||||
// support in that case. Prior to KitKat, we'll always return true to be safe.
|
// support in that case. Prior to KitKat, we'll always return true to be safe.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user