PS4 controllers are now keyboards on Android
A very recent change has caused PS4 controllers to be seen as keyboards. I don't have any more information about this yet. It used to work.
This might be an OS change, FYI
This might be an OS change, FYI
I've considering that possibility, but my Android version didn't change and I'm suddenly getting a flood of feedback after an app update.
I'm bisecting now...
Also, the dpad produces no input in SDL, but it navigates the Android system as usual.
8824eac works, so it's absolutely an SDL problem.
6e6dc50 is the problem. Genuine gamepads are being blacklisted.
My PS4 controller on Android is called "Wireless Controller Touchpad", so it's being blacklisted because of the GAMEPAD_BLACKLIST_END triggering with the " Touchpad" string.
I took care of the touchpad issue. The others matches seem reasonable, please let me know if you're getting other false positives!
Thanks! I suspect there are more false positives out there, but it's impossible to get the right feedback from Android users, so I strip out this blacklisting logic because I have never seen a rogue gamepad. I have a Pixel 5 with a fingerprint scanner, which is supposed to be one of the rogue gamepads, but it's never been listed as one on my device. I think the LED keyword might be blacklisting some gamepads as well.
SDL_GetGamepadName() returns the proper "PS4 Controller" name. Would the blacklisting work better if it works on that instead of what's returned by SDL_GetJoystickName()?
Thanks! I suspect there are more false positives out there, but it's impossible to get the right feedback from Android users, so I strip out this blacklisting logic because I have never seen a rogue gamepad. I have a Pixel 5 with a fingerprint scanner, which is supposed to be one of the rogue gamepads, but it's never been listed as one on my device. I think the LED keyword might be blacklisting some gamepads as well.
Please don't strip out the blacklisting logic. We need to know if it's causing problems.
SDL_GetGamepadName()returns the proper "PS4 Controller" name. Would the blacklisting work better if it works on that instead of what's returned bySDL_GetJoystickName()?
That's a good point. If someone has added a mapping for a device, maybe they want to override the blacklisting logic?
The blacklisting logic is causing problems; I was flooded with bad feedback as soon as it was put into production, so I had to strip it out. I only know about PS4 gamepads because I had one to test.
Firebase could collect devices caught in the blacklist? I'm reluctant to add that and learn it though, but if there's no alternative, I'll look into it.
That would be appreciated, it would be great to know what we're running into. Can you log the name, vid and pid of the devices that are caught?
Here's a proposed patch to do more checking, but I'd like to see if it'll actually help before applying it:
diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c
index c4dce306d..d33dd2478 100644
--- a/src/joystick/SDL_gamepad.c
+++ b/src/joystick/SDL_gamepad.c
@@ -3240,28 +3240,38 @@ bool SDL_IsGamepad(SDL_JoystickID instance_id)
*/
bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{
- int i;
- for (i = 0; i < SDL_arraysize(SDL_gamepad_blacklist_words); i++) {
- const struct SDL_GamepadBlacklistWords *blacklist_word = &SDL_gamepad_blacklist_words[i];
+ bool check_blacklist = true;
- switch (blacklist_word->pos) {
- case GAMEPAD_BLACKLIST_BEGIN:
- if (SDL_startswith(name, blacklist_word->str)) {
- return true;
- }
- break;
+ // See if we recognize this controller
+ // Doing a full SDL_IsGamepad() style check can't be done with the information we have here,
+ // but let's do a quick check to see if it's one of the popular controller types
+ if (GuessControllerType(vendor_id, product_id) != k_eControllerType_UnknownNonSteamController) {
+ check_blacklist = false;
+ }
- case GAMEPAD_BLACKLIST_END:
- if (SDL_endswith(name, blacklist_word->str)) {
- return true;
- }
- break;
+ if (check_blacklist) {
+ for (int i = 0; i < SDL_arraysize(SDL_gamepad_blacklist_words); i++) {
+ const struct SDL_GamepadBlacklistWords *blacklist_word = &SDL_gamepad_blacklist_words[i];
- case GAMEPAD_BLACKLIST_ANYWHERE:
- if (SDL_strstr(name, blacklist_word->str) != NULL) {
- return true;
- }
- break;
+ switch (blacklist_word->pos) {
+ case GAMEPAD_BLACKLIST_BEGIN:
+ if (SDL_startswith(name, blacklist_word->str)) {
+ return true;
+ }
+ break;
+
+ case GAMEPAD_BLACKLIST_END:
+ if (SDL_endswith(name, blacklist_word->str)) {
+ return true;
+ }
+ break;
+
+ case GAMEPAD_BLACKLIST_ANYWHERE:
+ if (SDL_strstr(name, blacklist_word->str) != NULL) {
+ return true;
+ }
+ break;
+ }
}
}
@1bsyl Do you already have Firebase set up in any of your apps? Would save me a heap of work if you had a head start on this.
@AntTheAlchemist hey, sorry i havent firebase set up.