Building Black Gold BGT3xxx DVB-T2 Drivers for Linux

raydon

Well-known Member
I've just succeeded in getting my Black Gold BGT3620 twin DVB-T2 PCIe tuner card working with Linux Mint so I thought I would share this information here as it may help someone to do the same.
As said, I'm using latest Linux Mint Cinnamon 17 (3.13.0-24 kernel x86_64) but I reckon this should work with most distros.
*********************************************************************
UPDATE: There is now an alternative build kindly provided by user trident01 which has all the patches pre-applied and has been tested with Linux Mint Cinnamon 17.3 using kernels up to, and including, v4.2.0-25. For more details see the posts at the end of this thread starting from post #39.
To build the drivers simply enter these four instructions from the command line (replacing the asterisks in the link):

cd /usr/src
sudo git clone h**p://www.cblinux.co.uk:5010/BGT3xxx
cd BGT3xxx
sudo ./build.sh

*********************************************************************

Finally a reboot is required to load the modules. You can then confirm adapter status using the lsdvb command. Output should look like this:

lsdvb: Simple utility to list PCI/PCIe DVB devices
Version: 0.0.4
Copyright (C) Manu Abraham

SAA7231 (1131:7231 14:3620) on PCI Domain:0 Bus:2 Device:0 Function:0
DEVICE:0 ADAPTER:0 FRONTEND:0 (Sony CXD2820R)
FE_OFDM Fmin=42MHz Fmax=870MHz
DEVICE:0 ADAPTER:1 FRONTEND:0 (Sony CXD2820R)
FE_OFDM Fmin=42MHz Fmax=870MHz

If you don't have the lsdvb utility installed then use dmesg | grep DVB instead. Output should look like this:

[ 6.286037] DVB: registering new adapter (SAA7231 DVB External Adapter:1)
[ 6.595163] SAA7231 0000:02:00.0: DVB: registering adapter 0 frontend 0 (Sony CXD2820R)...
[ 6.609731] DVB: registering new adapter (SAA7231 DVB External Adapter:0)
[ 6.918891] SAA7231 0000:02:00.0: DVB: registering adapter 1 frontend 0 (Sony CXD2820R)...
 
Last edited:

pbrewer

Novice Member
Hi Raydon,

Thanks for the post - it's the most comprehensive tutorial I've found so far. I have the same setup as you: LM 17 Cinnamon with 3.13.0-24 x86_64, but I'm getting compiler errors. I do have a little linux experience, but this goes beyond my capabilities - if you have a chance could you give me a pointer in the right direction - I've added the error below (note that I re-ran the process to grab the output - which is why the patches are skipped).

Any help would be much appreciated!

patching file saa7231_i2c.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file saa7231_i2c.c.rej
patching file Makefile
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file Makefile.rej
./scripts/make_myconfig.pl
perl scripts/make_config_compat.pl /lib/modules/3.13.0-24-generic/build ./.myconfig ./config-compat.h
creating symbolic links...
make -C firmware prep
make[1]: Entering directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make[1]: Leaving directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make -C firmware
make[1]: Entering directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
Kernel build directory is /lib/modules/3.13.0-24-generic/build
make -C /lib/modules/3.13.0-24-generic/build SUBDIRS=/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l CFLAGS="-I/usr/include -D__KERNEL__ -I/include -DEXPORT_SYMTAB" modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-24-generic'
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/tuner-simple.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/tuner-types.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_core.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_c.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_t.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_t2.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dvbdev.o
CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.o
In file included from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:40:0,
from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: nested redefinition of 'enum dmx_ts_pes'
enum dmx_ts_pes
^

/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: redeclaration of 'enum dmx_ts_pes'
In file included from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:37:0,
from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/usr/src/linux-headers-3.13.0-24-generic/include/uapi/linux/dvb/dmx.h:54:14: note: originally defined here
typedef enum dmx_ts_pes
^
make[2]: *** [/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.o] Error 1
make[1]: *** [_module_/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l] Error 2

