Introduction
I was just looking through some of my Dune's system files, just minding my own business when I came across this proc entry:
/proc/ir/button.
It looked interesting, but quick inspection using the cat program revealed that it doesn't return any text. I didn't think much of it at first, but then I tried to write to it using Echo commands. Curiously the echo commands did not throw any errors. So I tried to echo
IR NEC codes (in reverse*) to the file to see what happens. Eureka! It was just as if I was pressing the buttons on my remote control.
How to
First you need to enable Telnet or SSH access. Having a working knowledge of linux filesystems and shell commands is helpful but not strictly necessary. I'm a total idiot when it comes down to linux myself so don't let it hold you back.
(If you need help setting up access, I've already made a little tutorial in my other thread
here.)
The command that you need to use to emulate button presses is:
Code:
echo [ReverseNecCode] > /proc/ir/button
where [ReverseNecCode] is one of the codes listed on
this page, in reverse*.
*: Why in reverse? I'm glad you asked!
The CPU uses the little-endian byte order to store bytes into memory. This means that in any given numeric value, the 'smallest' byte (least significant byte) is the first one in the array, and the 'largest' byte (most significant byte) is the last.
Example
To emulate the MUTE button, first we need to get the NEC code from the list. After a quick look through the document, we found the following value: 00 BF 46 B9
Now we need to reverse the bytes. In our example, 'B9' is the least significant byte, so that one comes first in the sequence. 00 BF 46 B9 becomes B9 46 BF 00.
Add it all together, and you have the final command:
Code:
echo B946BF00 > /proc/ir/button
Et voilą. That's all there is to it.