How to Remotely Control an Amazon Fire TV or Fire TV Stick via ADB

adb-signal-fire-tv-fire-tv-stick
While tweaking your Fire TV or Fire TV Stick, you may need a way to remotely control the device over the network via ADB. This is especially useful for the Fire TV Stick since there is no way to connect a USB peripheral. Blog reader Will found out the hard way that mistakenly disabling bluetooth on the Fire TV Stick essentiualy bricks the device since the remote control no longer works. This guide will help Will and others out of such a jam.

  1. First, you need to have ADB enabled on your device to follow this guide. If you have no way to control your device and didn’t already have ADB enabled, then I’m sorry but you’re out of luck. There is no way to remotely enable ADB.
  2. Connect to your Fire TV or Fire TV Stick via ADB.
  3. Here are the commands to simulate a remote button presses via ADB. Each command is equivalent to a single button press on the remote. It’s very tedious to navigate one command at a time with these commands, but it’s better than nothing if you’re left with no other way of controlling your Fire TV or Fire TV Stick.
    • UP
      adb shell input keyevent 19
    • DOWN
      adb shell input keyevent 20
    • LEFT
      adb shell input keyevent 21
    • RIGHT
      adb shell input keyevent 22
    • ENTER
      adb shell input keyevent 66
    • BACK
      adb shell input keyevent 4
    • HOME
      adb shell input keyevent 3
    • MENU
      adb shell input keyevent 1
    • MEDIA PLAY/PAUSE
      adb shell input keyevent 85
    • MEDIA PREVIOUS
      adb shell input keyevent 88
    • MEDIA NEXT
      adb shell input keyevent 87

ShareTweetShare+1

35 comments
  1. ponghclub says:

    You can download the wireless remode control app for fire tv stick to tablet. It work very well need practices.

    • ActionA says:

      Except the FireTV remote app doesn’t work for people who have blocked updates and remain on the initial software version in hopes that a root solution will come soon.

  2. rich says:

    My sony tv remote controls the fire stick tv, must be thru hdmi

    • Jorge says:

      Mine too, just found it out but pure casuality…but can’t control TV options. Have you found a button to switch what it is controlling? Would like to change audio or video settings for example…

  3. dlflannery says:

    Are there keyevent codes for the three video playback buttons on bottom row of the remote (start/stop, fast-forward, fast-reverse)?

  4. Tim says:

    Great info. Helped me to enable my bluetooth back after I accidentally disabled it.

  5. ravi says:

    very Useful post. The keycodes are really useful if ADB mode is enabled on the stick. Loaded settings.apk to test my bluetooth headset and playing around bluetooth. Accidentally turned off bluetooth. Bumm. i followed the keycode enabled bluetooth, however stick refused to recognize the remote. I ended up doing a factory reset via keycodes. Then it struck me that, i would have pressed and hold the home button for 10sec to enable remote. anyways i am happy my remote started working. Please ensure press and hold home button of the remote after enabling bluetooth. That should make the trick.
    Hope this is useful

  6. Tim says:

    Here are the keycodes for the media Buttons:

    Play/Pause 85
    Prev 88
    Next 87

    More can be found at http://developer.android.com/reference/android/view/KeyEvent.html

  7. Wilbert says:

    Help! Can anyone show me how to get into the above article’s step 3 to enable Fire TV stick bluetooth? Thanks

  8. TD says:

    Thanks for this post! It saved my Dumb Ass! I too accidentally, on purpose, turned off my bluetooth. I used MoboRobo to install the USB drivers for my AFTV stick and then it was a piece of cake with this tutorial. Thanks again!

  9. Mel says:

    Just wanted to thank everyone on this article accidentally turned of my Bluetooth whiles trying to connect my Bluetooth keyboard,and remote stopped working. thought that was it but u guys really helped.

    Key points: make sure you have ADB enabled on the fire stick/ tv and once you’ve done the keystrokes and enabled the Bluetooth press and hold the home button on the remote for 10 seconds so the device can be searched for and paired. :)

  10. Daniel Taylor says:

    Bless you, I screwed up too and thought I was a gonner, you are a STAR !!!! fixed

  11. Scott says:

    not working for me, I am in ADB shell and copying the commands but it not working keep getting error is not recognized as an internal or external command, operable program or batch file. please help

  12. jb says:

    I’m getting an error that there’s more than one device and emulator when I try to enter the “adb shell input keyevent 66” commands. What am I doing wrong?

    I’ve tried more than one computer and all have the same problem.

  13. James Ritchie says:

    good to know

    about to bring laptop in sight of Tv and write a script when I read that the stick supports HDMI-CEC, so as long as your TV supports it, you can use your TV remote to control the FireTV stick ! I just went from TV to TV until I found one and turned BT back on

  14. Linux_Freq says:

    Excellent How-To. Thank you, Thank you, Thank you. I accidentally turned of my Bluetooth whiles trying to connect my Bluetooth keyboard.

  15. Rosie says:

    can someone pleaseeee tell me how I put in commend codes via adbfire. I too have turned off my bluetooth :(

  16. Bill says:

    After connecting to the device with adbfire click on the “ADB Shell” button. This will open a command prompt on the fireTV stick. Cut and paste the commands (above) as needed to work your way down the menu to “settings”, over to “Applications” and so on until you are in the “settings” app within Manage Application Settings. Work your way down to Bluetooth and enable it. It took some time but worked like a charm for me. Now I just have to figure out how to deal with my original problem of installing a Bluetooth keyboard.

  17. Reyhan says:

    I keep getting “-bash: ADB: command not found” when I try the commands. I can’t figure out what I’m doing wrong. I put the command in “adb shell input keyevent 19” but I can’t get it to work.

  18. Julia says:

    I think I accidentally turned off Bluetooth!!! I lost my original remote to a “freak” accident lol! So I’ve been using the app on my phone. I dozed off with the screen open and woke up with my phone on searching for Fire tvs and can’t find mine and my screen has the remote block on it. Did I somehow manage to turn it off?

  19. Steve Green says:

    Hi all, I am a complete idiot when it comes to all this type of stuff, however I thought I would set those who have knowledge of these things a challenge.
    The issue is this…
    My brother is severely disabled and uses a giant (infra red) remote control to operate his audio/visual equipment.
    I bought him a firestick for Christmas expecting the remote functions to be able to be programmed into his giant remote control but as the firestick runs on Bluetooth it isn’t happening!

    The task is to find a compatable Bluetooth remote control with giant keys and is programmable, or an interface of sorts that will do the job.

    Note: I have tried the app on a large faced smart phone but his hand touches to many areas of the screen at the same time to allow him any control.

    If you think of Stephen Hawkings disability and range of movement it will give you an Idea of
    Lee’s restrictions. He can only use the knuckles on his left hand with minimum radial movement.

    I hope someone out there can come up with a work around.

    • mattman00000 says:

      A challenge indeed…

      1. Others have mentioned the fire stick can be controlled over HDMI by certain TVs. Depending on the TV and giant remote, that might work.
      2. If keyboard keys are big enough a bluetooth keyboard would work.
      3. Three StealthSwitch’s (http://stealthswitch.com/applications/stealthswitch3/) could be setup to function as a remote by being connected to a computer. Each input would be given a different keystroke to emulate, then something like AutoHotKey or GlovePIE could run the commands listed in this article when the corresponding keystroke happens. One could even perform all the remote’s functions (and more) with only their feet with such a setup. Downside is high latency as well as tying up a computer but if you have a spare this ought to be somewhat straightforward, or at least, more so than soldering unless you’re great at soldering.
      4. Another option would be desoldering the buttons from the fire tv remote and wiring up larger ones to form your own giant bluetooth remote.
      5. The right combination of Arduino (or other microcontroller) parts would substitute for a remote but that’s probably trickier than most solutions.

  20. JR says:

    I know this post is a bit old, but I found another usefull command:

    adb shell input keyevent 26 <– Power on/off

  21. steve says:

    Well done guys, even i panicked then and i am quite techy! Just a few points. When you get to Blutooth page havinbg switched back on make sure you scroll down and select the remote and enter. Mine worked straight away but guess you might have to hold home button down and would even try taking batteries out to see if re-initialises.

    I managed to pair my Logiteck mini keyboard at the same time which is what i was trying to do in the first place!

  22. Andy says:

    I managed to switch Bluetooth on using the fire stick remote on my iPhone 6

  23. David says:

    Excellent post! Save my beacon after switching off Bluetooth with the Setting app. This app enables bluetooth for other devices in the Controllers and Bluetooth devices menu.

  24. Wolfgang says:

    Excellent post for me too. I still have one question:
    Is there a possibility to switch between upper and lower case characters for the keyevents ‘A’ to ‘Z’ ?
    Eegards,
    Wolfgang

  25. Wolfgang G. says:

    Works great for my fire tv.
    But is there a possibility to switch between upper and lower case characters for the keyevents ā€˜Aā€™ to ā€˜Zā€™ ?
    Thanks,
    Wolfgang

  26. Joe says:

    I made a python script to map keyboard keys these navigation commands. It must be run from a windows machine in command line.

    # -*- coding: utf-8 -*-
    “””
    Created on Sun Jun 19 21:41:39 2016

    @author: JTC
    “””

    import os
    import msvcrt

    print “Android Debug Controler Started…”

    while(1):
    data_in = msvcrt.getch()

    if (data_in == “b”):
    os.system(“adb shell input keyevent 4”)
    print “Back”

    if (data_in == ” “):
    os.system(“adb shell input keyevent 66”)
    print “Enter”

    if(data_in == “a”):
    os.system(“adb shell input keyevent 21”)
    print “Left”

    if(data_in == “w”):
    os.system(“adb shell input keyevent 19”)
    print “Up”

    if(data_in == “z”):
    os.system(“adb shell input keyevent 20”)
    print “Down”

    if(data_in == “s”):
    os.system(“adb shell input keyevent 22”)
    print “Right”

  27. wolf says:

    100, “name”=>”CONNECT”, “value”=>0, “y”=>0, “x”=>1),
    array(“id”=>102, “name”=>”START-SERVER”, “value”=>0, “y”=>0, “x”=>0),

    array(“id”=>1, “name”=>”/\\”, “value”=>19, “y”=>2, “x”=>1),
    array(“id”=>2, “name”=>”21, “y”=>3, “x”=>0),
    array(“id”=>3, “name”=>”O”, “value”=>66, “y”=>3, “x”=>1),
    array(“id”=>4, “name”=>”>”, “value”=>22, “y”=>3, “x”=>2),
    array(“id”=>5, “name”=>”\\/”, “value”=>20, “y”=>4, “x”=>1),

    array(“id”=>6, “name”=>”BACK”, “value”=>04, “y”=>6, “x”=>0),
    array(“id”=>7, “name”=>”HOME”, “value”=>03, “y”=>6, “x”=>1),
    array(“id”=>8, “name”=>”MENU”, “value”=>01, “y”=>6, “x”=>2),

    array(“id”=>9, “name”=>”PREVIOUS”, “value”=>88, “y”=>7, “x”=>0),
    array(“id”=>10, “name”=>”PLAY/PAUSE”, “value”=>85, “y”=>7, “x”=>1),
    array(“id”=>11, “name”=>”NEXT”, “value”=>87, “y”=>7, “x”=>2),

    array(“id”=>101, “name”=>”DISCONNECT”, “value”=>0, “y”=>9, “x”=>1),
    array(“id”=>103, “name”=>”STOP-SERVER”, “value”=>0, “y”=>9, “x”=>2)
    );

    $user_command_id = “”;
    if (isset($_POST[‘u’])) {
    $user_command_id = key($_POST[‘u’]); // _debug($user_command_id);

    $user_command = 0;
    foreach ((array) $firetv_command as $key => $val) {
    if ( ($val[‘id’]==$user_command_id)) {
    $user_command = $key;
    }
    }
    _execute_command($firetv_command[$user_command], $ip);
    }

    ?>

    fireTV remote

    fireTV remote

    <?
    if ( $correct_password == FALSE) {
    echo "wrong password";
    exit(1);
    }

    echo "\n”;
    echo “\n”;
    echo “\n”;
    echo “fireTV ip: \n”;

    $output = shell_exec(“adb connect “.$ip); _debug($output);
    // if you want you can list all connected devices:
    // $output = shell_exec(“adb devices”); _debug($output);

    _show_grid($firetv_command); // I know I should use CSS here, but I am oldsk00l

    ?>

    <?

    function _execute_command (
    $command,
    $ip
    ) {
    // _debug($command);

    //http://php.net/manual/de/function.shell-exec.php

    switch ($command['id']) {
    case 100:
    $output = shell_exec("adb connect ".$ip);
    // _debug($output);
    break;
    case 101:
    $output = shell_exec("adb disconnect ".$ip);
    // _debug($output);
    break;
    case 102:
    $output = shell_exec("adb start-server");
    // _debug($output);
    break;
    case 103:
    $output = shell_exec("adb kill-server");
    // _debug($output);
    break;
    case ($command['id']<100):
    // _debug('normal: '.$command['name']);
    $output = shell_exec("adb connect ".$ip);
    $output = shell_exec("adb shell input keyevent ".$command['value']);
    // _debug($output);
    break;

    default:
    _debug('unknown command');
    break;

    } // switch
    return 0;
    }

    function _debug (
    $my_array
    ) {
    echo "\n”;
    print_r($my_array);
    echo “\n”;
    return 0;
    }

    function _show_grid (
    $my_array
    ) {
    $HEIGHT = 10;
    $WIDTH = 3;

    echo “\n”;

    for ($y=0; $y<$HEIGHT; $y++) {
    echo "\n”;
    for ($x=0; $x $val) {
    if ( ($val[‘y’]==$y) && ($val[‘x’]==$x)) {
    $value = “\n”;
    }
    }
    echo “”.$value.”\n”;
    } // for x
    echo “\n”;
    } // for y
    echo “\n”;
    return 0;
    }

    ?>

  28. wolf says:

    quick script to control your fireTV over php. enjoy.

    http://pastebin.com/FmRP6xAQ

Leave a Reply

Your email address will not be published. Required fields are marked *

*