make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-24-generic'
make: *** [default] Error 2
-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/dvb/frontends:

-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/video:

-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/dvb/cinergyT2:

Installing kernel modules under /lib/modules/3.13.0-24-generic/kernel/drivers/media/:
/sbin/depmod -a 3.13.0-24-generic
make -C firmware install
make[1]: Entering directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
Installing firmwares at /lib/firmware: vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin av7110/bootcode.bin
make[1]: Leaving directory `/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'

All Done! Reboot to enable the adapter.
You can then check adapter status using the 'lsdvb' command.
me
 

raydon

Well-known Member
I don't get this build error myself but looking at your error and the sources maybe I should be.
It would appear that <linux/dvb/dmx.h> is being included twice. Once in dmxdev.h line 37 (which also includes "demux.h" at line 40). However, "demux.h" itself also includes <linux/dvb/dmx.h> at line 33.
Possible fix: Completely remove line 37 #include <linux/dvb/dmx.h> from file
BGT3xxx Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core/dmxdev.h
then try again.
Please let me know if this works and I'll update my attachment with another patch.
 
Last edited:

Beanz

Novice Member
I have also been struggling with the same problem, and after looking through the source files where the errors appear I have noticed the following:

In /bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core-5.9/demux.h the enum dmx_ts_pes is throwing an error, because it's also defined in the file /usr/src/linux-headers-3.13.0-34-generic/include/uapi/linux/dvb/dmx.h

In the former the definition (and in some other files) is as follows:

enum dmx_ts_pes
{ /* also send packets to decoder (if it exists) */
DMX_TS_PES_AUDIO0,
DMX_TS_PES_VIDEO0,
DMX_TS_PES_TELETEXT0,
DMX_TS_PES_SUBTITLE0,
DMX_TS_PES_PCR0,

DMX_TS_PES_AUDIO1,
DMX_TS_PES_VIDEO1,
DMX_TS_PES_TELETEXT1,
DMX_TS_PES_SUBTITLE1,
DMX_TS_PES_PCR1,

DMX_TS_PES_AUDIO2,
DMX_TS_PES_VIDEO2,
DMX_TS_PES_TELETEXT2,
DMX_TS_PES_SUBTITLE2,
DMX_TS_PES_PCR2,

DMX_TS_PES_AUDIO3,
DMX_TS_PES_VIDEO3,
DMX_TS_PES_TELETEXT3,
DMX_TS_PES_SUBTITLE3,
DMX_TS_PES_PCR3,

DMX_TS_PES_OTHER
};


In the Kernel it's
typedef enum dmx_ts_pes
{
DMX_PES_AUDIO0,
DMX_PES_VIDEO0,
DMX_PES_TELETEXT0,
DMX_PES_SUBTITLE0,
DMX_PES_PCR0,

DMX_PES_AUDIO1,
DMX_PES_VIDEO1,
DMX_PES_TELETEXT1,
DMX_PES_SUBTITLE1,
DMX_PES_PCR1,

DMX_PES_AUDIO2,
DMX_PES_VIDEO2,
DMX_PES_TELETEXT2,
DMX_PES_SUBTITLE2,
DMX_PES_PCR2,

DMX_PES_AUDIO3,
DMX_PES_VIDEO3,
DMX_PES_TELETEXT3,
DMX_PES_SUBTITLE3,
DMX_PES_PCR3,

DMX_PES_OTHER
} dmx_pes_type_t;


There is no _TS in the kernel version. I've not been able to get the drivers to load (and show up under lsdvb) and I don't seem to have anything showing in /dev/dvb, but I hope this helps lead to a solution.
 

pbrewer

Novice Member
Hi Raydon,

Thanks for your very quick reply! I tried the commenting out suggestion but it looks like this enum is referenced in another file too as the error simply moves down to the demux.h include. I don't know if it makes any difference but the gcc verison I'm using is 4.8.2 (Ubuntu 4.8.2-19ubuntu1). I've included the error below, and agin any further help would be very much appreciated:

CC [M] /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.o
In file included from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:40:0,
from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: nested redefinition of 'enum dmx_ts_pes'
enum dmx_ts_pes
^
/usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: redeclaration of 'enum dmx_ts_pes'
In file included from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:33:0,
from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:40,
from /usr/local/build/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/usr/src/linux-headers-3.13.0-24-generic/include/uapi/linux/dvb/dmx.h:54:14: note: originally defined here
typedef enum dmx_ts_pes
^
 

Beanz

Novice Member
After a lot of messing around, I *think* I have got it to work, but I've been fumbling through it.
Here's what I did:
  1. I edited each instance of "DMX_TS_PES_OTHER" to "DMX_PES_OTHER" in all files under /bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core-5.9/
  2. I removed the "enum dmx_ts_pes" and 5 following #define lines from the demux.h file
  3. ran the MakeBGT3xxx.sh file
  4. Restart
  5. Rename /lib/modules/3.13.0-34-generic/kernel/drivers/media/dvb-core/dvb-core.ko to dvb-core2.ko
  6. Copy the dvb-core.ko file from ~/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dvb-core.ko into the above folder
  7. Restart
And now it's showing up in lsdvb and doing useful stuff when I run scan (MythTV Ubuntu Freesat HD Installation Guide
 

raydon

Well-known Member
Hmm, that's very strange. As far as I can ascertain, the files under /bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core-5.9 are not used, so any edits done in there shouldn't make any difference. The folder that is used in the build is /bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core, and the demux.h file in there already has the edits you mention. You can check that the demux.h file created by the build under /bgt-linux-pcie-drv/v4l is a symlink to the real file in /bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core not dvb-core-5.9. To be absolutely sure of this I deleted the dvb-core-5.9 folder before running the build script again and the driver modules still compiled OK.
I did notice that you quoted linux-headers-3.13.0-34-generic in post #4 whereas I'm using linux-headers-3.13.0-24-generic. Don't know if this would make any difference though.
Also, you should not have needed steps 5 and 6 as above as this is handled by the 'make install' part of the build script.
Script output looks like this:


-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/video:

-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/dvb/frontends:

-e
Removing obsolete files from /lib/modules/3.13.0-24-generic/kernel/drivers/media/dvb/cinergyT2:

Installing kernel modules under /lib/modules/3.13.0-24-generic/kernel/drivers/media/:
dvb/frontends/: cxd2861.ko cxd2850.ko lnbp21.ko
tda18272.ko dvb_dummy_fe.ko cxd2820r.ko
cxd2817.ko stv090x.ko stv6110x.ko
s5h1411.ko dvb-pll.ko a8290.ko
tda10048.ko
saa7231/: saa7231_core.ko saa7231_drv.ko
common/tuners/: tuner-types.ko tuner-simple.ko tda18271.ko
dvb/dvb-core/: dvb-core.ko
/sbin/depmod -a 3.13.0-24-generic

Anyway, you seem to have managed to get the drivers built and working so that's the main thing. Just need to get Mr Brewer sorted out now if I can.

@pbrewer You are using same kernel as me so you should be able to use the same modules I compiled for mine. I've uploaded them for you HERE.
You should be able to figure out which ones to put where using the details above.
Then do sudo /sbin/depmod -a 3.13.0-24-generic and finally make sure that the previous run of MakwBGT3xxx.sh has installed BGT3xxx.conf into folder /etc/modules-load.d
A reboot should then load the modules.
 
Last edited:

pbrewer

Novice Member
Hi Raydon / beanz,

Thank you both for your help and persisting with me - it is very much appreciated. By following yours and beanz steps I am able to install the driver so that the lsdvb command lists the 2 tuners (although I am running kernel 3.13.0-24-generic not 3.13.0-34-generic).

A very big thank you to you both!

BTW, can I ask what software you are using/ would recommend for tv watching and home theatre - I want to drive my TV using the pc mainly for tv but also videos/ photos/ dvd/ blu-ray?
 

raydon

Well-known Member
Did you use my pre-compiled modules or did you manage to compile your own ?
If you compiled your own could you explain exactly what you needed to do ?
 
Last edited:

RichardWh

Novice Member
Hi.

It looks like I'm suffering with the enum dmx_ts_pes thing too...... but have limited experience in this area <learning fast>. Can you offer any suggestions? Thanks.

patching file saa7231_i2c.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file saa7231_i2c.c.rej
patching file Makefile
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file Makefile.rej
./scripts/make_myconfig.pl
perl scripts/make_config_compat.pl /lib/modules/3.13.0-35-generic/build ./.myconfig ./config-compat.h
creating symbolic links...
make -C firmware prep
make[1]: Entering directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make[1]: Leaving directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make -C firmware
make[1]: Entering directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
Kernel build directory is /lib/modules/3.13.0-35-generic/build
make -C /lib/modules/3.13.0-35-generic/build SUBDIRS=/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l CFLAGS="-I/usr/include -D__KERNEL__ -I/include -DEXPORT_SYMTAB" modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-35-generic'
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/tuner-simple.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/tuner-types.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_core.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_c.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_t.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/cxd2820r_t2.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dvbdev.o
CC [M] /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.o
In file included from /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:40:0,
from /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: nested redefinition of 'enum dmx_ts_pes'
enum dmx_ts_pes
^
/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/demux.h:89:6: error: redeclaration of 'enum dmx_ts_pes'
In file included from /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.h:37:0,
from /home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.c:32:
/usr/src/linux-headers-3.13.0-35-generic/include/uapi/linux/dvb/dmx.h:54:14: note: originally defined here
typedef enum dmx_ts_pes
^
make[2]: *** [/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/dmxdev.o] Error 1
make[1]: *** [_module_/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-35-generic'
make: *** [default] Error 2
-e
Removing obsolete files from /lib/modules/3.13.0-35-generic/kernel/drivers/media/dvb/cinergyT2:

-e
Removing obsolete files from /lib/modules/3.13.0-35-generic/kernel/drivers/media/video:

-e
Removing obsolete files from /lib/modules/3.13.0-35-generic/kernel/drivers/media/dvb/frontends:

Installing kernel modules under /lib/modules/3.13.0-35-generic/kernel/drivers/media/:
/sbin/depmod -a 3.13.0-35-generic
make -C firmware install
make[1]: Entering directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'
Installing firmwares at /lib/firmware: vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin cpia2/stv0672_vp4.bin av7110/bootcode.bin
make[1]: Leaving directory `/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/firmware'

