[Fire TV Q&A, Help & Troubleshooting] glitchbit:
Update: If someone would like to compile this for me to run on Android 5.1 then I would appreciate it. I might be able to pull down the bytes the original controller is sending and convert that to what is needed faster than expected.

https://github.com/dhylands/ueventmon

One negative challenge will be that any time the firetv remote goes to sleep and comes back it's input position will be lost and will increment the number.. so it'll continually go up. A script of some kind will need to keep track of it... but we might also need to figure out if there is a way to prevent or keep the remote from going to sleep. If the firetv emits that to the controller then we need to figure out how to prevent that from occurring or how to stop the device from disappearing on the firetv side.

------------------------------------------

Reviving this thread. And while this is not my thread and I am not a moderator - please try to only respond if you are actually reading what it is that this person is asking!! Communicating and controlling a device over hdmi-cec is a very specific thing, if he or I wanted IR or solutions that don't actually work then we wouldn't be asking and trying to figure this out.

What I have figured out is that we need to figure out how to communicate to this path /sys/class/switch/cec_hdmi/uevents. It can accept input if we format it correctly.

See here https://android.developreference.com/article/12924728/HDMI+CEC+on+android

```

#turn on tv

echo 0x40 0x04 > /sys/class/cec/cmd

#change input source to HDMI 1

echo 0x4F 0x82 0x10 0x00 > /sys/class/cec/cmd

#change input source to HDMI 1

echo 0x4F 0x82 0x10 0x00 > /sys/class/cec/cmd

. dump_reg ( to read output of cec)

Use this site to check codes for other commands

```

https://github.com/sphinx02/AppStarter/issues/11

Also I am using a more stock rom.. no idea if lineage may already be using the more normal cec binary, if so then the info I posted may be directly applicable to you already.

---------- Post added at 08:24 AM ---------- Previous post was at 07:52 AM ----------

More info that I have found.

I sorta know how to do it.. but I need some help on figuring it out for good. Only Amazon's remotes have this feature, but we can bring it to 3rd party controllers if we fake it on rooted devices.. This is how one would FAKE it to make it happen.

And this is the key line on how I know this will work once we have the string formatted correctly to issue the volume up/down or power command.

09-28 04:14:33.940 I/Kernel (10080): [ 8744.952720].(2)[10080:sh]input input12: uevent: unknown action-strin

This is how you figure out which input device is your original firetv remote (no idea if this works with firetv remotes that don't really have a real volume button or not, I suspect as long as you have synced a volume and power capable controller once to your firetv the hdmi-cec service will be activated and it is not only tied to one controller type (outside of the keylayout definitions. This method I doubt will care though.)

Step 1) Figure out your input location

# ls /sys/class/input/
event0
event1
event2
event3
event4
event5
event6
event7
input0
input1
input12
input5
input6
input7
input8
input9

Ignore all of the event paths, but do check the name values by cat'ing them out.

example

# cat /sys/class/input/input12/name
Amazon Fire TV Remote

Now that you have that we need to figure out the properly formatted string or syntax to send into uevent of the controllers.

root@tank:/sys/class/input/input12 # echo 23 > ./uevent
root@tank:/sys/class/input/input12 # logcat -v time
--------- beginning of amazon_main
09-28 04:14:30.908 I/JmDNSImpl(10924): updateRecord() name=cc:44:63:b6:dd:01@fe80::ce44:63ff:feb6:dd01 typeSubType=_apple-mobdev2._tcp.local. op=Remove #listeners=0
--------- beginning of kernel
09-28 04:14:33.940 I/Kernel (10080): [ 8744.952720].(2)[10080:sh]input input12: uevent: unknown action-string
09-28 04:14:34.500 I/Kernel ( 0): [ 8745.509156]-(0)[0:swapper/0][printk_delayed:start]
09-28 04:14:34.500 I/Kernel ( 0): [ 8745.509189]-(0)[0:swapper/0][WDK], local_bit:0x8, cpu:0,RT[8745499176504]
09-28 04:14:34.500 I/Kernel ( 0): [ 8745.509189][WDK], local_bit:0x9, cpu:0, check bit0x:f,RT[8745499185966]
09-28 04:14:34.500 I/Kernel ( 0): [ 8745.509189][thread:60][RT:8745499193043] 2020-09-28 08:14:34.496154 UTC; android time 2020-09-28 03:14:34.496154