Part 4 : Configure the remote control to move the mouse pointer

This page is part of a sequence of steps for creating a tv-true platform for viewing TV streaming websites on your television:

The lircmd daemon from LIRC provides a mechanism to move the mouse pointer using the arrow keys of the remote control, pressing Ok on the remote can be the same as a clicking the left mouse button. With the first press of the arrow key the pointer only moves a small amount but holding the same key down accelerates the mouse movement across the TV screen. This allows fine control to select smaller details on the web page (or flash player) whilst still being able to cover large distances on the screen with ease.

Linux HAL (Hardware Abstraction Layer) can be used to setup the infrared receiver as if it were a mouse, HAL is configured to send the signals to the lircmd daemon. The sequence of starting up and shutting down lircmd is critical:

  • lircmd needs to be running before system startup of HAL
  • lircmd cannot be running whilst MythTV is taking input otherwise the down arrow from the remote control will be interpreted as both "next menu item" (by MythTV) and "move mouse pointer down" (by lircmd)

  1. Make the mouse pointer bigger; select from the desktop menu bar "System" > "Preferences" > "Appearance" , press the "Customize..." button, select the Pointer tab then highlight Bluecurve-inverse and drag the Size slider upto Large

  2. The mythtv Unix user needs the ability to run "killall" and "lircmd" without entering the Unix root password (these commands will be needed in the next steps) Add ",/usr/sbin/lircmd,/usr/bin/killall" to end of MYTHDORA command alias.

    su -

    ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
    #includedir /etc/sudoers.d
    mdconfig ALL=(ALL) NOPASSWD:ALL
    Cmnd_Alias MYTHDORA = /usr/share/mythdora/dorabackup,/usr/share/mythdora/mdconfi

  3. create /etc/lirc/lircmd.conf (the lirc/ is new in lirc-0.8.5)

    su -
    nano /etc/lirc/lircmd.conf

    PROTOCOL IntelliMouse
    ACCELERATOR 2 30 5
    MOVE_N * Up
    MOVE_E * Right
    MOVE_S * Down
    MOVE_W * Left

  4. Create the HAL file to treat the USB infrared device as a mouse (make sure the <?xml is the first line of the .fdi file)

    su -
    cd /usr/share/hal/fdi/policy/
    mkdir 30user
    cd 30user
    nano 10-lirc_mouse.fdi

    <?xml version="1.0" encoding="UTF-8"?>
    <deviceinfo version="0.2">
    <match key="info.udi"
    <merge key="info.category" type="string">input</merge>
    <merge key="info.capabilities" type="strlist">input</merge>
    <append key="info.capabilities" type="strlist">input.mouse</append>
    <merge key="input.device" type="string">/var/run/lirc/lircm</merge>
    <merge key="linux.device_file" type="string">/var/run/lirc/lircm</merge>
    <merge key="linux.x11_options.Device" type="string">/var/run/lirc/lircm</merge>
    <merge key="input.x11_driver" type="string">mouse</merge>
    <merge key="input.x11_options.Protocol" type="string">IntelliMouse</merge>
    <merge key="input.x11_options.Buttons" type="string">5</merge>
    <merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
    <merge key="input.x11_options.SendCoreEvents" type="string">true</merge>

    If you are using a different infrared receiver the info.udi value may not be the same. Experiment using the "lshal" command with the device plugged in and not plugged in to determine the correct value.

  5. On reboot of the system the /var/log/Xorg.0.log will show an error (EE) that "/var/run/lirc/lircm" does not exist and that the infrared mouse capability has been removed.

    For the HAL to recognise the USB mouse the lircmd needs to be running before HAL. Edit /etc/sysconfig/lirc to start lircmd at boot time.

    su -
    nano /etc/sysconfig/lirc

    # this starts lircmd at boot

  6. now that lircmd starts at boot it will interfere with MythTV. So stop lircmd when MythTV starts and only enable it when needed (like when running firefox, next step)

    su -
    nano /usr/share/mythdora/

    sudo killall lircmd
    #Ultimately run the startmythdora function
    startmythdora $1

  7. Now only start lircmd when required i.e. before firefox starts and stop lircmd after firefox finishes (so that it does not interfere with Mythtv frontend. In the previous Part of these instructions you created a new firefox script, at the top of this script start lircmd and irxevent, and kill them after firefox exits. Note the removal of the "exec" before the launch of the browser


    nano ~/.mythtv/firefox_mythtv

    ## Usage:
    ## $ mozilla
    ## This script is meant to run a mozilla program from the mozilla
    ## rpm installation.
    ## The script will setup all the environment voodoo needed to make
    ## mozilla work.
    sudo lircmd
    irxevent &
    # Run the browser
    if [ $debugging = 1 ]
      echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
    #with exec the killall lircmd doesnt get executed
    #exec $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
    $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
    sudo killall lircmd
    killall irxevent

Now move onto the next part of the installation

Share this page: |