Last night I found myself with the dire need of controlling my FireTV through USB. How did this happen ? Easy enough, I like to fiddle with my FireTV. One particular achievement I am usually thankful for has been being able to add bluetooth headphones support into my FireTV.

remote control bluetoothBut as you can read in that earlier tutorial, first I had to install  (by sideloading, just as it is done with XBMC apk) a settings.apk into my FireTV. This settings.apk comprised of the full settings menu found on fully fledged android devices.

Once installed, the Settings apk would allow me to access the standard bluetooth pairing options which comes as part of the Android operative System, thus being able to pair with my trusty bluetooth headphones.

Everything was dandy-Ok until yesterday I decided to try another Settings.apk, as part of my ongoing investigation about sound being not synchronized with video. So there I went, uninstalled old Settings.apk.

To make it short,  I was left with no bluetooth support: It seems that I did manage to make my FireTV to forget all the bluetooth peripherals, including the official Amazon´s Remote control.

Remote Control your FireTV through ADB

android developerBeing a seasoned Android developer, I did recall about being able to issue virtual keypresses through ADB into an Android device. You can send any key by issuing a keyevent command followed by the key code. The round pad that you use as direction keys also got a corresponding code.

So basically you connect your FireTV (either the first FireTV model or the more recent FireTV STICK) into your computer through USB or just issue an adb connect command into your FireTV IP address and type:

adb shell input keyevent X

You need to replace the X for the actual number code of the key event (keypress) you need to send into your FireTV. Keyevent 3 is like pressing the HOME button on your remote control.

Another interesting adb command, which may prove handy if you encounter a form which you need to fill up while accessing your FireTV through ADB, is the:

adb shell input "Hello"

… Which would type Hello inside the focused textbox. If you want a full phrase to be “auto typed” for you, you will need to replace each space on the text with “%s”, so if you want the texto “Hello here I am” inside the currently focused textbox, you would need to issue:

adb shell input "Hello%shere%sI%sam"

usb keyboard fireTVWell things got a bit complex, but then again, it proved to be the only way by which I could re-pair my remote control with my FireTV.

Hmm now I am wondering what would have happened if I used an USB keyboard plugged right into my FireTV.

Probably would have worked just fine with the arrow keys. I will try it and get back here with the results.

Anyway, I’ve read some reports about USB Keyboards not working with the lower cost FireTV Stick version, so there you go, all the investigation may be helpful for someone sometime 🙂

Full Key Event codes list for your FireTV

 1 --> "KEYCODE_MENU"
 2 --> "KEYCODE_SOFT_RIGHT"
 3 --> "KEYCODE_HOME"
 4 --> "KEYCODE_BACK"
 5 --> "KEYCODE_CALL"
 6 --> "KEYCODE_ENDCALL"
 7 --> "KEYCODE_0"
 8 --> "KEYCODE_1"
 9 --> "KEYCODE_2"
 10 --> "KEYCODE_3"
 11 --> "KEYCODE_4"
 12 --> "KEYCODE_5"
 13 --> "KEYCODE_6"
 14 --> "KEYCODE_7"
 15 --> "KEYCODE_8"
 16 --> "KEYCODE_9"
 17 --> "KEYCODE_STAR"
 18 --> "KEYCODE_POUND"
 19 --> "KEYCODE_DPAD_UP"
 20 --> "KEYCODE_DPAD_DOWN"
 21 --> "KEYCODE_DPAD_LEFT"
 22 --> "KEYCODE_DPAD_RIGHT"
 23 --> "KEYCODE_DPAD_CENTER"
 24 --> "KEYCODE_VOLUME_UP"
 25 --> "KEYCODE_VOLUME_DOWN"
 26 --> "KEYCODE_POWER"
 27 --> "KEYCODE_CAMERA"
 28 --> "KEYCODE_CLEAR"
 29 --> "KEYCODE_A"
 30 --> "KEYCODE_B"
 31 --> "KEYCODE_C"
 32 --> "KEYCODE_D"
 33 --> "KEYCODE_E"
 34 --> "KEYCODE_F"
 35 --> "KEYCODE_G"
 36 --> "KEYCODE_H"
 37 --> "KEYCODE_I"
 38 --> "KEYCODE_J"
 39 --> "KEYCODE_K"
 40 --> "KEYCODE_L"
 41 --> "KEYCODE_M"
 42 --> "KEYCODE_N"
 43 --> "KEYCODE_O"
 44 --> "KEYCODE_P"
 45 --> "KEYCODE_Q"
 46 --> "KEYCODE_R"
 47 --> "KEYCODE_S"
 48 --> "KEYCODE_T"
 49 --> "KEYCODE_U"
 50 --> "KEYCODE_V"
 51 --> "KEYCODE_W"
 52 --> "KEYCODE_X"
 53 --> "KEYCODE_Y"
 54 --> "KEYCODE_Z"
 55 --> "KEYCODE_COMMA"
 56 --> "KEYCODE_PERIOD"
 57 --> "KEYCODE_ALT_LEFT"
 58 --> "KEYCODE_ALT_RIGHT"
 59 --> "KEYCODE_SHIFT_LEFT"
 60 --> "KEYCODE_SHIFT_RIGHT"
 61 --> "KEYCODE_TAB"
 62 --> "KEYCODE_SPACE"
 63 --> "KEYCODE_SYM"
 64 --> "KEYCODE_EXPLORER"
 65 --> "KEYCODE_ENVELOPE"
 66 --> "KEYCODE_ENTER"
 67 --> "KEYCODE_DEL"
 68 --> "KEYCODE_GRAVE"
 69 --> "KEYCODE_MINUS"
 70 --> "KEYCODE_EQUALS"
 71 --> "KEYCODE_LEFT_BRACKET"
 72 --> "KEYCODE_RIGHT_BRACKET"
 73 --> "KEYCODE_BACKSLASH"
 74 --> "KEYCODE_SEMICOLON"
 75 --> "KEYCODE_APOSTROPHE"
 76 --> "KEYCODE_SLASH"
 77 --> "KEYCODE_AT"
 78 --> "KEYCODE_NUM"
 79 --> "KEYCODE_HEADSETHOOK"
 80 --> "KEYCODE_FOCUS"
 81 --> "KEYCODE_PLUS"
 82 --> "KEYCODE_MENU"
 83 --> "KEYCODE_NOTIFICATION"
 84 --> "KEYCODE_SEARCH"
 85 --> "TAG_LAST_KEYCODE"