Sunday, 26 February 2012

Installing and setting AVerTV Digi Volar X in Debian

AVerMedia AVerTV DVB-T Volar X (A815) is an Avermedia usb device capable to capture and show DVB-T TV signals.
This device is able to also show HDTV DVB-T signals.

http://linuxtv.org/wiki/index.php/Afatech_AF9015


LINUX KERNEL DRIVER

The device contains an Afatech AF9015 Chip.
Supported in kernel since version 2.6.28.

NOTE: If you have an older kernel version you will have to compile the kernel module:
Compile AF9015 module tutorial.
AF9015 Kernel Module Source.


IMPORTANT: Although AF9015 module is already available in the kernel, it NEEDS ADDITIONAL FIRMWARE INSTALLED to work.


DETECTING THE DEVICE

I plug the usb device:

$ lsusb
... ID 07ca:a815 AVerMedia Technologies, Inc. AVerTV DVB-T Volar X (A815)


Kernel log shows:
$ dmesg

usb 2-1.2.1: new high speed USB device number 11 using ehci_hcd
usb 2-1.2.1: New USB device found, idVendor=07ca, idProduct=a815
usb 2-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.2.1: Product: A815
usb 2-1.2.1: Manufacturer: AVerMedia
usb 2-1.2.1: SerialNumber: 301649101883000
input: AVerMedia A815 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1:1.1/input/input22
generic-usb 0003:07CA:A815.0005: input,hidraw2: USB HID v1.01 Keyboard [AVerMedia A815] on usb-0000:00:1d.0-1.2.1/input1
IR NEC protocol handler initialized
IR RC5(x) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
lirc_dev: IR Remote Control driver registered, major 250
IR LIRC bridge handler initialized
dvb-usb: found a 'AVerMedia AVerTV DVB-T Volar X' in cold state, will try to load a firmware
dvb-usb: did not find the firmware file. (dvb-usb-af9015.fw) Please see linux/Documentation/dvb/ for more details on firmware-problems. (-2)
dvb_usb_af9015: probe of 2-1.2.1:1.0 failed with error -2
usbcore: registered new interface driver dvb_usb_af9015


We observe it detects the usb device. It also tries to initialize the IR remote, but in the end it does not find a suitable firmware.


INSTALLING FIRMWARE

We need the file: dvb-usb-af9015.fw

Available from this URL:
http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/

Right now (2012-02-25) this firmware file is still not available in non-free section of Debian:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=534379

We download the firmware file:
$ wget http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/4.95.0/dvb-usb-af9015.fw

Copy firmware into /lib/firmware:
$ sudo cp dvb-usb-af9015.fw /lib/firmware/


CHECKING IF FIRMWARE WAS SUCCESSFULLY INSTALLED

Unplug and plug again the device.
Let's check if firmware was successfully installed:

$ dmesg

usb 2-1.2.1: new high speed USB device number 17 using ehci_hcd
usb 2-1.2.1: New USB device found, idVendor=07ca, idProduct=a815
usb 2-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.2.1: Product: A815
usb 2-1.2.1: Manufacturer: AVerMedia
usb 2-1.2.1: SerialNumber: 301649101883000
dvb-usb: found a 'AVerMedia AVerTV DVB-T Volar X' in cold state, will try to load a firmware
dvb-usb: downloading firmware from file 'dvb-usb-af9015.fw'
dvb-usb: found a 'AVerMedia AVerTV DVB-T Volar X' in warm state.
dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
DVB: registering new adapter (AVerMedia AVerTV DVB-T Volar X)
af9013: firmware version:4.95.0.0
DVB: registering adapter 0 frontend 0 (Afatech AF9013 DVB-T)...
MXL5005S: Attached at address 0xc6
Registered IR keymap rc-avermedia-m135a
input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc2/input30
rc2: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1/rc/rc2
dvb-usb: schedule remote query interval to 500 msecs.
dvb-usb: AVerMedia AVerTV DVB-T Volar X successfully initialized and connected.
input: AVerMedia A815 as /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
generic-usb 0003:07CA:A815.000B: input,hidraw2: USB HID v1.01 Keyboard [AVerMedia A815] on usb-0000:00:1d.0-1.2.1/input1


it says "dvb-usb: found a 'AVerMedia AVerTV DVB-T Volar X' in warm state" so it looks OK.


We can list some loaded kernel modules:

$ lsmod | grep -i af
af9013 21481 1
dvb_usb_af9015 25467 0
dvb_usb 18285 1 dvb_usb_af9015
rc_core 18320 10 rc_avermedia_m135a,ir_lirc_codec,ir_sony_decoder,ir_jvc_decoder,ir_rc6_decoder,ir_rc5_decoder,dvb_usb_af9015,dvb_usb,ir_nec_decoder
i2c_core 23909 10 mxl5005s,af9013,dvb_usb_af9015,dvb_usb,nouveau,videodev,i2c_i801,drm_kms_helper,drm,i2c_algo_bit
usbcore 128338 10 dvb_usb_af9015,dvb_usb,uvcvideo,ftdi_sio,usbserial,usb_storage,uas,usbhid,ehci_hcd


$ cat /proc/modules
rc_avermedia_m135a 12404 0 - Live 0xffffffffa0721000
mxl5005s 37660 1 - Live 0xffffffffa0716000
af9013 21481 1 - Live 0xffffffffa070f000
ir_lirc_codec 12715 0 - Live 0xffffffffa070a000
lirc_dev 17027 1 ir_lirc_codec, Live 0xffffffffa0700000
ir_sony_decoder 12435 0 - Live 0xffffffffa06fb000
ir_jvc_decoder 12475 0 - Live 0xffffffffa06f6000
ir_rc6_decoder 12466 0 - Live 0xffffffffa06e8000
ir_rc5_decoder 12433 0 - Live 0xffffffffa06ce000
dvb_usb_af9015 25467 0 - Live 0xffffffffa06ee000
dvb_usb 18285 1 dvb_usb_af9015, Live 0xffffffffa06c3000
ir_nec_decoder 12475 0 - Live 0xffffffffa06c9000
dvb_core 77833 1 dvb_usb, Live 0xffffffffa06d3000
rc_core 18320 10 rc_avermedia_m135a,ir_lirc_codec,ir_sony_decoder,ir_jvc_decoder,ir_rc6_decoder,ir_rc5_decoder,dvb_usb_af9015,dvb_usb,ir_nec_decoder, Live 0xffffffffa06bd000


We check if DVB related devices appear in the system:

$ ls -lR /dev/dvb
/dev/dvb:
total 0
drwxr-xr-x 2 root root 120 feb 5 19:38 adapter0

/dev/dvb/adapter0:
total 0
crw-rw---- 1 root video 212, 0 feb 5 19:38 demux0
crw-rw---- 1 root video 212, 1 feb 5 19:38 dvr0
crw-rw---- 1 root video 212, 3 feb 5 19:38 frontend0
crw-rw---- 1 root video 212, 2 feb 5 19:38 net0



INSTALLING DVB-APPS

Once DVB driver works OK we need to install some useful DVB related tools and configuration files:

$ sudo aptitude install dvb-apps


TESTING OUR DVB DEVICE

We have already installed the driver and some tools, now we are going to test our DVB device:
http://linuxtv.org/wiki/index.php/Testing_your_DVB_device

First using scan tool we are going to create a channels.conf file suitable for other apps like mplayer or me-tv.
http://linuxtv.org/wiki/index.php/Scan

You will need an initial configuration file for your DVB-X system and geographical location.
E.g: mine is DVB-T for Spain and Huesca,

Check files in dvb-apps package:
$ dpkg -L dvb-apps

Initial config file for DVB-T Spain and Huesca is:
/usr/share/dvb/dvb-t/es-Huesca

