Customized Remote Control Keys

From MythTV Official Wiki
Revision as of 09:14, 13 November 2006 by YLee (Talk | contribs)

Jump to: navigation, search

Remote Control Keys

Remote Control Keys- hints, tips etc

Tips, Hints, and customised keys for remote controls

This page documents remote control tips, hints, and customised remote control keys. These are generally applicable to all remote control setups. For setup steps and customisations specific to a particular type of remote control see ???

Customised keys

Restart Mythtv key

Give the mythtv user permission to restart mythtv via sudo. Edit /etc/sudoers and add the following line:

mythtv    ALL=NOPASSWD: /etc/init.d/mythbackend

If you are running mythtv as a different user you will change mythtv to the user name you are using.

This sets up sudo so that user mythtv can do "sudo /etc/init.d/mythbackend restart".

Add something like this to the lircrc file in your ~/.mythtv directory (or is it the .lircrc file in your home directory for irexec?) e.g. if user fred runs mythtv on your system this would be /home/fred/.mythtv/lircrc:

# Power Off/Exit
prog = irexec
button = OFF
config = /usr/local/bin/my_myth_restart

Put the following script into /usr/local/bin/my_myth_restart


sudo /etc/init.d/mythbackend restart

Then make it executable with chmod a+x /usr/local/bin/my_myth_restart

From PaulPick in the mythtv mailing list.

Configuring the power button to do DPMS sleep/unsleep

DPMS is useful for avoiding burned-in screen. Most people do not want to use DPMS or screensavers because you need to press a key on the keyboard or move the mouse to wake up the screen once DPMS activates. This is painful if a remote control is normally used to control Mythtv. If you configure the power button on the remote to toggle DPMS on or off then you can avoid burned-in screens.

LIRC can be configured to wake up the Mythtv display from DPMS screen blanking. This is done using a script via irexec. The same button can also be used to make the display go to sleep.

First edit the ~/.lircrc file to include the following stanza. A good Howto and MCE .lircrc file for Fedora Core 4 or 5 you can find here [1]:

    prog = irexec
    button = Power
    repeat = 3
    config = /usr/local/bin/
    #config = Key Alt-Escape CurrentWindow

Note that irexec must be running to make this all work. This can be done via the script, detailed in the main HOWTO Jarod Wilson has written [2], but could be different for other linux distributions such as Debian or SUSE or Ubuntu.

Create a shell script in /usr/local/bin/, called[3]

STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'`

if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
    if [ $STATUS -eq 0 ]
        ( $PROG & )

        if [ -a /tmp/mythpowerbutton-off ]
                touch /tmp/mythpowerbutton-on;
                touch /tmp/mythpowerbutton-off;
                sleep 3;
                if [ -a /tmp/mythpowerbutton-on ]
                    rm -rf /tmp/mythpowerbutton-o* && killall $PROG
                rm -rf /tmp/mythpowerbutton-o*
        rm -rf /tmp/mythpowerbutton-o*
exit 0

Make the script executable:

chmod a+x /usr/local/bin/

If there are any other sections in the ~/.lircrc file that are associated with the POWER button, then they should be removed or you may see multiple things happen at once.

Now when the Power button on the remote is pressed, the screen should blank (DPMS on) and with one more press the Mythtv GUI should reappear (DPMS off).