It is possible to use the Kernel Event Interface standalone for the remote receiver of ivtv cards. If you rather want to use Lirc, have a look at LircDevInput instead.
Finding the device
You need to load the ir-kbd-i2c module and the input-utils package need to be installed. After that you can check with lsinput, if the receiver is known to the kernel and which event number it has. In my case it has the number 4.
/dev/input/event4 bustype : BUS_I2C vendor : 0x0 product : 0x0 version : 0 name : "i2c IR (Hauppauge)" phys : "i2c-2/2-0018/ir0" bits ev : EV_SYN EV_KEY EV_REP
Dealing with udev
If you are using udev, this number might change on a later reboot. Thus we create a symlink with a unique name to this device. Moreover we set the group of that device to video, so that a user without superuser privileges can access the device (this is not important if you run freevo as root).
- We need some infos about the device, that we can use to write an udev rule
udevinfo --query=all --attribute-walk --name=input/event4
This is the output for my PVR-350:
looking at device '/devices/virtual/input/input4/event4': KERNEL=="event4" SUBSYSTEM=="input" DRIVER=="" ATTR{dev}=="13:68" looking at parent device '/devices/virtual/input/input4': KERNELS=="input4" SUBSYSTEMS=="input" DRIVERS=="" ATTRS{name}=="i2c IR _Hauppauge_" ATTRS{phys}=="i2c-2/2-0018/ir0" ATTRS{uniq}=="" ATTRS{modalias}=="input:b0018v0000p0000e0000-e0,1,14,k71,72,73,74,78,79,7A,7B,80,84,8B,8E,A3,A4,A5,A7,A8,CF,D0,E0,E1,F0,162,16B,170,192,193,ramlsfw"
From this I created the following rule in /etc/udev/rules.d/50-videoremote.rules (see also http://reactivated.net/writing_udev_rules.html)
KERNEL=="event[0-9]*", SUBSYSTEM=="input", ATTR{dev}=="13:68", SYMLINK+="input/videoremote", GROUP="video", MODE="0660"
After that you have to restart the udev daemon, for the rule to take effect. Now there should be a device file called /dev/input/videoremote, that is a symlink to the event device that belongs to the hauppauge receiver.
Create the event map
Run input-event 4 as root to test the events that are send by your remote. If all buttons give good events, you are lucky, but probably you will find, that the events that are seen by the kernel are not the right ones and that there are buttons that are unknown. Thus you need to create an appropriate event map for your remote. For this watch /var/log/messages while you are running input-event 4 and pressing buttons. There you will find a code for each pressed button. With this codes you can create a keymap file /etc/videoremote.keys and load it with input-kdb -f /etc/videoremote.keys (see man input-kdb for more details). Example keymap files:
After you have created a keymap file, loaded it and tested it, you need to make sure that this keymap is loaded after every boot. You can use the following init script for that (source: http://www.vdr-wiki.de/wiki/index.php/Debian_pvr350_remote).
#### # # set keycodes for every key on pvr-remote # ################# PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin INPUT_NR=$(ls -l /dev/input/videoremote |awk '{print $11 }' |sed 's#[^0-9]\+##') [ -n "$INPUT_NR" ] && { log_action_msg "Loading keymap for the remote" input-kbd -f /etc/videoremote.keys $INPUT_NR >/dev/null 2>&1 }
Configure Freevo
Last but not least, put the following in your local_conf.py
USE_SDL_KEYBOARD = 0 EVENT_DEVS = [ '/dev/input/videoremote' ]
The SDL-Keyboard must be disabled, because otherwise it might be that you get duplicated events. Moreover you must tell freevo, how to map the events from the remote to its internal events. This might look like this:
EVENTMAP['KEY_POWER'] = 'POWER' EVENTMAP['KEY_GOTO']='DISPLAY' EVENTMAP['KEY_TV'] = 'TV' EVENTMAP['KEY_VIDEO'] = 'VIDEO' EVENTMAP['KEY_AUDIO'] = 'AUDIO' EVENTMAP['KEY_SCREEN'] = 'PICTURES' EVENTMAP['KEY_EPG'] = 'GUIDE' EVENTMAP['KEY_ESC'] = 'EXIT' EVENTMAP['KEY_MENU'] = 'ENTER' EVENTMAP['KEY_ENTER'] = 'SELECT' EVENTMAP['KEY_RED'] = 'RED' EVENTMAP['KEY_GREEN'] = 'GREEN' EVENTMAP['KEY_YELLOW'] = 'YELLOW' EVENTMAP['KEY_BLUE'] = 'BLUE' EVENTMAP['KEY_REWIND']='REW' EVENTMAP['KEY_FASTFORWARD'] ='FFWD' EVENTMAP['KEY_RECORD']='REC' EVENTMAP['KEY_NEXTSONG']='NEXT' EVENTMAP['KEY_PREVIOUSSONG']='PREV' EVENTMAP['KEY_LANGUAGE']='LANG' EVENTMAP['KEY_SUBTITLE']='SUBTITLE'