All Done! Reboot to enable the adapter.
You can then check adapter status using the 'lsdvb' command.
 

raydon

Well-known Member
Hi Richard,
Unfortunately I did not get any confirmation from pbrewer as to exactly what he did to get the modules to compile but I suspect it was the removal of a specific folder and contents which I had suggested was the source of the problem. It's really annoying when you help someone who then ignores your request for feedback once their own particular problem is solved.

Anyway, rant over. In your case the folder to remove would be:
/home/richard/Documents/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/linux/drivers/media/dvb/dvb-core-5.9
Try deleting this folder then run the build script again. If this works then PLEASE let me know so that I can make changes to the script, so helping everyone and not just you.
 
Last edited:

RichardWh

Novice Member
Jackpot!!!! Thank you. I owe you a pint. :clap::clap::clap::clap::clap::clap::clap::clap::clap::clap::clap::clap::D:D:D

[email protected]:~$ dmesg | grep DVB
[ 11.624031] DVB: registering new adapter (SAA7231 DVB External Adapter:1)
[ 12.322381] SAA7231 0000:03:00.0: DVB: registering adapter 0 frontend 0 (Sony CXD2820R)...
[ 12.336392] DVB: registering new adapter (SAA7231 DVB External Adapter:0)
[ 12.757278] SAA7231 0000:03:00.0: DVB: registering adapter 1 frontend 0 (Sony CXD2820R)...
 

