Amazon Fire TV Stick buttons

How can I read the navigation buttons on the Amazon Fire TV Stick 2 remote (the left, right, up, down and select buttons)? They don’t, as I had hoped, seem to map to the regular SDLK_LEFT etc. scan codes. I’ve seen a comment on another site that they appear as gamepad pushbuttons, but if so what is the mapping?

Richard.

I’ve now got it going to my satisfaction, but only by patching the SDL source which I’m never keen on.

The underlying problem seems to be that SDL expects a SOURCE_DPAD button event to be converted to an SDL_JoyButtonEvent, but that only works if the ‘joystick’ has been opened; otherwise the event is discarded. How is one to know which ‘joystick’ to open anyway?

In my opinion the button event shouldn’t be discarded in that case but rather a SDL_KeyboardEvent should be generated instead (there is a mapping for the DPAD buttons to scancodes in SDL_androidkeyboard.c so it looks as though this was anticipated). Other buttons on the remote generate keyboard events as standard.

To achieve this state of affairs I’ve had to edit both sdlActivity.java and SDL_sysjoystick.c.

Richard.

Thanks for your effort and tips Richard.

I don’t know whether I should be reporting this as a ‘bug’, in which case I could post patches, or whether my expectations differ from what the SDL designers intended.

If my modifications work properly (and I haven’t had a chance to test them with a real gamepad) they should have no effect if the ‘joystick’ is opened: in that case a DPAD button press should map to a SDL_JoyButtonEvent as before. It’s only when a button press would previously have been discarded that my alteration maps it to a SDL_KeyboardEvent.

Richard.