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 -
    visudo
    

    
    ...
    ## 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
    groot/mdconfig/initmdconfig.sh,/usr/bink9copy,/usr/bin/wlassistant,/usr/share/my
    thdora/dboptimize.sh,/usr/share/mythdora/mythdbcheck.sh,/usr/share/mythdora/kill
    backend.sh,/sbin/service,/sbin/chkconfig,/sbin/reboot,/sbin/poweroff,/bin/mv,/us
    r/sbin/lircmd,/usr/bin/killall
    mythtv ALL=(ALL) NOPASSWD: MYTHDORA
    
    

  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
    BUTTON1_CLICK * OK
    

  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">
    <device>
    <match key="info.udi"
    string="/org/freedesktop/Hal/devices/usb_device_471_815_PH00WHBx_if0">
    <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>
    </match>
    </device>
    </deviceinfo>
    

    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
    ENABLE_LIRCMD=yes
    

  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/mythfrontend.sh
    

    
    ...
    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
    debugging=0
    if [ $debugging = 1 ]
    then
      echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
    fi
    
    
    #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: |