raydon

Well-known Member
Thanks for the feedback Richard.
I've now updated the build script to prevent this error from occurring in future.
 

RichardWh

Novice Member
I think you should get a job working for Blackgold. This is much better and simpler than the instructions on their driver.
 

AndyBurns

Novice Member
OK, I'm a Fedora user rather than a Mint user, but these instructions (with a bit of tweaking to suit) have got my BGT3602 up and running under 3.15 kernel

However for me it detects the DVB-S2 tuners rather than the DVB-T2 tuners, connecting my dish up, scandvb can use adapter0/frontend0 to see Astra28.2E signals

Has anyone else had similar results on any other distro?

$ lspci -tv
-[0000:00]-+-00.0 Intel Corporation 440FX - 82441FX PMC [Natoma]
+-01.0 Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+-01.1 Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+-01.2 Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
+-01.3 Intel Corporation 82371AB/EB/MB PIIX4 ACPI
+-02.0 Red Hat, Inc. QXL paravirtual graphic card
+-03.0 Red Hat, Inc Virtio network device
+-04.0 Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller
+-05.0 Red Hat, Inc Virtio console
+-06.0 Red Hat, Inc Virtio block device
+-07.0 Red Hat, Inc Virtio memory balloon
+-08.0 Philips Semiconductors SAA7231
\-09.0 Philips Semiconductors SAA7231

