• The forum software that supports hummy.tv has been upgraded to XenForo 2.1!

    This upgrade brings a number of improvements including the ability to bookmark posts to come back to later. Please bear with us as we continue to tweak things and open a new thread for any questions, issues or suggestions in Site/Forum Issues.

[ir] webif screen keyboard control


New Member
I often use a laptop to control my humax via the WebIf (using the ir package).

For those who are not familiar please see the wiki page "WebIf_Remote_Controller" (I am not allowed to post a link)

I've found it very useful to extend this screen with keyboard shortcuts. For example I've mapped the laptop's cursor keys to the Humax "D pad" navigation buttons and find this quicker than using a mouse/ touchscreen. This works when the browser is showing the remote AND the browser has the keyboard input focus.

At the bottom of this post are the code additions. Maybe they could be considered for inclusion in the next package release if people are interested? If included then the screen itself should probably be changed to show the shortcuts.

Shortcut keys...

Cursor keysD pad movement
Shift + cursor up/ downP+ / P- (useful for fast navigation in the media list)

Shift + cursor left/ rightRew/ FF
Ctrl + cursor left/ rightskip back/ skip forw
bgo to bookmark
shift+badd bookmark

Colour buttons (4 adjacent keys) q, w, e, rred, green, yellow, blue

The code additions are in /mod/webif/plugin/ir/script.js and there are a few existing lines shown for context (near the top of that file)...

var signalarray = ['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR',
           'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE'];


// NEW CODE...
function sendK(cmd, xmit, e){
    send(encodeURIComponent(cmd), '#xmit' + xmit);

    // Handle cursor keys...
    if (e.keyCode==38) { sendK(e.shiftKey ? 'P+':'UP', 2, e); }
    else if (e.keyCode==40) { sendK(e.shiftKey ? 'P-':'DOWN', 2, e); }
    else if (e.keyCode==37) { // left
        if (e.shiftKey) sendK('REW',1,e);
        else if(e.ctrlKey) sendK('SKIP/BACK',1,e);
        else sendK('LEFT', 2, e);
    else if (e.keyCode==39) { // right
        if (e.shiftKey) sendK('FF',1,e);
        else if(e.ctrlKey) sendK('SKIP/FORW',1,e);
        else sendK('RIGHT', 2, e);
    // end cursor keys
    else if (e.keyCode==13) { sendK('OK', 2, e); }    // return
    else if (e.keyCode==32) { sendK('PAUSE', 1, e); } // space
    else if (e.keyCode==73) { sendK('INFO', 2, e); }  // i
    else if (e.keyCode==80) { sendK('PLAY', 1, e); }  // p
    else if (e.keyCode==27) { sendK(e.shiftKey ? 'EXIT' : 'BACK', 2,e); } // escape
    else if (e.keyCode==112) { sendK('MEDIA', 2, e); } // f1
    else if (e.keyCode==113) { sendK('GUIDE', 2, e); } // f2
    else if (e.keyCode==9) { sendK('OPT+', 2, e); }    // tab

    //  4 adjacent keys represent the colours...
    else if (e.keyCode==81) { sendK('RED', 1, e); }    // q
    else if (e.keyCode==87) { sendK('GREEN', 1, e); }  // w
    else if (e.keyCode==69) { sendK('YELLOW', 1, e); } // e
    else if (e.keyCode==82) { sendK('BLUE', 1, e); }   // r

    else if (e.keyCode==66) { sendK(e.shiftKey ? 'ADDBOOKMARK' : 'BOOKMARKS',2); } // b amd B

    //  number keys (not number pad)...
    else if (e.keyCode>=48 && e.keyCode<=57) { sendK(signalarray[e.keyCode-48], 1, e); }
    //  number pad numbers...
    else if (e.keyCode>=96 && e.keyCode<=105) { sendK(signalarray[e.keyCode-96], 1, e); }

function send(cmd, xmit, callback)


Well-Known Member
In addtion to this, would it be possible to make the command line ir utility case insensitive?
It's easier to type "ir mute" than "ir MUTE" but the former just generates a needless error.
It's just a simple case of replacing strcmp() with strcasecmp() and strncmp() with strncasecmp().


Well-Known Member
Both working well, thanks.
If I may suggest some additions to @Oatcake 's above list as well to fill in a few obvious gaps:
l - List
m - Mute
u - Menu
[ - Vol. down
] - Vol. up
s - Stop