Setting up IR remote for AVerTV Digi Volar X in Debian
AVerMedia AVerTV DVB-T Volar X (A815) is an Avermedia usb device able to capture DVB-T signals.
It provides an IR remote device, which we are going to set up in this post.
To properly configure the whole device see previous post
INSTALLING AND SETTING UP LIRC
LIRC stands for 'Linux Infra-red Remote Control'.
It provides the daemons and some utilities to support infra-red remote controls under Linux.
http://lirc.org
$ sudo aptitude install lirc
We investigate about IR devices present in our system:
$ cat /proc/bus/input/devices | grep -n10 a815
187-I: Bus=0003 Vendor=0000 Product=0000 Version=0004
188-N: Name="ACPI Virtual Keyboard Device"
189-P: Phys=
190-S: Sysfs=/devices/virtual/input/input19
191-U: Uniq=
192-H: Handlers=sysrq kbd event19 rfkill
193-B: PROP=0
194-B: EV=3
195-B: KEY=ffffffffffffffff ffffffffffffffff ffffffffffffffff fffffffffffffffe
196-
197:I: Bus=0003 Vendor=07ca Product=a815 Version=0200
198-N: Name="IR-receiver inside an USB DVB receiver"
199-P: Phys=usb-0000:00:1d.0-1.2.1/ir0
200-S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc2/input30
201-U: Uniq=
202-H: Handlers=kbd event20
203-B: PROP=0
204-B: EV=100013
205-B: KEY=148fc110 4a0201100000000 0 108000 2190c0004001 8e16c000000000 10000010000ffc
206-B: MSC=10
207-
208:I: Bus=0003 Vendor=07ca Product=a815 Version=0101
209-N: Name="AVerMedia A815"
210-P: Phys=usb-0000:00:1d.0-1.2.1/input1
211-S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1:1.1/input/input31
212-U: Uniq=301649101883000
213-H: Handlers=sysrq kbd event21
214-B: PROP=0
215-B: EV=120013
216-B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
217-B: MSC=10
218-B: LED=7
These lines are interesting for us:
198-N: Name="IR-receiver inside an USB DVB receiver"
202-H: Handlers=kbd event20
We edit /etc/lirc/hardware.conf file, to add DRIVER="devinput" and event20:
$ sudo nano /etc/lirc/hardware.conf
DRIVER="devinput" ... DEVICE="/dev/input/event20"
$ sudo service lirc restart
# We restart lirc daemon.LOAD RIGHT IR REMOTE MODEL
There are five (FP, HR, HV, JH, KS) IR remote types, each with a different table.
http://linuxtv.org/wiki/index.php/AVerMedia_AVerTV_Digi_Volar_X_(A815)
My avermedia IR remote shows: RM-KS
This is associated with number 5, so we create a file in /etc/modprobe.d directory:
# echo "options dvb_usb_af9015 remote=5" > /etc/modprobe.d/dvb.conf
and remove and load again the module:
$ sudo rmmod dvb_usb_af9015
$ sudo modprobe dvb_usb_af9015
TEST DEVICE ASSOCIATED WITH IR REMOTE
First we query which device is associated with our IR remote:
$ ls -l /dev/input/by-path/*-event-ir
lrwxrwxrwx 1 root root 10 feb 19 21:22 /dev/input/by-path/pci-0000:00:1d.0-usb-0:1.2.1-event-ir -> ../event20
So /dev/input/event20 is the dev file we need.
To test the IR device:
$ sudo aptitude install evtest
$ sudo evtest /dev/input/event20
Then we press keys in the remote and see if they appear in console.
Using evtest:
Event: time 1328836103.439535, type 1 (EV_KEY), code 356 (KEY_POWER2), value 1
Event: time 1328836103.439536, -------------- SYN_REPORT ------------
Event: time 1328836103.690654, type 1 (EV_KEY), code 356 (KEY_POWER2), value 0
Event: time 1328836307.694652, type 1 (EV_KEY), code 398 (KEY_RED), value 0
CONFIGURING LIRCD.CONF FILE
Next step is configuring lircd.conf file:
I download a sample lirc.conf file from here:
http://lircconfig.commandir.com/lircd.conf/?viewremote=1232
If you do not find any preconfigured lircd.conf file you could use irrecord command:
$ irrecord -H dev/input -f -d /dev/input/event20 ~/lircd.conf
http://www.lirc.org/html/configure.html
http://lirc.sourceforge.net/remotes/devinput/lircd.conf.devinput
An example of lircd.conf file improved with a few more keys:
$ sudo nano /etc/lirc/lircd.conf
begin remote name AVERTV bits 16 eps 30 aeps 100 one 0 0 zero 0 0 gap 455938 pre_data_bits 16 pre_data 0x8001 begin codes KEY_0 0x000B KEY_1 0x0002 KEY_2 0x0003 KEY_3 0x0004 KEY_4 0x0005 KEY_5 0x0006 KEY_6 0x0007 KEY_7 0x0008 KEY_8 0x0009 KEY_9 0x000A KEY_VOLUMEDOWN 0x0072 KEY_VOLUMEUP 0x0073 KEY_CHANNELDOWN 0x0193 KEY_CHANNELUP 0x0192 KEY_FORWARD 0x009F KEY_BACK 0x009E KEY_UP 0x00A7 KEY_DOWN 0x0080 KEY_POWER 0x0074 KEY_AUDIO 0x0188 KEY_EPG 0x016D KEY_MUTE 0x0071 KEY_ENTER 0x00CF KEY_BLUE 0x0069 KEY_CHANNEL 0x006A KEY_SWITCHVIDEOMODE 0x0174 KEY_EXIT 0x0094 KEY_POWER2 0x0164 KEY_RED 0x018E end codes end remote
$ sudo service lirc restart
To check if IR remote works OK:
$ irw # Show keys, when pressed in the remote.
0000000080010073 00 KEY_VOLUMEUP AVERTV
0000000080010073 00 KEY_VOLUMEUP AVERTV
0000000080010192 00 KEY_CHANNELUP AVERTV
CONFIGURING LIRC FOR MPLAYER
We are going to manage mplayer using our IR remote.
This command show us with a list of available mplayer commands.
$ mplayer -input cmdlist
Basicly we are going to associate each IR remote key with a mplayer command.
An example of $HOME/.lircrc file:
$ less $HOME/.lircr
begin button = KEY_VOLUMEUP prog = mplayer config = volume 1 repeat = 1 end begin button = KEY_VOLUMEDOWN prog = mplayer config = volume -1 repeat = 1 end begin button = KEY_ENTER prog = mplayer config = pause end begin button = KEY_FORWARD prog = mplayer config = seek +10 end begin button = KEY_UP prog = mplayer config = seek +60 end begin button = KEY_BACK prog = mplayer config = seek -10 end begin button = KEY_DOWN prog = mplayer config = seek -60 end begin button = KEY_CHANNELUP prog = mplayer config = seek +600 end begin button = KEY_CHANNELDOWN prog = mplayer config = seek -600 end begin button = KEY_SWITCHVIDEOMODE prog = mplayer config = vo_fullscreen end begin button = KEY_BLUE prog = mplayer config = osd end begin button = KEY_POWER2 prog = mplayer config = quit end
NEW UDEV RULE
It happens whenever the computer reboots, or when we unplug and plug again the usb device, IR remote device name changes.
We want each time to be associated with the same device name so we do not have to edit /etc/lirc/hardware.conf file again.
We investigate udev info database:
$ sudo udevadm info --export-db | less
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc0/input16/event16
N: input/event16
S: input/by-path/pci-0000:00:1d.0-usb-0:1.2.1-event-ir
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc0/input16/event16
E: MAJOR=13
E: MINOR=80
E: DEVNAME=/dev/input/event16
E: SUBSYSTEM=input
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_SERIAL=noserial
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.2.1
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_2_1
E: XKBMODEL=pc105
E: XKBLAYOUT=es
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1d.0-usb-0:1.2.1-event-ir
E: BACKSPACE=guess
This time /dev/input/event16 is the device we want. Let's query more info to create a new udev rule:
# udevadm info -a -p $(udevadm info -q path -n /dev/input/event16)
looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc0/input16/event16':
KERNEL=="event16"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc0/input16':
KERNELS=="input16"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="IR-receiver inside an USB DVB receiver"
ATTRS{phys}=="usb-0000:00:1d.0-1.2.1/ir0"
ATTRS{uniq}==""
ATTRS{properties}=="0"
...
We create a new udev rule:
$ less /etc/udev/rules.d/60-avermedia-ir-remote.rules
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="IR-receiver inside an USB DVB receiver", NAME="input/avermedia_ir_remote"
Edit /etc/lirc/hardware.conf
DEVICE="/dev/input/avermedia_ir_remote"
$ sudo udevadm control --reload-rules
$ sudo service lirc restart
Unplug and plug again the DVB device.
REFERENCE
http://linuxtv.org/wiki/index.php/AVerMedia_AVerTV_Digi_Volar_X_%28A815%29
http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers
http://en.gentoo-wiki.com/wiki/LIRC
0 comentarios:
Post a Comment