The eagle-eyed will spot that my Fedora machine is actually a virtual machine, running under Centos7, with VT-d/VT-x passing the PCI card to the VM - I like to make life interesting :)


$ lspci -kvd 1131:

00:08.0 Multimedia controller: Philips Semiconductors SAA7231 (rev aa)
Subsystem: Modular Technology Holdings Ltd Device 3595
Physical Slot: 8
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at fc000000 (64-bit, non-prefetchable) [size=4M]
Memory at fc400000 (64-bit, non-prefetchable) [size=4M]
Capabilities: [40] MSI: Enable- Count=1/16 Maskable- 64bit+
Capabilities: [50] Express Endpoint, MSI 00
Capabilities: [74] Power Management version 3
Capabilities: [7c] Vendor Specific Information: Len=84 <?>
Kernel driver in use: SAA7231
Kernel modules: saa7231_drv

00:09.0 Multimedia controller: Philips Semiconductors SAA7231 (rev aa)
Subsystem: Modular Technology Holdings Ltd Device 3600
Physical Slot: 9
Flags: bus master, fast devsel, latency 0, IRQ 10
Memory at fc800000 (64-bit, non-prefetchable) [size=4M]
Memory at fcc00000 (64-bit, non-prefetchable) [size=4M]
Capabilities: [40] MSI: Enable- Count=1/16 Maskable- 64bit+
Capabilities: [50] Express Endpoint, MSI 00
Capabilities: [74] Power Management version 3
Capabilities: [7c] Vendor Specific Information: Len=84 <?>
Kernel driver in use: SAA7231
Kernel modules: saa7231_drv


$ lsmod | grep -E "dvb|saa|cxd|stv"

cxd2820r 31512 0
stv6110x 13502 2
stv090x 70254 2
saa7231_drv 19130 0
saa7231_core 61686 3 saa7231_drv
dvb_core 114974 2 saa7231_core,cxd2820r
i2c_core 55486 8 drm,i2c_piix4,drm_kms_helper,saa7231_core,stv090x,lnbp21,cxd2820r,stv6110x


