Jump to content
Flirc Forums

Fire TV guide button


John Wolf

Recommended Posts

For anyone that ends up on this thread, I figured it out.

While in the same directory as the flirc_util program, and your FLIRC plugged into your PC, issue this command:

(PC)

flirc_util.exe record_api 141 102

(MacOS/Linux)

./flirc_util record_api 141 102

It will then prompt you to press a key on the remote that you want to associate with the FireTV Guide button.

Link to comment
Share on other sites

  • 1 year later...

For anyone else that comes across this in the future, this does not work on the new Fire TV 4k Max, but it does work on every other firestick I have in my house including a regular firestick 4k.

I did capture a logcat from my firestick 4k max and this is what happens when I press the guide button on the new remote.

KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_LIVE_TV, scanCode=362, metaState=0, flags=0x8, repeatCount=0, eventTime=260873, downTime=260873, deviceId=7, source=0x301 }, keyCode: 297

I tried manually programing 297 with flirc_util record_api 0 297 and all it does is go home so I'm thinking there must be a modifier but no idea what to try.  Was thinking maybe the flags was it, but 8 297 does nothing at all.  Anyone have any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

I believe they use 172 (KEYCODE_GUIDE).  I've spent a lot time (more than I care to admit) on this and neither Logitech or Amazon seen to want to even bother.  The old sticks ignore the new code and the new sticks ignore the old code.  Looking through all the old forum posts I think it's an issue with not being able to send a keycode higher than 255 at the moment.

Link to comment
Share on other sites

Okay, here is how to figure it out.

Check out the Desktop Consumer Usage table Here: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf

Find Table 17

 image.png

Now, as an example, in this table, AC_BACK is used to go back. To record this manually using the commandline, do the following:

flirc_util record_api 0x2 0x223

image.png

The first argument is always going to be 0x2 for this table.

The answer is something in this table. 0x297 is save and close. That would be strange they used that, but we can try it with the following:

flirc_util record_api 0x2 0x297

Could it be decimal 297? Which would translate to hex code 0x129, but that's not in the table. So maybe they chose something that isn't listed to be safe?  Try that with:

flirc_util record_api 0x2 0x129

But if those don't do it, and I were to guess, I would think it would be something that kinda made sense. Maybe AC Catalog? 

That should help, let me know how that goes.

Link to comment
Share on other sites

I seem to have an issue with the windows version of flirc_util.  I get weird errors about a wrong version.  I'm not at the computer now, but I can copy and paste when I am.  Going to try the Linux version and see how that goes in the meantime.

 

And FYI, yes the 297 is decimal.  I've tried record_api with 2 129 and it hasn't worked to date, but I suppose that could also be caused by the issue above.  It records it as 0 (zero).

Link to comment
Share on other sites

No dice.  recorded it with the linux version and it still records it as 0.

09-10 09:39:14.822   457   639 D AmzPhoneWindowManager: interceptUnhandledKey: 0

Also, here's the message I get with the windows version:

