AVerMedia AverTV Hybrid Volar HX (A827)

From LinuxTVWiki
Revision as of 23:23, 23 December 2016 by Voidxor (talk | contribs) (→‎Getting it to work: Grammar.)
Jump to navigation Jump to search

Device Features

Vendor Device/Model Supported Pictures / URL E
AVerMedia AverTV Hybrid Volar HX (A827) Yes, by vendor [[1]] [2][3] Jump to the place where you can edit this entry

Specifications

Interface: USB 2.0 Supported Broadcast Formats: DVB-T, Analog, FM

This is what the USB DVB-T Database knows about this device:

did vendor device standard supported pic url hostinterface usbid hw tuner demodulator usbbridge fw comment E
avermedia-a827 AVerMedia AverTV Hybrid Volar HX (A827) DVB-T, ANALOG, FM Yes, by vendor [[4]] [5] [6] USB2.0 07ca:a827 none needed Jump to the place where you can edit this entry

Chips

  • Cypress CY7C68013A
  • NXP SAA7136E
  • NXP TDA18271HDC1
  • Afatech AF9013-N1

Getting it to work

Tested and worked on Fedora-11-i386, Kernel-2.6.29.4-167-PAE.fc11, Fedora 12 and Fedora 13 (both stock kernel) Dependencies needed (from installation DVD)

  • kernel,
  • kernel-headers,
  • kernel-devel,
  • gcc.

