Skip to content

Commit 1af7dfb

Browse files
Nintorchslouken
authored andcommitted
Allow Android to ignore unnecessary joysticks
Previously, SDL_ShouldIgnoreJoystick wasn't being called for Android, and fingerprint sensors were recognized as joysticks.
1 parent 81920b5 commit 1af7dfb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/joystick/SDL_gamepad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2863,8 +2863,8 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
28632863
}
28642864
#endif
28652865

2866-
if (name && SDL_strcmp(name, "uinput-fpc") == 0) {
2867-
// The Google Pixel fingerprint sensor reports itself as a joystick
2866+
if (name && SDL_startswith(name, "uinput-")) {
2867+
// The Google Pixel fingerprint sensor, as well as other fingerprint sensors, reports itself as a joystick
28682868
return true;
28692869
}
28702870

src/joystick/android/SDL_sysjoystick.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
328328
goto done;
329329
}
330330

331+
if (SDL_ShouldIgnoreJoystick(vendor_id, product_id, 0, name)) {
332+
goto done;
333+
}
334+
331335
#ifdef DEBUG_JOYSTICK
332336
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
333337
#endif

0 commit comments

Comments
 (0)