C:\Program Files (x86)\Flirc>flirc_util.exe record_api 0x2 0x129
Consumer Usage Table: 0x129
[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'getversion'
hit a key on the remote to be paired with 0 0
[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'ir_state'
[E] lib/libflirc/firmware/fw_4.9.c fl_ver4_set_record_api(108): command error

When I tried to re-record it and forgot to erase first.  Interesting it says paired with 0 0.

vwmofo@DiscoPickle:/usr/bin$ ./flirc_util record_api 0x2 0x129
Consumer Usage Table: 0x129
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(377): Error: button already exists
hit a key on the remote to be paired with 0 0
 

Edited by vwmofo
Link to comment
Share on other sites

Did some more digging and and found this really cool raspberry pi project to turn a pi zero w into a bluetooth hub which pairs up as a bluetooth keyboard.  It works with the exception of the guide button (expected) and the home button (banghead). 

Anyhoo, I also installed the flirc utilities on the pi and attempted to record my keypress.  On the firestick it recognizes the button as "KEYECODE_LIVE_TV" with a scancode of 362 and keycode 297.

I used HID tools  to record the keypress.  Here's the results:

# ReportID: 2 /Consumer Devices ['0xc0129']
E: 000000.000000 3 02 29 01
 

So as you can see it did record the code correctly, but it still doesn't work.  My thinking is how the button is recognized in the consumer usage table.  Is it possible for you to include that scancode in the flirc firmware?

Link to comment
Share on other sites

So the plot thickens.  Was messing around with the Firestick and was able to capture the events coming straight from the remote and it sends the keycode 8D from the consumer table.  I tried that code for flirc previously and it doesn't do anything and even tried it again just in case it didn't record correctly.  So there's got to be some trickery going on with FireOS.  Might have to just smash the damned thing with a hammer and try a Chromecast with Google TV to see if that's any better. 

What kills me is I have an Nvidia shield which is vastly superior to the Firestick, but there's no good way to have OTA TV and a DVR like the Fire Recast.

 

 

 

Link to comment
Share on other sites

No worky...  BTW:  Thank you for trying to help me figure this thing out.  I have a feeling it's just never going to work.

This is from getevent on the firestick with the Flirc.

/dev/input/event1: 0004 0004 000c008d
/dev/input/event1: 0001 016a 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0004 0004 000c008d
/dev/input/event1: 0001 016a 00000000
/dev/input/event1: 0000 0000 00000000
 

Same from the Amazon Remote:

/dev/input/event2: 0004 0004 000c008d
/dev/input/event2: 0001 016a 00000001
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0004 0004 000c008d
/dev/input/event2: 0001 016a 00000000
/dev/input/event2: 0000 0000 00000000
 

They are identical.

Now, here's the logcat when I press the button on Flirc.

09-15 18:38:29.768   454   656 D AmzPhoneWindowManager: interceptUnhandledKey: 172

Where the heck did keycode 172 come from??

Banghead. 
 

Link to comment
Share on other sites

I actually have two ATSC HDHR's and I've tried getchannels. I'm working with a very low wife acceptance factor here and there were too many compromises with get channels.  We have Philo and several of the channels we watch do not have TV Everywhere equivalents which means you'd have to switch to the Philo app to watch them.  Plus IIRC the guide did not loop around back to the top when you got to the bottom.  I know, first world problems, but it's an issue for her which means it's an issue for me.  Plus I hate the subscription model for getchannels or any app for that matter.  The beauty of the Firestick is the interface is pretty much exactly the same as what we're both used to for live tv and combined with the fire tv recast it puts all our OTA channels and Philo channels in the same guide and there's no extra subscription.  It's absolutely killing me that the damned guide button on Amazon's new hardware is what's holding this up!  lol

That unhandled keycode is what AmzPhoneWindowManager is receiving from the button press, so there's some kind of trickery going on somewhere on the fire stick that's converting the correct keycode to it.  For example, if I program the numeric buttons into the remote, they show up in the logcat that exact way with the correct keycode.

pi@bthidhub:~ $ flirc_util settings

3.25.3
FW Version: v4.9.3
   SKU:     Flirc 2.0 [dori]
   Branch:  master
   Config:  release
   Hash:    0xCB185BDE

Settings:
  sleep detection:  always enabled
  noise canceler:   always enabled
  inter-key delay:  N/A for current firmware
  variant:          Flirc
  builtin profiles: NA
  Memory Info:      NA
  product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
    0  ED385097   108  01  up
    1  41787497   109  01  left
    2  7D14E297   109  01  down
    3  58C86297   109  01  right
    4  BF8F6297   109  01  enter
    5  5D7FE297   109  01  escape
    6  0059754B   130  01  E   <-- I have no idea where these came from
    7  9FFA6297   109  01  !  <-- 
    8  53DA6297   109  02  rewind
    9  BF6A7497   108  02  play/pause
   10  D1F15097   109  02  fast_forward
   11  72C1BA8B   090  01  E
   12  91C18697   108  04  browser_home
   13  1CD68697   108  02  0x8D
 

Link to comment
Share on other sites

Definitely something bizarre going on and unless Amazon fixes it, this is DOA.  I played around with adb and sendevent and got excited because I had something working using triggerhappy on the pi.  Until the fire remote disconnected and everything stopped working.

IF, and only if the amazon remote is connected, you can send the guide button press to /dev/input/<eventid of the fire remote> and it will work.  It does not work anywhere at all for any other input device.  So there's something hardcoded somewhere that only allows the guide press to come from the official remote.  Further, it doesn't even work if you pair up an older fire remote that doesn't have the guide button. Stupid. stupid, stupid.  This is clearly a bug, but it'll never get fixed.

Thanks again for all the help.  Guess it's time to find a different solution.

Link to comment
Share on other sites

  • 2 weeks later...

Well, if anyone cares.  I have a working solution for this that my wife is super happy with and also opens the possibility for way more control of these devices utilizing a harmony hub, Flirc USB, raspberry pi zero w, and the built in hotkey daemon triggerhappy.  In my case I needed the harmony hub to establish itself as a bluetooth keyboard with the firestick.  You could also use a generic USB keyboard receiver plugged into the firestick but I had an extra hub sitting around so that's what I used.  Flirc is connected to the Pi and it relays commands to the firestick via ADB using trigger happy.  It's *WAY* more complicated than it needs to be because these stupid streaming devices need better remotes.  There's not enough buttons on them, and I don't want to use my phone to control them because there's no tactile feedback (which is the same reason all of the touch screen remotes suck). 

So anyways for my issue, when you press guide on the harmony remote instead of controlling the firestick, it tells the pi to send the command adb shell input keyevent 297 which opens the guide on the firestick 4k max.  This does absolutely nothing on the older firesticks by the way (Amazon needs to get their crap together).  For my wife's IR remote, it also sends all the navigation commands via ADB as well using the sendevent shell command to whichever deviceid the harmony hub has identified itself as.  I used this method because sendevent is significantly faster than adb input.  You can also set up buttons to directly open apps with this!  Ie I used the unused numeric buttons to open things like Netflix, Prime Video, and Youtube.  There's lots of possibilities here that I stumbled across so at least that makes it more worthwhile.

If anyone's interested, I'm happy to share more details on the setup.

Edited by vwmofo
Link to comment
Share on other sites

  • 4 months later...

I just came across your post as I got a new Flirc to control my Android Box using IR and I'm having a tough time programming everything the way I want to. Your hub/pi setup is VERY interesting to me because I can see how it would take care of lots of issues and introduce consistency. I am hoping that this post will trigger your attention and you would be willing to share some background and details of your setup.  Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...