LIRC - Linux Infrared Remote Control
Description: LIRC - Linux Infra-red Remote Control
Keywords: linux, kernel module, remote control, animax, multimedia

| # Linux input layer driver Usually you don't have to create a config file yourself if you use this driver as this generic config file should already contain all existing keys. This driver uses /dev/input/event0 as its input device per default. You should provide the correct device as --device parameter on the lircd and irrecord command line. Sometimes the input device mapping changes between system reboots. In that case you are also able to specify the correct input device by its name or physical location by preceding the desired value with name= or phys=. Shell wild-cards can be used for the given value but must be protected from the shell with proper quoting. For example you can use:
    --device=name='Budget-CI dvb ir *'
    --device=phys='pci*/ir0'
With the following script you can list all names associated with all existing Linux input devices.
    for i in /sys/class/input/input* ; do echo -n "$(basename "$i"): "; cat "$i/name"; done
This information also can be found in /proc/bus/input/devices. ## Conflict with HAL lircd requires exclusive access to the IR-receiver to work reliably. On some systems other processes may try to compete for access to the same device. In these cases lircd will send the following message to the system logs:
      lircd: can't get exclusive access to events coming from
             `<device-path>' interface
Another symptom is that the "irw" utility will fail to register keystrokes from the remote-control-device. A specific case of a potential conflict is on systems that implement the hardware abstraction layer (HAL) from freedesktop.org. This software is used on many Linux distributions and will take control of a variety of devices including all input devices. All IR-receivers which work through LIRC's devinput driver, i.e. has 'REMOTE_DRIVER="devinput"' in the configuration of LIRC, can potentially have events intercepted by the HAL-daemon (hald) unless hald is instructed to ignore the device. The following example illustrates how this conflict is resolved on a ubuntu-8.10 installation with a IR receiver on a Hauppauge HVR4000 TV-card: 1. The problem is confirmed by log entries (/var/log/daemon.log) and irw's behaviour as described above. "irw" in a xterm-window will appear to produce garbage characters which in fact are key-codes presented to the x-server through HAL. Some of the keys produce working x-events for left/right/up/down/enter and numbers, while others don't seem to work at all. 2. HAL comes with a utility, lshal, that lists the devices it knows about. The entry for this particular IR receiver reads:
    udi = '/org/freedesktop/Hal/devices/pci_14f1_8802_logicaldev_input'
      info.addons.singleton = {'hald-addon-input'} (string list)
      info.callouts.add = {'debian-setup-keyboard'} (string list)
      info.capabilities = {'input', 'input.keys', 'button'} (string list)
      info.category = 'input'  (string)
      info.parent = '/org/freedesktop/Hal/devices/pci_14f1_8802'  (string)
      info.product = 'cx88 IR (Hauppauge WinTV-HVR400'  (string)
      info.subsystem = 'input'  (string)
      info.udi = '/org/freedesktop/Hal/devices/pci_14f1_8802_logicaldev_input'  (string)
      input.device = '/dev/input/event7'  (string)
      input.originating_device = '/org/freedesktop/Hal/devices/pci_14f1_8802'  (string)
      input.product = 'cx88 IR (Hauppauge WinTV-HVR400'  (string)
      input.x11_driver = 'evdev'  (string)
      input.xkb.layout = 'no'  (string)
      input.xkb.model = 'pc105'  (string)
      input.xkb.options = 'lv3:ralt_switch'  (string)
      input.xkb.rules = 'evdev'  (string)
      linux.device_file = '/dev/input/event7'  (string)
      linux.hotplug_type = 2  (0x2)  (int)
      linux.subsystem = 'input'  (string)
      linux.sysfs_path = '/sys/class/input/input7/event7'  (string)
In short this explains that the device that LIRC was complaining about in the log (/dev/input/event7) is controlled by hald, and already prepared as an input-device for the system's X-server. 3. The info.product string will work as a unique identifier and can be used to create a file containing the following XML-formatted rule to make hald ignore the IR-receiver:
    = = = cut here = = =
    <?xml version="1.0" encoding="UTF-8"?>
    <deviceinfo version="0.2">
    <device>
     <match key="info.product" contains_ncase="cx88 ir">
        <merge key="info.ignore" type="bool">true</merge>
     </match>
    </device>
    </deviceinfo>
    = = = cut here = = =
The rule does a non-case-sensitive search for devices that has "cx88 ir" in its info.product attribute and places an instruction to ignore it. Put this in a file called 10-ignore-cx88-ir.fdi. The location of rules for HAL and further explanation of technical details is found in it's documentation. The example system (ubuntu-8.10) needs this file in the /usr/share/hal/fdi/preprobe/20thirdparty/ directory. 4. HAL and LIRC can now be restarted (or reboot the system). Then LIRC will get exclusive access to the IR receiver, "irw" will display IR-events as expected, and the following output from "lshal" confirms that it now ignores the IR device:
    udi = '/org/freedesktop/Hal/devices/temp/112'
      info.ignore = true  (bool)
      info.parent = '/org/freedesktop/Hal/devices/pci_14f1_8802'  (string)
      info.product = 'Ignored Device'  (string)
      info.subsystem = 'input'  (string)
      info.udi = '/org/freedesktop/Hal/devices/ignored-device'  (string)
      input.device = '/dev/input/event7'  (string)
      input.originating_device = '/org/freedesktop/Hal/devices/pci_14f1_8802'  (string)
      input.product = 'cx88 IR (Hauppauge WinTV-HVR400'  (string)
      linux.device_file = '/dev/input/event7'  (string)
      linux.hotplug_type = 2  (0x2)  (int)
      linux.subsystem = 'input'  (string)
      linux.sysfs_path = '/sys/class/input/input7/event7'  (string)
[LIRC homepage] The LIRC Manual, last update: 10-June-2014 |