(yum install)

  • dialog
  • tvtime
  • mplayer (with all it's dependencies, including codecs).

(drivers from Avermedia website, as posted bellow)

  • July 2009 - 0.07 beta driver for i386 or x86_64 - tested on Fedora-11
  • January 2010 - 0.10 beta driver for i386 or x86_64 - tested on Ubuntu Karmic 910 and on ArchLinux(i386) with 2.6.33 kernel
  • May 2010 - 0.10 beta driver for x86_64 - works great on Fedora 13 (stock kernel)
  • November 2010 - 0.10 beta driver unusable for Fedora 14. Fedora 14 (kernel-2.6.35) correctly detects the Avermedia tuner, but that's all.
  • Avermedia's official answer is they stopped updating the driver for AverTV Hybrid Volar HX (A827).
  • So, a driver is needed for this device to work with Kernels greater than 2.6.33!
  • For me, the driver + kernel 2.6.35 seems to work. For 2.6.36, the functions "param_array_get" and "param_array_set" are not declared any more. Hex edit the binary files provided with the driver and replace the two occurences by "param_array_ops".
  • Appreciate your support. The driver fails to install on FC14 even with a manual install. Can you be more specific regarding your specifications for kernel 2.6.35?!

Plug in the USB Volar HX ( A827 ) tuner. Install driver in normal mode, and should see the installation concluded succesfully. Next, the messages is to unplug the device (do so) and to replug it (do so) Next is the sound testing. Modify the parameters according with your area. You should hear a tv sound like (with or without station). The ideea is to get sound from the USB tuner. After that there is the h826d-tools the software wants to install. You can install it, but there is no need of it (some sh scripts tv-player, audio, radio-player).

The thing is after that, you should see in dmesg, the tuner loaded and then devices created video0 vbi1 radio0 and even adapter0 (for dvb) and of course the alsa emulation for the tuner:

  • A827 registered V4L2 device video0[video]
  • [ 4373.455456] A827 registered V4L2 device vbi1[vbi]
  • [ 4373.455486] A827 registered V4L2 device radio0[radio]
  • [ 4373.455835] A827 registered ALSA sound card 1
  • [ 4373.455844] DVB: registering new adapter (A827[0] DVB-T)
  • [ 4373.455847] A827[0] DVB-T registered DVB adapter 0
  • [ 4373.457303] DVB: registering adapter 0 frontend 0 (A827[0] DVB-T)...

A cat /proc/asound/cards should display 1: your system sound card (let's say ALC 826 analog device) and 2: the sound emulation of your usb tv tuner. Of course if you have a webcam installed, these devices will show up different: video1 and so on and they should work with no problem.

Kernel 2.6.36, 2.6.37, 2.6.38, 2.6.39, 3.0.x, 3.1.x, 3.2.0

For 2.6.36 hex edit file H826D-expert-install/aver/osdep_dvb.o_shipped and replace param_array_get and param_array_set by param_array_ops. An easy solution is to use this script:

perl -pi -e 's/param_array_get/param_array_ops/g' aver/osdep_dvb.o_shipped
perl -pi -e 's/param_array_set/param_array_ops/g' aver/osdep_dvb.o_shipped

For 2.6.37:

  • in file H826D-expert-install/aver/osdep.c replace init_MUTEX(tmp); by sema_init(tmp, 1); and init_MUTEX_LOCKED(tmp); by sema_init(tmp, 0);
  • in file H826D-expert-install/aver/osdep_dvb.c replace init_MUTEX(&p->feedlock); by sema_init(&p->feedlock, 1);
  • add #define VFL_TYPE_VTX 3 to top of file H826D-expert-install/aver/osdep_v4l2.c

Tested on Archlinux and Slackware 13.1

For 2.6.38 (with Big Kernel Lock (BKL) disabled by default) - Solution from AVerMedia_A828:

  • Apply the solution for 2.6.36 and 2.6.37 before.
1. In aver/osdep.c : 
	Replace : 
		void SysLockKernel()
		{
			lock_kernel();
		}

		void SysUnlockKernel()
		{
			unlock_kernel();
		}
         By
                static DEFINE_MUTEX(dvbdev_mutex);
		void SysLockKernel()
		{
			mutex_lock(&dvbdev_mutex);
		}

		void SysUnlockKernel()
		{
			mutex_unlock(&dvbdev_mutex);
		}
2. In aver/osdep_th2.c :
	2.a After : 
		#include "osdep_th2.h"
	    Add : 
		#include "osdep.h"
	2.b Replace : 
		lock_kernel();
	    By : 
		SysLockKernel();
	
	2.c and Replace : 
		unlock_kernel();
	    By:
		SysUnlockKernel();

For 2.6.39:

  • Apply the solution for 2.6.36, 2.6.37 and 2.6.38 before.

Remove #include <linux/smp_lock.h> in file

  • H826D-expert-install/aver/osdep.c
  • H826D-expert-install/aver/osdep_dvb.c
  • H826D-expert-install/aver/osdep_th2.c
  • H826D-expert-install/aver/osdep_v4l2.c

For 3.0.x and 3.1.x:

  • Apply the solution for 2.6.36, 2.6.37, 2.6.38 and 2.6.39 before.

Remove lines in file installer/installer.sh:

       if [[ "$kversion" != "2" || "$kpatchlevel" != "6" ]]; then
               dialog --backtitle "$BACKTITLE" \
               --title "Kernel version error" \
               --msgbox "Installer cannot determine kernel version or the running kernel is not 2.6.x kernel. \n\
 Installer will abort now.
 " \
               10 $WIDTH
               log "generate_kdep_string: wrong kernel version ${kversion}.${kpatchlevel}.${ksublevel}. Abort."
         log_from_file $ksrc/Makefile #s016
         log_from_file $kobj/Makefile #s016
               exit
       fi

Tested on Debian wheezy (Kernel 3.1.0-1-amd64).

  • ALTERNATE MODE BY EXPERT-MODE INSTALL.

If no works at this moment, please use alternative method "expert-install" like follow:

  • Apply the solution for 2.6.36, 2.6.37, 2.6.38 and 2.6.39 before.

When you have modified all files, you now have to compile doing this in the folder H826D-expert-install :

#make

At this moment in the actual folder you have two files with extension .ko ( drivers ) and copy an paste into your folder of actual kernel like:

#cd H826d-expert-install
#cp *.ko /lib/modules/3.2.0-3-amd64/kernel/drivers/media/dvb/dvb-usb

Two files "h826d.ko" and "averusbh826d.ko" must be here. Last step is use this comand:

  1. depmod -a

If all work at this point you don't need do any more.

  • ALTERNATE MODE BY SCRIPT.

This method use all steps explained top ( except expert mode, this only for troubles with installer in mode by default") y one script file that you will make.....

1. Download C038A827H826_Installer_x64_0.10-Beta_091126.zip from AVerMedia website.

2. Create in same directory simple install script install_aver.sh:

#!/bin/bash

unzip C038A827H826_Installer_x64_0.10-Beta_091126.zip
cd H826D_Installer_x64_0.10-Beta
tail -n +115 AVERMEDIA-Linux-x64-H826D-0.10-beta.sh | bzip2 -d | tar xf -
patch -l -p1 < ../aver.patch
cd installer
./installer.sh

3. Create in same directory patch file aver.patch:

diff -Nr -u0 original/installer/installer.sh modified/installer/installer.sh
--- original/installer/installer.sh     2009-11-13 11:47:33.000000000 +0100
+++ modified/installer/installer.sh     2011-08-28 20:58:38.000000000 +0200
@@ -177,13 +176,0 @@
-       if [[ "$kversion" != "2" || "$kpatchlevel" != "6" ]]; then
-               dialog --backtitle "$BACKTITLE" \
-               --title "Kernel version error" \
-               --msgbox "Installer cannot determine kernel version or the running kernel is not 2.6.x kernel. \n\
-Installer will abort now.
-" \
-               10 $WIDTH
-               log "generate_kdep_string: wrong kernel version ${kversion}.${kpatchlevel}.${ksublevel}. Abort."
-        log_from_file $ksrc/Makefile #s016
-        log_from_file $kobj/Makefile #s016
-               exit
-       fi
-
diff -Nr -u0 original/installer/src/aver/osdep.c modified/installer/src/aver/osdep.c
--- original/installer/src/aver/osdep.c 2009-11-13 11:54:56.000000000 +0100
+++ modified/installer/src/aver/osdep.c 2011-08-28 20:19:19.000000000 +0200
@@ -89 +88,0 @@
-#include <linux/smp_lock.h>
@@ -435 +434 @@
-               init_MUTEX(tmp);
+               sema_init(tmp, 1);
@@ -439 +438 @@
-               init_MUTEX_LOCKED(tmp);
+               sema_init(tmp, 0);
@@ -1069,0 +1069 @@
+static DEFINE_MUTEX(dvbdev_mutex);
@@ -1072 +1072 @@
-       lock_kernel();
+       mutex_lock(&dvbdev_mutex);
@@ -1077 +1077 @@
-       unlock_kernel();
+       mutex_unlock(&dvbdev_mutex);
diff -Nr -u0 original/installer/src/aver/osdep_dvb.c modified/installer/src/aver/osdep_dvb.c
--- original/installer/src/aver/osdep_dvb.c     2009-11-13 11:54:57.000000000 +0100
+++ modified/installer/src/aver/osdep_dvb.c     2011-08-28 20:19:36.000000000 +0200
@@ -79 +78,0 @@
-#include <linux/smp_lock.h>
@@ -233 +232 @@
-               init_MUTEX(&p->feedlock);
+               sema_init(&p->feedlock, 1);
diff -Nr -u0 original/installer/src/aver/osdep_th2.c modified/installer/src/aver/osdep_th2.c
--- original/installer/src/aver/osdep_th2.c     2009-11-13 11:54:57.000000000 +0100
+++ modified/installer/src/aver/osdep_th2.c     2011-08-28 20:20:00.000000000 +0200
@@ -78 +77,0 @@
-#include <linux/smp_lock.h>
@@ -80,0 +80 @@
+#include "osdep.h"
@@ -90 +90 @@
-        lock_kernel();
+        SysLockKernel();
@@ -100 +100 @@
-        unlock_kernel();
+        SysUnlockKernel();
diff -Nr -u0 original/installer/src/aver/osdep_v4l2.c modified/installer/src/aver/osdep_v4l2.c
--- original/installer/src/aver/osdep_v4l2.c    2009-11-13 11:54:58.000000000 +0100
+++ modified/installer/src/aver/osdep_v4l2.c    2011-08-28 20:20:19.000000000 +0200
@@ -75,0 +76,2 @@
+#define VFL_TYPE_VTX 3
+
@@ -84 +85,0 @@
-#include <linux/smp_lock.h>

4. Run as root ./install_aver.sh and choose normal install.

NOTE: Works with kernel 3.0.3-gentoo x86_64.

For kernel 3.2.0, additional change is needed:

Modify driver-core.c, and add the line

#include	<linux/module.h>

after line 77

#include	<linux/types.h>

NOTE 2: Also if the h826d module doesn't load (check dmesg) the param_array_get/set to param_array_ops change is also needed (as mentioned in the Kernel 2.6.36... section above).

Tested on Debian wheezy (2012-06-27) kernel 3.2.0 and it worked.

Analog TV and composite

I only tested on analog tv and composite. For video I used tvtime (scan and watch analog channels but no sound) and mplayer - watched analog tv channels with sound on alsa server (I removed pulse as I always do.) There is no need to start arecord, or aplay, or sox, or so if you are gonna use mplayer to watch TV, as mplayer supports ALSA directly, but in this case, you must specify the hardware id: Ex:

  • if dmesg shows your Volar HX as: A827 registered ALSA sound card 1, you should declare in mplayer commandline adevice=hw.1
  • if dmesg shows your Volar HX as: A827 registered ALSA sound card 2, you should declare in mplayer commandline adevice=hw.2

(Example:)

  • mplayer tv:// -driver=v4l2:device=/dev/video0:norm=PAL:chanlist=europe-east:input=0:channel=R9:alsa:adevice=hw.1:forceaudio:immediatemode=0 tv://

(Similar for mencoder) The only mention that it deserve to be made, is to install all the alsa-plugins. Enjoy!

DVB-T

Kaffeine works like a charm, Klear (which is app I use on another machine over a year) work up to 10 seconds, then takes 100% of 1 processor (fortunately today almost everyone has dual or quad), and you have no other choice then to close it (or kill it in some cases).

MPlayer and Xine work fine once you provide them channels.conf made by scan in theirs respective config direcotries. Switching programs in Gnome Mplayer may cause some troubles (if you use channels as playlist) so recommended way is to turn off (gnome) mplayer instance you are currently watching and then open another with different channel.

FM radio

As written above, 0.10 beta driver for i386 or x86_64 makes /dev/radio0 device, I added user to video & audio group (even tried as root), but gnomeradio doesn't give a sound. That's probably some issue with mixer, as it is grayed. As in Windows both DVB-T and FM work, so there is obviously needed some tweaking to get FM radio working (haven't tried yet DVB radio either in Windows/linux).


I've got working radio with mplayer on Fedora 16.

mplayer radio://104.6

and then I have used sox to get sound:

sox --buffer 2048 -r 32000 -t alsa hw:1,0 -t pulseaudio

Mplayer must be compiled with FM radio support.

USB interfaces

/proc/bus/usb/devices-output (shorter then lsusb -v):

T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=07ca ProdID=a827 Rev= 1.03
S:  Manufacturer=AVerMedia
S:  Product=AVerTV
S:  SerialNumber=300871601647
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 0 Alt= 1 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=3030 Ivl=125us
I:  If#= 0 Alt= 2 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=2178 Ivl=125us
I:  If#= 0 Alt= 3 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=2058 Ivl=125us
I:  If#= 0 Alt= 4 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS= 970 Ivl=125us
I:  If#= 0 Alt= 5 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS= 684 Ivl=125us
I:  If#= 0 Alt= 6 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=500us
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=01(Isoc) MxPS= 940 Ivl=125us

Drivers

You can download drivers for Linux i586/x86_64 here:

This is official beta version 0.10 for OpenSuSE, Mandriva, Fedora and Ubuntu but it will most probably work with any other distro as well.

Unpluging unstability

While you unplug device when application read from alsa device, or device just do internal usb reset, driver will hang your computer, there is patch to prevent this issue:

diff -Naur a/aver/osdep_alsa.c b/aver/osdep_alsa.c
--- a/aver/osdep_alsa.c	2009-11-13 11:54:58.000000000 +0100
+++ b/aver/osdep_alsa.c	2013-04-02 22:11:59.095248270 +0200
@@ -90,11 +90,16 @@
 #include <sound/initval.h>
 #include <linux/interrupt.h>
 
+#include <linux/delay.h>
+#include <linux/kthread.h>
+
 #include "debug.h"
 #include "osdep.h"
 #include "osdep_alsa.h"
 #include "CAlsaAudio.hpp"
 
+static DEFINE_MUTEX(register_mutex);
+
 #if 0 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
@@ -203,10 +208,12 @@
 
 	DBG_fALSA(" name=%s, device=0x%p, private=0x%p\n", drivername, device, private_data);
 
+	mutex_lock(&register_mutex);
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) 
 	card = snd_card_new(-1, deviceid, THIS_MODULE, sizeof(struct alsa_card_context));
 	if( NULL == card ) {
 		DBG_fALSA(" calling snd_card_new failed\n");
+		mutex_unlock(&register_mutex);
 		return -ENOMEM;
 	}
 	else {
@@ -216,6 +223,7 @@
 	i = snd_card_create(-1, deviceid, THIS_MODULE, sizeof(struct alsa_card_context), &card);
 	if( i<0 ) {
 		DBG_fALSA(" calling snd_card_new failed, ret=%d\n", i);
+		mutex_unlock(&register_mutex);
 		return i;
 	}
 	else {
@@ -243,6 +251,8 @@
 	
 	snd_card_set_dev(card, device);
 
+	mutex_unlock(&register_mutex);
+
 	return 0;
 }
 #endif 
@@ -261,7 +271,9 @@
 		return -EINVAL;
 	}
 
+	mutex_lock(&register_mutex);
 	ret = snd_card_register(card);
+	mutex_unlock(&register_mutex);
 
 	DBG_fALSA("context=0x%p, card=0x%p\n", context, card);
 	DBG_fALSA("index=%d\n", card->number);
@@ -313,6 +325,44 @@
 	}
 }
 
+static int SysAlsaFreeCard(alsa_card_t acard)
+{
+	int i;
+	int ret = 0;
+	struct alsa_card_context *context;;
+
+	/* maximum wait will be 50 seconds */
+	for (i = 0; i < 1000; i++) {
+		/* check context */
+		if ((context = (struct alsa_card_context*) acard) == NULL) return -EINVAL;
+
+		/* check card */
+		if (context->card == NULL) return -EINVAL;
+
+		/* active substream - we can use time limit */
+		if (context->substream) {
+			msleep(50);
+			continue;
+		}
+
+		/* mutex */
+		mutex_lock(&register_mutex);
+
+		/* free device - no need to wait, locking is enough */
+		ret = snd_card_free(context->card);
+
+		/* unset device */
+		context->card = NULL;
+
+		/* unlock */
+		mutex_unlock(&register_mutex);
+
+		break;
+	}
+
+	return ret;
+}
+
 int SysAlsaFinishCard(alsa_card_t acard, int surprise_removable)
 {
 	int ret = 0;
@@ -326,16 +376,11 @@
 		return -EINVAL;
 	}
 
-	if( surprise_removable ) {
-
-
-
-		ret = snd_card_free(card);
-
-	}
-	else {
-		ret = snd_card_free(card);
-	}
+	/*
+	 * snd_card_free have to wait for locking in snd_pcm_close and it can
+	 * end in loop, so we open new thread to prevent this.
+	 */
+	kthread_run(SysAlsaFreeCard, acard, "SysAlsaFreeCard");
 
 	DBG_fALSA(" - ret=%d\n", ret);
 	return ret;

Kernel driver status

  • Avermedia stopped developing the driver for newer kernels, as posted above.
  • New hardware (H826) from New Egg has ID 07ca:4826. AVerMidia support says 4826 will not work with the old linux driver.
  • Help appreciated!

This device is currently unsupported by drivers in the regular kernel http://www.linuxtv.org/pipermail/linux-dvb/2008-October/029714.html


Is anybody there who made it work with kernel 3.10 and later?

I tried (H826), but the new hardware has ID 07ca:4826. 4826 is not supported by the old AVerMedia software blob "_prebuild.o_shipped". Forcing it did not work.