From 1af7dfb0a7cb75a682ec0c6eb8ed40ada818688e Mon Sep 17 00:00:00 2001 From: Nintorch <92302738+Nintorch@users.noreply.github.com> Date: Sat, 16 Aug 2025 21:55:03 +0500 Subject: [PATCH] Allow Android to ignore unnecessary joysticks Previously, SDL_ShouldIgnoreJoystick wasn't being called for Android, and fingerprint sensors were recognized as joysticks. --- src/joystick/SDL_gamepad.c | 4 ++-- src/joystick/android/SDL_sysjoystick.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index dca3cfcb91..6585447f15 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -2863,8 +2863,8 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version } #endif - if (name && SDL_strcmp(name, "uinput-fpc") == 0) { - // The Google Pixel fingerprint sensor reports itself as a joystick + if (name && SDL_startswith(name, "uinput-")) { + // The Google Pixel fingerprint sensor, as well as other fingerprint sensors, reports itself as a joystick return true; } diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 9a3402eb6a..e3693686eb 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -328,6 +328,10 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int goto done; } + if (SDL_ShouldIgnoreJoystick(vendor_id, product_id, 0, name)) { + goto done; + } + #ifdef DEBUG_JOYSTICK SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats); #endif