Difference between revisions of "Template:RemoteControlSupport"

From LinuxTVWiki
Jump to navigation Jump to search
Line 1: Line 1:
 
=== Remote control support===
 
=== Remote control support===
  +
  +
==== Using evdev ====
  +
  +
As long as the evdev module is loaded, a remote that is recogniced as hid device will be treated as a usb keyboard and this means that you can avoid using lirc.
  +
  +
However, many of the keys on your remote may generate keycodes which are not mapped to anything, by default.
  +
  +
In X you can use xev to find the keycodes and xmodmap to map them to useful symbols.
  +
Unfortunately, some keys may generate keycodes that X doesn't recognize at all and the device does not support keymaps, or this would be easy to fix.
   
 
==== Using LIRC ====
 
==== Using LIRC ====
   
Usually remote controls in linux are managed by the lirc software.
+
Usually remote controls in linux are managed by the lirc software collection.
   
 
To get lirc up and running you need to configure some things.
 
To get lirc up and running you need to configure some things.
   
  +
* Settings for the hardware
* settings for device(where does lirc get its input from) and driver(what kind of input is it)
 
  +
** Where does lirc get its input from? aka. the '''DEVICE'''. E.g. <tt>/dev/input/event3</tt>
* settings for mapping driver output generated by your remote (a bunch of hex numbers) to key names (something like ''0''..''9'', ''Volume+'', ''Next'', ''Record'')
 
  +
** How to handle the input? aka. the '''DRIVER'''. E.g. <tt>devinput</tt>
* settings for mapping key presses to actions (usually located in your .lircrc)
 
  +
* Settings for mapping driver output generated by your remote (a bunch of hex numbers) to key names (something like ''0''..''9'', ''Volume+'', ''Next'', ''Record'')
  +
* Settings for mapping key presses to actions (usually located in your .lircrc)
   
 
===== Device/driver settings =====
 
===== Device/driver settings =====
Line 42: Line 53:
 
KERNEL=="input*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"
 
KERNEL=="input*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"
   
It has been mentionned that the following line works, instead of the above line (needs confirmation and deletion of the ugly line):
+
It has been mentioned that the following line works, instead of the above line (needs confirmation and deletion of the ugly line):
   
 
KERNEL=="event*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"
 
KERNEL=="event*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"
Line 48: Line 59:
 
This would make IR receivers handled by the usb_dvb framework always always be linked to '''<tt>/dev/input/dvb-ir</tt>'''.
 
This would make IR receivers handled by the usb_dvb framework always always be linked to '''<tt>/dev/input/dvb-ir</tt>'''.
   
But Linux systems runing recent udev will automatically create non-varying names, a nicer and automatic way of providing a stable input event name:
+
But Linux systems running recent udev will automatically create non-varying names, a nicer and automatic way of providing a stable input event name:
   
 
$ ls -la /dev/input/by-path/
 
$ ls -la /dev/input/by-path/

Revision as of 12:06, 24 April 2009

Remote control support

Using evdev

As long as the evdev module is loaded, a remote that is recogniced as hid device will be treated as a usb keyboard and this means that you can avoid using lirc.

However, many of the keys on your remote may generate keycodes which are not mapped to anything, by default.

In X you can use xev to find the keycodes and xmodmap to map them to useful symbols. Unfortunately, some keys may generate keycodes that X doesn't recognize at all and the device does not support keymaps, or this would be easy to fix.

Using LIRC

Usually remote controls in linux are managed by the lirc software collection.

To get lirc up and running you need to configure some things.

  • Settings for the hardware
    • Where does lirc get its input from? aka. the DEVICE. E.g. /dev/input/event3
    • How to handle the input? aka. the DRIVER. E.g. devinput
  • Settings for mapping driver output generated by your remote (a bunch of hex numbers) to key names (something like 0..9, Volume+, Next, Record)
  • Settings for mapping key presses to actions (usually located in your .lircrc)
Device/driver settings

Find the IR receiver's device by looking in the dmesg output for a line similar to:

input: IR-receiver inside an USB DVB receiver as /class/input/input4

Additionally, the IR receiver will be listed if you execute the command:

cat /proc/bus/input/devices

For example:

I: Bus=0003 Vendor=2040 Product=9950 Version=0100
N: Name="IR-receiver inside an USB DVB receiver"
P: Phys=usb-0000:07:01.2-1/ir0
S: Sysfs=/class/input/input4
U: Uniq=
H: Handlers=kbd event4 
B: EV=3
B: KEY=14afc336 284284d00000000 0 480058000 219040000801 9e96c000000000 90020000000ffd

In this example, the remote control gives output into /dev/input/event4.

The event number depends on your particular system and can vary.

Eventually this event number can even vary at every reboot.

You could create a new udev rule in /etc/udev/rules.d/65-persistent-hauppauge.rules.

KERNEL=="input*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"

It has been mentioned that the following line works, instead of the above line (needs confirmation and deletion of the ugly line):

KERNEL=="event*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", SYMLINK+="input/dvb-ir"

This would make IR receivers handled by the usb_dvb framework always always be linked to /dev/input/dvb-ir.

But Linux systems running recent udev will automatically create non-varying names, a nicer and automatic way of providing a stable input event name:

$ ls -la /dev/input/by-path/
total 0
drwxr-xr-x 2 root root 140 2008-02-07 20:31 .
drwxr-xr-x 4 root root 280 2008-02-07 20:31 ..
lrwxrwxrwx 1 root root   9 2008-02-07 20:31 pci-0000:00:1a.1-usb-0:2:1.0-event-kbd -> ../event1
lrwxrwxrwx 1 root root   9 2008-02-07 20:31 pci-0000:00:1a.1-usb-0:2:1.1-event-mouse -> ../event2
lrwxrwxrwx 1 root root   9 2008-02-07 20:31 pci-0000:00:1a.1-usb-0:2:1.1-mouse -> ../mouse1
lrwxrwxrwx 1 root root   9 2008-02-07 20:31 pci-4-1--event-ir -> ../event4
lrwxrwxrwx 1 root root   9 2008-02-07 20:31 platform-pcspkr-event-spkr -> ../event3

LIRC will use it without needing a special kernel module. use the dev/input (or devinput. Check this with the command "lircd --device=help".) driver and specify the input event device in /etc/lirc/hardware.conf

# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""

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

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="dev/input"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/input/by-path/pci-4-1--event-ir"
MODULES=""

# Default configuration files for your hardware if any
LIRCD_CONF="/etc/lirc/lircd.conf"
LIRCMD_CONF=""
Remote key setup

Depends on your remote. See device specific section below.

Sample .lircrc

A sample .lircrc can be found LircrcExample here.