NOTE: If you do not find any suitable initial scan file, you could use w_scan tool

Now we create a channels.conf file:
$ scan /usr/share/dvb/dvb-t/es-Huesca > channels.conf

Other scanning tools:
Comparison_of_DVB_frequency_scanning_commandline_utilities


TUNNING A CHANNEL AND DISPLAYING IT

We tune a channel using Zap tool
http://linuxtv.org/wiki/index.php/Zap

E.g: using just generated channels.conf file we select "ARAGON TV" TV channel:
$ tzap -r -c channels.conf "ARAGON TV"
Without ending this command with Ctr-C we launch mplayer in another console:
$ mplayer /dev/dvb/adapter0/dvr0 -framedrop -fs

And then you should see the channel you just selected.


WATCHING DVB-T USING MPLAYER

We are going to watch DVB channels using mplayer only (not using tzap tool to tune it)

Copy channels.conf file to mplayer configuration directory:
$ cp channels.conf $HOME/.mplayer/

Now if we want to watch "ARAGON TV" channel:
$ mplayer dvb://"ARAGON TV" -framedrop -fs

Some keys allow us to switch TV channels when running mplayer.
'h': next channel
'k': previous channel


CAPTURE TO HARD DISK

We tune the channel we want to capture
$ tzap -r -c channels.conf "ARAGON TV"

Then we simply perform a cat from dvr0 device file to the file we want to save the stream to.
$ cat /dev/dvb/adapter0/dvr0 > capture_file

To watch again the captured stream:
$ mplayer -framedrop -fs capture_file

NOTE: We could use dvbstream tool instead of cat.


W_SCAN TOOL

w_scan tool allow us to generate an initial scan file.

Download and build W_scan
http://wirbel.htpc-forum.de/w_scan/index_en.html

$ wget wirbel.htpc-forum.de/w_scan/w_scan-20120128.tar.bz2
$ tar xvjf w_scan-20120128.tar.bz2
$ cd w_scan-20120128/
$ aptitude install linux-libc-dev # it needs this dependency.
$ ./configure
$ make


We create the initial scan file. I have to pass -c ES argument for Spain:
$ w_scan-20120128/w_scan -ft -c ES -x >> initial_scan_info
$ scan initial_scan_info > channels.conf # generate channels.conf file.


ME-TV

There are several interesting programs suitable to watch DVB TV and radio streams:
http://linuxtv.org/wiki/index.php/TV_Related_Software

http://linuxtv.org/wiki/index.php/Me_TV
Me-TV is able to scan channels, show TV program information, record streams, network broadcast, etc.

$ sudo aptitude install me-tv
$ me-tv


SETTING UP IR REMOTE

Setting up IR remote for AVerTV Digi Volar X in Debian.


REFERENCE

http://linuxtv.org/wiki/index.php/Afatech_AF9015
http://linuxtv.org/wiki/index.php/AVerMedia_AVerTV_Digi_Volar_X_%28A815%29
http://linuxtv.org/wiki/index.php/Testing_your_DVB_device
http://linuxtv.org/wiki/index.php/Scan
http://linuxtv.org/wiki/index.php/Testing_reception_quality
http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers


INITIAL SCAN FILE FOR es-huesca

Canales TDT Huesca.

Initial Scan File:

T 738000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # BOING
T 850000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # CH 68
T 858000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # CH 69
T 650000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # HTV-HuescaTelevision
T 658000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # La Sexta 2
T 666000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # TVE HD
T 690000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # NITRO
T 762000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # ARAGON TV
T 794000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # TVE
T 842000000 8MHz  2/3 NONE    QAM64   8k  1/4 NONE # CH 67

2 comentarios:

Anonymous said...

Thank you very much for this guide! As a linux newbie I was trying to set up my AverTV Volar for hours; with no hope.

With your help, I could make it work within minutes. Fantastic! :-)

Vicente Hernando said...

Glad it was useful to you!