RPi2: Support for Fire TV Stick remote (Bluetooth)

I do not know, whether it is a feature request or a bug report - feel free to move the topic to whatever category seems to fit best…

While the Fire TV remote seems to work out of box on a Raspberry Pi2 running OSMC, the Fire TV Stick remote doesn’t (see Bluetooth Amazon FireTV Stick Remote for details).

They are two different remotes :
1949:0401 (FireTV Remote)
1949:0404 (FireTV Stick Remote)

Currently, it needs the following workaround to get the Fire TV Stick remote working on OSMC:

/etc/eventlircd.d/aftvsremote.evmap:

KEY_KPENTER      = KEY_OK
KEY_UP           = KEY_UP
KEY_LEFT         = KEY_LEFT
KEY_RIGHT        = KEY_RIGHT
KEY_DOWN         = KEY_DOWN
KEY_MENU         = KEY_EPG
KEY_BACK         = KEY_EXIT
KEY_PLAYPAUSE    = KEY_PLAY
KEY_REWIND       = KEY_REWIND
KEY_HOMEPAGE     = KEY_MEDIA
KEY_FASTFORWARD  = KEY_FASTFORWARD

/etc/udev/rules.d/99-eventlircd.rules:

SUBSYSTEMS=="bluetooth", GOTO="begin-bluetooth"
GOTO="end-bluetooth"
LABEL="begin-bluetooth"

ATTRS{name}=="Amazon Fire TV Remote", \
  ENV{eventlircd_enable}="true", \
  ENV{eventlircd_evmap}="aftvsremote.evmap"

LABEL="end-bluetooth"

Support out of box would be nice, since the Fire TV Stick remote works excellent for Kodi and costs only 15 bucks…

Thanks, I’ve taken a note of this and will try to get a chance to look at it. Do you happen to know how the normal FireTV remote is supported ? Are there already eventlircd/udev rules for it or does it work without them ? (Does it get detected as some other device ?)

I don’t have access to either remote for testing so I’m naturally a bit weary of fiddling around with udev rules that I can’t test properly as it’s very easy to break things with mistakes in udev rules.

I am already working on this, including adding PS3 remote support too

Sam

@b711

Could you test this for me please ?

http://paste.osmc.io/raw/piwolibide

Download this (wget directly to osmc recommended) and use it to replace /lib/udev/rules.d/98-eventlircd.rules (back up the original first)

Also place your aftvsremote.evmap file in /etc/eventlircd.d/

I’ve changed it to match on vendor and device id (I’m uncomfortable about using a name match) and incorporated it into our existing eventlircd .rules file rather than as a separate file.

If you can confirm this works I will add this in for our next update. Thanks.

Do you also have a standard firetv remote that you could test to confirm that still works ?

Many thanks for following up. I have both a Fire TV remote and a Fire TV Stick remote and will do your tests later today - as soon as those remotes are no longer needed by the rest of my family…

Thanks. Can you try both remotes and also compare the button mapping to see that they are the same ?

Is the physical design and number of buttons for the fire tv remote and fire tv stick remote the same ? If so we may want to configure things so both have the exact same button mappings so we may want to add a udev rule to match the normal fire tv remote as well.

Sorry to disappoint you, but the Fire TV Stick remote does not work with the updated 98-eventlircd.rule - at least not at first try. I’ll give it a second try later (and the Fire TV remote as well) and will post the results.

The buttons of the remotes are the same (exempt the mic button):

Thanks for all your efforts.

Did you reboot after editing the file ?

If it’s still not working can you try changing the vendor id / device id match line back to your original name match to see if that’s the problem ?

Also make sure you don’t have your 99-eventlircd.rules file in /etc/udev/rules.d/ while you are testing this one.

I commented out the vendor ID and used the name instead and the Amazon Fire TV Stick remote WORKS:
#ENV{ID_VENDOR_ID}=="1949", ENV{ID_MODEL_ID}=="0404", \ ATTRS{name}=="Amazon Fire TV Remote", \

Is this of any help? How can I check or get the VENDOR_ID or MODEL_ID to support your efforts?

Thanks for that.

As it happens, I should have a Fire TV Stick of my own (for other reasons) next week, so when I have it I will do some testing first hand to work out the best way to add support in time for the next update.

Have you already received your Fire TV Stick and found the time to test the remote? I am really interested in your results…

I’ve only just received the Fire TV stick today, so I’m hoping to have a chance to test the remote on OSMC by the weekend.

Just make sure you have a second remote (Android or iDevice-App e.g.) paired with the Fire TV Stick before you pair the remote to OSMC - otherwise you won’t be able to re-pair the remote with Fire TV Stick again (or only via factory reset I think)

I’m sure dbmandrake will be fine

S

Hi Sam,

I’m sure as well. I just wanted to contribute at least something - there’s not much more I can do for you talented guys…

I’ve had a bit of a play with it, and I’m not sure about some of the button mappings you’ve provided, here is what makes better sense to me: (I’m still tweaking it though)

KEY_KPENTER      = KEY_OK
KEY_UP           = KEY_UP
KEY_LEFT         = KEY_LEFT
KEY_RIGHT        = KEY_RIGHT
KEY_DOWN         = KEY_DOWN
KEY_MENU         = KEY_TITLE
KEY_BACK         = KEY_BACK
KEY_PLAYPAUSE    = KEY_PLAY
KEY_REWIND       = KEY_REWIND
KEY_HOMEPAGE     = KEY_HOME
KEY_FASTFORWARD  = KEY_FASTFORWARD

Mapping the back button to exit, menu key to EPG and Homepage to Media as in the original doesn’t really make sense to me.

What may work the best is if we configure the mappings to be the same as they are on Kodi on an actual Fire TV (albeit you can’t use the Home button on a Fire TV so that is an extra button) then for improved functionality the user can install one of the same keymap.xml files that works with the fire TV from here:

http://kodi.wiki/view/Alternative_keymaps_for_Fire_TV_remote

For example on my Fire TV stick Kodi install I’m using keymap4.xml with a slight fix to make smallstepback work properly, and this changes the function of some of the buttons in different parts of Kodi - something which you can’t do in an evmap.

Do you happen to know whether Plain Fire TV remote also reports itself as “Amazon Fire TV Remote” as the name attribute ? You can check that by running the following just before turning on Bluetooth with it already paired:

sudo udevadm monitor -p >udev.log

Then turn on bluetooth and press a button on the remote until it is working, then press CTRL C to end the capture and upload the log file:

paste-log udev.log

What I’m wondering is whether we should really be configuring both fire tv remote variants with the same key mappings, which means adding an eventlircd evmap for that as well, or sharing the same one if possible. Unfortuantely I don’t have that version of the remote to test with.

It’s unclear to me how or why the standard Fire TV remote works without any udev rules (at least I can’t see any) unless it matches some sort of generic rule.

Only ENV{eventlircd_enable}=“true”, \ is needed to make the remote work, (which tells eventlircd to handle it) the evmap line is only needed to change some of the mappings slightly.

Edit: made a slight change to the mapping for the Home key.

I’ve added initial support for the Fire TV Stick remote in this commit:

There is still time to do some tweaking if necessary before the next update comes out but I’m happy with it at the moment. I tried to match on vendor and product ID but it seems that that information is not being exported correctly up the udev chain (the information is missing on the udev event that we need to match on - there is only a name attribute available) which suggests a broken/missing udev rule elsewhere - I spent some time on this and couldn’t get to the bottom of it so rather than wasting more time on that I’m OK with matching on the name for now.

It’s unclear what effect this might have on a full Amazon Fire TV remote if they both report the exact same name - could you try my version of the changes in the commit above and see how it behaves with both versions of the remote (fire tv and fire tv stick) and whether you get the same button mappings ?

You can run the irw command via ssh then press buttons to see what key codes the buttons map to.

How do you pair the Amazon Fire Remote to OSMC?

Activate Bluetooth over OSMC settings menu, Start/Stop search for devices and press the home button of the Fire TV remote for 5 to 10 seconds

1 Like

@DBMandrake: Many thanks for your efforts! Your commit seems to work, the Fire TV Stick remote can be used. I have not been able to test the plain Fire TV remote, but I will do so… However, speaking about keymaps I figured out some problems: I tried Keymap 3 from Kodi, according to which the “back”-button during FullScreenPlayback should stop the movie, instead it opens the menu and the movie plays in the background. The context menu button still shows codec info and does not toggle subtitles. I used the same keymap on the Fire TV Stick and it works just as it is supposed to. Does your alternative keymap 4 work for you with OSMC? Maybe the fault is somewhere in my setup, I placed the keymap in /home/osmc/.kodi/userdata/keymaps/keyboard.xml and according to Kodi’s log it was also found and read…