mirror of https://github.com/encounter/SDL.git
HIDAPI is only reliable on Android 4.3 and newer
Fixes https://github.com/libsdl-org/SDL/issues/4955
This commit is contained in:
parent
d713a68071
commit
30f04d63e6
|
@ -1047,6 +1047,8 @@ int hid_init(void)
|
||||||
{
|
{
|
||||||
if ( !g_initialized )
|
if ( !g_initialized )
|
||||||
{
|
{
|
||||||
|
// HIDAPI doesn't work well with Android < 4.3
|
||||||
|
if (SDL_GetAndroidSDKVersion() >= 18) {
|
||||||
// Make sure thread is attached to JVM/env
|
// Make sure thread is attached to JVM/env
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
g_JVM->AttachCurrentThread( &env, NULL );
|
g_JVM->AttachCurrentThread( &env, NULL );
|
||||||
|
@ -1070,6 +1072,7 @@ int hid_init(void)
|
||||||
}
|
}
|
||||||
env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerInitialize, init_usb, init_bluetooth );
|
env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerInitialize, init_usb, init_bluetooth );
|
||||||
ExceptionCheck( env, NULL, "hid_init" );
|
ExceptionCheck( env, NULL, "hid_init" );
|
||||||
|
}
|
||||||
g_initialized = true; // Regardless of result, so it's only called once
|
g_initialized = true; // Regardless of result, so it's only called once
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue