We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3438

Summary: SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries
Product: SDL Reporter: ny00
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: A patch adding out-of-bound logs

Description ny00 2016-10-02 14:14:51 UTC
Created attachment 2570 [details]
A patch adding out-of-bound logs

After fixing bug 3424, a patch is attached, adding a few logs. A message is reported whenever an SDL_JOYAXISMOTION or SDL_JOYBUTTON* event arrives and cannot be translated to a game controller event, due to the button/axis value being k_nMaxReverseEntries or greater.
Comment 1 Sam Lantinga 2016-10-08 01:25:27 UTC
Thanks! I switched it to SDL_SetError(), so programs don't output unexpected text
https://hg.libsdl.org/SDL/rev/f732781d7ddc
Comment 2 ny00 2016-10-08 13:56:33 UTC
Thanks for updating the repository!

I should first mention, that it looks like I've forgotten to add a similar function call for the hats.

Secondly, I thought that it makes more sense to output a message even while not under debug mode, as I believe is currently done with this function call from src/video/x11/SDL_x11events.c:

                fprintf(stderr,
                        "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n",
                        keycode, keycode - min_keycode, keysym,
                        X11_XKeysymToString(keysym));

I guess it is a bad idea to spam a lot of messages like this for a lot of events involving an out-of-bound joystick axis index.

Maybe functions like SDL_PrivateGameControllerParseButton should do the logging, instead? (It also uses SDL_SetError currently.)
Comment 3 Sam Lantinga 2017-08-11 20:52:30 UTC
I'm going to leave it as-is for now, thanks!