$ dmesg | grep DVB
[ 3.701053] DVB: registering new adapter (SAA7231 DVB External Adapter:1)
[ 4.121932] SAA7231 0000:00:08.0: DVB: registering adapter 0 frontend 0 (STV090x Multistandard)...
[ 4.133052] DVB: registering new adapter (SAA7231 DVB External Adapter:0)
[ 4.187474] SAA7231 0000:00:08.0: DVB: registering adapter 1 frontend 0 (STV090x Multistandard)...
[ 4.471369] DVB: registering new adapter (SAA7231 DVB External Adapter:1)
[ 4.492027] DVB: registering new adapter (SAA7231 DVB External Adapter:0)


$ ls -R /dev/dvb/

/dev/dvb/:
adapter0 adapter1 adapter2 adapter3
/dev/dvb/adapter0:
demux0 dvr0 frontend0 net0
/dev/dvb/adapter1:
demux0 dvr0 frontend0 net0
/dev/dvb/adapter2:
demux0 dvr0 net0
/dev/dvb/adapter3:
demux0 dvr0 net0


$ lsdvb

SAA7231 (1131:7231 14:3595) on PCI Domain:0 Bus:0 Device:8 Function:0
DEVICE:0 ADAPTER:0 FRONTEND:0 (STV090x Multistandard)
FE_QPSK Fmin=950MHz Fmax=2150MHz
DEVICE:0 ADAPTER:1 FRONTEND:0 (STV090x Multistandard)
FE_QPSK Fmin=950MHz Fmax=2150MHz


$ scandvb -v /usr/share/dvb/dvb-s/Astra-28.2E

scanning /usr/share/dvb/dvb-s/Astra-28.2E
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
[...]
dumping lists (1564 services)
Lifetime HD:11719:h:0:29500:515:0:3920
Sky Sports 1 HD:11719:h:0:29500:512:640:4003
Sky Sports 2 HD:11719:h:0:29500:512:640:3913
Sky Sports 3 HD:11719:h:0:29500:512:640:4001
Sky Sports 4 HD:11719:h:0:29500:512:640:4004
MTV Live HD:11719:h:0:29500:514:0:3806
Sky Sports 5 HD:11719:h:0:29500:513:0:4011
AnimalPlnt HD:11758:h:0:29500:516:644:3905
Disney XD HD:11758:h:0:29500:512:640:3870
ITV2 HD:11758:h:0:29500:513:0:3932
ITV3 HD:11758:h:0:29500:514:0:3933
ITV4 HD:11758:h:0:29500:515:0:3934
 

AndyBurns

Novice Member
Would someone who has the terrestrial section of the card working be good enough to paste the result from an

lspci -kmvnnd 1131:

command, so I can compare it to mine, thanks.
 
Last edited:

raydon

Well-known Member
$ ls -R /dev/dvb/

/dev/dvb/:
adapter0 adapter1 adapter2 adapter3
/dev/dvb/adapter0:
demux0 dvr0 frontend0 net0
/dev/dvb/adapter1:
demux0 dvr0 frontend0 net0
/dev/dvb/adapter2:
demux0 dvr0 net0
/dev/dvb/adapter3:
demux0 dvr0 net0
There are no frontends listed for adapter2 and adapter3 in the device nodes.
Don't know enough about this to suggest a solution but I think it could be relevant.
Can they be added manually ??
 

AndyBurns

Novice Member
If I load the saa7231_drv module with verbose=1, I see that adapters 2 and 3 don't recognise which frontend they should use for DVB-T2, but I don't see a parameter like cardtype=xx that some other tuners use to give the driver a clue ...

[21487.999083] saa7231_pci_init (1): found a BlackgoldTechnology BGT3600 DVB-T/T2 +Analog device
[21488.000427] saa7231_pci_init (1): BAR 0Offset:04 BAR 2Offset:04
[21488.000429] saa7231_pci_init (1): BAR0 Start=fc800000 length=4M
[21488.000430] saa7231_pci_init (1): BAR2 Start=fcc00000 length=4M
[21488.000451] SAA7231GE [14c7:3600], irq:10,
mmio(0):0xffffc90009d80000 mmio(2):0xffffc9000a200000
[21488.000461] SAA7231 64Bit, MSI Disabled, MSI-X=1 msgs
[21488.000468] saa7231_cgu_init (1):Initializing CGU
[21488.262048] DVB: registering new adapter (SAA7231 DVB ExternalAdapter:1)
[21488.263885] saa7231_frontend_attach (1):Frontend:0 attach failed
[21488.263888] saa7231_dvb_init (1): SAA7231 frontend initialization failed
[21488.263890] saa7231_dvb_init (1): A frontend driver was not found for[1131:7231] subsystem [14c7:3600]

I do have the cxd2820r module loaded, which I think is the correct frontend it should be using.
 

raydon

Well-known Member
Some commands you can try to gain some additional information. May help, maybe not.........
modinfo saa7231_drv
modinfo saa7231_core
modinfo dvb_core
modinfo cxd2820r
udevadm info -a -p $(udevadm info -q path -n /dev/dvb/adapter2/dvr0)
 

AndyBurns

Novice Member
Thanks, modinfo I'm aware of, it showed I could use

modprobe saa7231_drv verbose=1

which did give a few clues, but the frontend doesn't seem to have any other parameters, I've added a few more debug prints, which show it's definitely trying to attach the cxd2820r frontend, but not succeeding.

I've tried to enable the dev_dbg() statements within the cxdr2820r module, but my debugfs juju is weak, I tried

echo "module cxd2820r +p" > /sys/kernel/debug/dynamic_debug/control

but nothing appeared in dmesg when re-loading the modules :-(

The udevdm command is a new one on me, it gives

Code:
# udevadm info -a -p $(udevadm info -q path -n /dev/dvb/adapter2/dvr0)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:09.0/dvb/dvb2.dvr0':
    KERNEL=="dvb2.dvr0"
    SUBSYSTEM=="dvb"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:09.0':
    KERNELS=="0000:00:09.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="SAA7231"
    ATTRS{irq}=="10"
    ATTRS{subsystem_vendor}=="0x14c7"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x048000"
    ATTRS{enabled}=="1"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpus}=="3"
    ATTRS{device}=="0x7231"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-1"
    ATTRS{vendor}=="0x1131"
    ATTRS{subsystem_device}=="0x3600"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
 

pbrewer

Novice Member
Hi Raydon, please accept my apologies for not getting back to you sooner. In my defense we had a new baby boy to look after which somewhat occupied my spare time :) As I think I mentioned before, I followed the steps described by beanz (the only difference being the kernel version in the directory name). Unfortunately I found the performance and stability a bit lacking, although this could be xbmc/myth rather than the driver. So I'm back to WMC now :'( I'm glad you were able to get to the root of the problem. Or still amazes me the black gold can release sources in such an unstable state.

My thanks again to you and beanz for filling the gap that blackgold left. I hope someone there looks at this forum and integrates your changes!
 

AndyBurns

Novice Member
DVB: registering new adapter (SAA7231 DVB ExternalAdapter:1)
saa7231_frontend_attach (1):Frontend:0 attach failed
saa7231_dvb_init (1): SAA7231 frontend initialization failed
saa7231_dvb_init (1): A frontend driver was not found for[1131:7231] subsystem [14c7:3600]
OK, I found how to load the frontend driver with debugging

modprobe cxd2820r dyndbg==pmfl

Then I saw some more info ...

cxd2820r:cxd2820r_attach:708: i2c i2c-7: cxd2820r_attach: chip id=b1

after which the driver bailed out as it was checking that chip id must equal 0xe1 for it to continue, so as a quick hack I modded that test to force it to continue with my 0xb1 chip

That didn't take it much further ...

cxd2820r:cxd2820r_i2c_gate_ctrl:591: i2c i2c-7: cxd2820r_i2c_gate_ctrl: 1
saa7231_i2c_send (1): ERROR: TXFIFO not empty after timeout, status=0x11d
saa7231_i2c_send (1): I2C Send failed (Err=-5)
saa7231_i2c_xfer (1): Data send failed
saa7231_i2c_xfer (1): ERROR: Bailing out <-5>
cxd2820r:cxd2820r_i2c_gate_ctrl:591: i2c i2c-7: cxd2820r_i2c_gate_ctrl: 0

but at least lsdvb sees all four adapters and front ends

Code:
# lsdvb
    lsdvb: Simple utility to list PCI/PCIe DVB devices
    Version: 0.0.4
    Copyright (C) Manu Abraham
SAA7231 (1131:7231 14:3595) on PCI Domain:0 Bus:0 Device:8 Function:0
  DEVICE:0 ADAPTER:0 FRONTEND:0 (STV090x Multistandard)
      FE_QPSK Fmin=950MHz Fmax=2150MHz
  DEVICE:0 ADAPTER:3 FRONTEND:0 (Sony CXD2820R)
      FE_OFDM Fmin=42MHz Fmax=870MHz
  DEVICE:0 ADAPTER:2 FRONTEND:0 (Sony CXD2820R)
      FE_OFDM Fmin=42MHz Fmax=870MHz
  DEVICE:0 ADAPTER:1 FRONTEND:0 (STV090x Multistandard)
      FE_QPSK Fmin=950MHz Fmax=2150MHz
So now I need to see what the difference between a B1 and E1 chip is, if anyone who has the DVB-T2 portion of this card working would be willing to do an rmmod/modprobe with the dyndbg parameter and show me their chip id from dmesg, I'd be grateful ...
 

chipsugar

Novice Member
So now I need to see what the difference between a B1 and E1 chip is, if anyone who has the DVB-T2 portion of this card working would be willing to do an rmmod/modprobe with the dyndbg parameter and show me their chip id from dmesg, I'd be grateful ...
You're probably better building against an older kernel for your distro even if it's from a previous release like ubuntu 13.04 or kernel.org. That would probably give you a better idea of what the driver is trying to do. I'm thinking of buying one of the quad tuner cards (the 3595) but not until it works on ubuntu 14.04 so good luck and thank you.
 

AndyBurns

Novice Member
You're probably better building against an older kernel for your distro
I'm in the process of setting up a "build" virtual machine, separate from the virtual machine with the tuners passed-through to it, problem is I only get the odd hour or two here and there, but you're right it might be easier to get it working with an older kernel first, once I can do that I would like to get it running with current kernel.

Meanwhile, if anyone has hints on where to lay my hands on CXD2820R tech docs describing the registers (not just the spec sheet) that would be helpful ...
 

FredrikM

Novice Member
I'm having trouble to build the drivers

Code:
  CC [M]  /home/fredrik/tv/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/saa7231_dvb.o
make[2]: *** No rule to make target `/home/fredrik/tv/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/bt87x.o', needed by `/home/fredrik/tv/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l/tda18271.o'.  Stop.
make[1]: *** [_module_/home/fredrik/tv/BGT3xxx_Linux_Source_Release_Pack_V1-0/bgt-linux-pcie-drv/v4l] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-37-generic'
make: *** [default] Error 2
/Fredrik
 

The latest video from AVForums

Podcast: Home AV, TV, Tech News & Reviews, Plus The Best of July 2020

Trending threads

Latest News

Linn announces Majik DSM digital streamer upgrade
  • By Andy Bassett
  • Published
Sony announces WH-1000XM4 noise cancelling headphones
  • By Andy Bassett
  • Published
McIntosh launches C22 Mk V preamp and MC1502 power amplifier
  • By Andy Bassett
  • Published
Marantz unveils 12 Series Special Edition models
  • By Andy Bassett
  • Published
Samsung Galaxy Note 20 smart phone models launched
  • By Andy Bassett
  • Published
Top Bottom