mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
Ensure we release exclusive USB access to controllers when backgrounded.
This commit is contained in:
parent
6249bac891
commit
501250e350
1 changed files with 10 additions and 0 deletions
|
|
@ -137,6 +137,7 @@ class HIDDeviceUSB implements HIDDevice {
|
|||
// back to the Android system gamepad functionality (and lose our paddles et al).
|
||||
if (mInputEndpoint == null) {
|
||||
Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName());
|
||||
mConnection.releaseInterface(iface);
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
|
@ -280,6 +281,15 @@ class HIDDeviceUSB implements HIDDevice {
|
|||
|
||||
@Override
|
||||
public void setFrozen(boolean frozen) {
|
||||
if (frozen != mFrozen && mConnection != null) {
|
||||
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
||||
if (frozen) {
|
||||
mConnection.releaseInterface(iface);
|
||||
}
|
||||
else {
|
||||
mConnection.claimInterface(iface, true);
|
||||
}
|
||||
}
|
||||
mFrozen = frozen;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue