mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 21:17:45 +00:00
Fixed UnsatisfiedLinkError when initializing the HIDDeviceManager in some cases
This commit is contained in:
@@ -80,6 +80,14 @@ public class HIDDeviceManager {
|
|||||||
public HIDDeviceManager(Context context) {
|
public HIDDeviceManager(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
|
// Make sure we have the HIDAPI library loaded with the native functions
|
||||||
|
try {
|
||||||
|
System.loadLibrary("hidapi");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Couldn't load hidapi: " + e.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HIDDeviceRegisterCallback(this);
|
HIDDeviceRegisterCallback(this);
|
||||||
|
|
||||||
mSharedPreferences = mContext.getSharedPreferences("hidapi", Context.MODE_PRIVATE);
|
mSharedPreferences = mContext.getSharedPreferences("hidapi", Context.MODE_PRIVATE);
|
||||||
@@ -180,7 +188,11 @@ public class HIDDeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void shutdownUSB() {
|
protected void shutdownUSB() {
|
||||||
mContext.unregisterReceiver(mUsbBroadcast);
|
try {
|
||||||
|
mContext.unregisterReceiver(mUsbBroadcast);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// We may not have registered, that's okay
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isHIDDeviceUSB(UsbDevice usbDevice) {
|
protected boolean isHIDDeviceUSB(UsbDevice usbDevice) {
|
||||||
|
|||||||
Reference in New Issue
Block a user