[19. April 2013] A-400 Advanced Network Setup now available | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 [21 Jan. 2013] | A-200/A-210 [10 Aug. 2012]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
keypress - ir remote key emulation on command line
08-10-2009, 05:35 AM
Post: #1
keypress - ir remote key emulation on command line
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. Wink

Use an external SATA enclosure with the eGreat M34a | keypress - ir remote key emulation on command line
Find all posts by this user
[+] 2 users say Thank You to RaenonD for this post
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pure Web Remote Control or Listening Audio with switched off TV pompon 165 66,301 03-27-2013 08:05 PM
Last Post: luciano63
  NMT remote iPhone native app. racermonoid 390 125,401 03-06-2013 08:01 PM
Last Post: mindnever
  DropBear ssh client - key auth issue serek 0 2,777 12-28-2011 01:05 AM
Last Post: serek
  Remote shutdown Cadish 11 4,034 11-03-2011 01:13 PM
Last Post: alamakota
  X-100 Remote Codes Banjobeni 0 1,326 08-04-2011 10:13 PM
Last Post: Banjobeni
  is there an android remote control for the A110? jadeddog 2 2,736 06-04-2011 11:27 PM
Last Post: dw_bobby
  RAM v0.1 Remote Application Manager: more sebacool 2 3,026 03-08-2011 12:13 PM
Last Post: sopoyo
  Setting up Popcorn Hour to Logitec Harmony Remote collingwood 5 9,432 12-30-2010 08:54 AM
Last Post: halfelite
  music player daemon MPD & PCH Remote control beatnut88 19 9,945 12-22-2010 12:31 AM
Last Post: dooly
  Quick command? Angelkiller 0 879 11-06-2010 09:08 AM
Last Post: Angelkiller

Forum Jump: