This wiki page lists most of the ir codes available for the popcorn hour, so that you can control the device from telnet. This is all well and good, but somehow, I don't remember hexidecimal keycodes all that well.
So, I wrote a script to remember it for me, and saved it as /share/bin/keypress
Code:
#!/bin/sh
# Script to emulate keypresses of Popcorn Hour (tm) IR remote control from command line using human-readable arguments
ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
ARGS="help"
fi
for ARG in $@ $ARGS
do
case $ARG in
play)
echo $((0xE9)) > /tmp/irkey
;;
pause)
echo $((0xEA)) > /tmp/irkey
;;
stop)
echo $((0x1B)) > /tmp/irkey
;;
ok)
echo $((0x0D)) > /tmp/irkey
;;
up)
echo $((0xA8)) > /tmp/irkey
;;
down)
echo $((0xA9)) > /tmp/irkey
;;
left)
echo $((0xAA)) > /tmp/irkey
;;
right)
echo $((0xAB)) > /tmp/irkey
;;
back)
echo $((0x8D)) > /tmp/irkey
;;
menu)
echo $((0x09)) > /tmp/irkey
;;
home)
echo $((0xD0)) > /tmp/irkey
;;
rwd)
echo $((0xD5)) > /tmp/irkey
;;
fwd)
echo $((0xD6)) > /tmp/irkey
;;
prev)
echo $((0xDB)) > /tmp/irkey
;;
next)
echo $((0xDC)) > /tmp/irkey
;;
sub)
echo $((0xEB)) > /tmp/irkey
;;
audio)
echo $((0xD8)) > /tmp/irkey
;;
info)
echo $((0x95)) > /tmp/irkey
;;
source)
echo $((0xDD)) > /tmp/irkey
;;
power)
echo $((0xD2)) > /tmp/irkey
;;
red)
echo $((0xDE)) > /tmp/irkey
;;
green)
echo $((0xDF)) > /tmp/irkey
;;
yellow)
echo $((0xE0)) > /tmp/irkey
;;
blue)
echo $((0xE2)) > /tmp/irkey
;;
del)
echo $((0x08)) > /tmp/irkey
;;
caps)
echo $((0xFC)) > /tmp/irkey
;;
time)
echo $((0x91)) > /tmp/irkey
;;
zoom)
echo $((0xDA)) > /tmp/irkey
;;
repeat)
echo $((0x90)) > /tmp/irkey
;;
angle)
echo $((0xEC)) > /tmp/irkey
;;
tvmode)
echo $((0x8F)) > /tmp/irkey
;;
eject)
echo $((0xEF)) > /tmp/irkey
;;
volup)
echo $((0x9E)) > /tmp/irkey
;;
voldn)
echo $((0x9F)) > /tmp/irkey
;;
mute)
echo $((0xE1)) > /tmp/irkey
;;
setup)
echo $((0x8C)) > /tmp/irkey
;;
0)
echo $((0xF1)) > /tmp/irkey
;;
1)
echo $((0xF2)) > /tmp/irkey
;;
2)
echo $((0xF3)) > /tmp/irkey
;;
3)
echo $((0xF4)) > /tmp/irkey
;;
4)
echo $((0xF5)) > /tmp/irkey
;;
5)
echo $((0xF6)) > /tmp/irkey
;;
6)
echo $((0xF7)) > /tmp/irkey
;;
7)
echo $((0xF8)) > /tmp/irkey
;;
8)
echo $((0xF9)) > /tmp/irkey
;;
9)
echo $((0xFA)) > /tmp/irkey
;;
*)
echo "usage: $0 <command>"
cat <<EOF
Acceptable commands should include all keys
available on the popcorn hour (tm) IR remote.
| play | pause | stop | ok | up | down | left |
| right | back | menu | home | rwd | fwd | prev |
| next | sub | audio | info | source| power | red |
| green | yellow| blue | del | caps | time | zoom |
| repeat| angle | tvmode| eject | volup | voldn | mute |
| setup | ...and the numbers 0-9
EOF
ERROR=2
;;
esac
done
exit $ERROR
Upload the file to /share/bin, then "chmod +x /share/bin/keypress" to make it executable, and suddenly, you can type out your commands in clear, human-readable text (with only a small amount of abbreviation).
Code:
# keypress
usage: /share/bin/keypress <command>
Acceptable commands should include all keys
available on the Popcorn Hour (tm) IR remote.
| play | pause | stop | ok | up | down | left |
| right | back | menu | home | rwd | fwd | prev |
| next | sub | audio | info | source| power | red |
| green | yellow| blue | del | caps | time | zoom |
| repeat| angle | tvmode| eject | volup | voldn | mute |
| setup | ...and the numbers 0-9
# keypress home
# keypress right
I tried to keep the script simple to update or modify, and plan to write a partner script for some of the more advanced features listed on the wiki page, and perhaps a few more.