Lircmd

From MythTV Official Wiki
Revision as of 12:10, 9 December 2012 by Stevegoodey (Talk | contribs)

Jump to: navigation, search

LIRCMD is the lirc mouse daemon. This can be used to use your ir remote as a mouse.

X11 config

First you have to know that to use ANY mouse in x11, you have to add it to your xorg.conf.

Add these lines to your xorg.conf:

Section "InputDevice"
         Identifier "Remote"
         Driver "mouse"
         Option "Protocol" "IntelliMouse"
         Option "SendCoreEvents"
         Option "Buttons" "5"
         Option "ZAxisMapping" "4 5"
EndSection

Driver

Next you have to load the correct driver to make it work. Add to the file /etc/modules the entry:

uinput

Create a new file /etc/udev/rules.d/55-uinput with one line:

KERNEL=="uinput", MODE="0666"

hardware.conf

Now you must tell lirc to start the mouse daemon and where the config file is. Edit your /etc/lirc/hardware.conf to have these settings:

START_LIRCMD="true"
LIRCMD_CONF="/etc/lirc/lircmd.conf"

Here is an example file:

# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="Packard Bell receiver"
REMOTE_MODULES="lirc_dev lirc_serial"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_SOCKET=""
REMOTE_LIRCD_CONF="packard_bell/lircd.conf.packard_bell"
REMOTE_LIRCD_ARGS=""

#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""

#Enable lircd
START_LIRCD="true"

#Don't start lircmd even if there seems to be a good config file
START_LIRCMD="true"

#Try to load appropriate kernel modules
LOAD_MODULES="true"

# Default configuration files for your hardware if any
LIRCMD_CONF="/etc/lirc/lircmd.conf"

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"

lircmd.conf

Create a new file /etc/lirc/lircmd.conf. You have to tell lirc which buttons will move the cursor what direction. use irw to determine your button names if you need. Also note the TOGGLE_ACTIVATE is the button you will push to turn on and off your mouse capabilities of your remote. You must push this button before the other buttons will command the cursor, and you must push it again for these buttons to have their regular usage.

# 
# lircmd config file
# 

PROTOCOL IntelliMouse

# ACCELERATOR start max multiplier

ACCELERATOR 2 30 5

TOGGLE_ACTIVATE * Go

MOVE_N  * 2
MOVE_NE * 3
MOVE_E  * 6
MOVE_SE * 9
MOVE_S  * 8
MOVE_SW * 7
MOVE_W  * 4
MOVE_NW * 1
MOVE_IN * CH+
MOVE_OUT * CH-

#BUTTON1_TOGGLE * 5
#BUTTON1_TOGGLE * RADIO
#BUTTON2_TOGGLE * VOL+
#BUTTON3_TOGGLE * SOURCE

BUTTON1_CLICK * 5
BUTTON1_CLICK * Asterix 
BUTTON3_CLICK * \#

# BUTTONx_CLICK, BUTTONx_UP, BUTTONx_DOWN are also possible

/etc/init.d/lirc

There is an issue with the init script in Ubuntu. There is no way to pass arguments to the lircmd daemon at start up. We need to start it with the --uinput flag. to do this you need to edit /etc/init.d/lirc. Note: line 194 added " -- -- uinput".

191                 if [ "$START_LIRCMD" = "true" ]; then
192                         [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
193                         log_daemon_msg "Starting remote control mouse daemon : LIRCMD "
194                         start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircmd -- -- uinput< /dev/null
195                         log_end_msg $?
196                 fi