TBS driver installation

From LinuxTVWiki
(Redirected from TBS PCIe card setup)
Jump to navigation Jump to search

A number of capture devices from TBS Technologies have a common setup process.

Open-source drivers

These instructions are inspired from Luis Alves' wiki and TBS' wiki on Github. Go to the later for latest official word on build procedure. You may want to consult the TBS' forum too, for additional advices in case of trouble.

The open-source driver does not currently support the remote control, but SD and HD reception is working and appears to be stable and quicker to change channels than the old TBS closed source version. As of 2014-11-27, this driver was tested with success with DVB-T transmitters in Europe. And DVB-T2 transmitters in United-Kingdom and France (only experimental DVB-T2 transmitters at Eiffel tower in Paris in France for UHD TV (AAC+HVEC)).

It does not currently support the TBS6205.


Building the Open Source Driver

Installing the build dependencies

You should make sure that you have the following tools installed on your compiling system:

  • lsdiff, included in the patchutils Debian package
  • ProcessTable, available with the libproc-processtable-perl Debian package
  • linux-headers, find the correct package for your kernel version with the linux-headers-$(uname -r), for example linux-headers-4.19.0-20-amd64 Debian package
sudo apt-get install patchutils libproc-processtable-perl linux-headers-$(uname -r)

Otherwise, your build will fail at some stage.


From there, you have the choice between following the instructions for building Luis Alves' driver from here, or following the instructions for building TBS' forked driver from there. Both sets of instructions are very similar.

Buidling Luis Alves' driver

The open source driver of Luis Alves is available here.

mkdir ljalves-tbsdriver
cd ljalves-tbsdriver
git clone https://github.com/ljalves/media_build.git
git clone --depth=1 https://github.com/ljalves/linux_media.git -b latest ./media
cd media_build
make dir DIR=../media
make distclean
make
sudo make install


Note: I failed to build Luis' driver but managed to build TBS', against a 4.15.0 kernel with Ubuntu 18.04 LTS. I would then recommend to start with TBS' forked driver first. Not sure if Luis is actively updating the open-source driver. --Golffies (talk) 17:49, 21 August 2019 (UTC)


Buidling TBS' forked driver

The fork from TBS is available here.

mkdir tbsdriver
cd tbsdriver
git clone https://github.com/tbsdtv/media_build.git
git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media
cd media_build
make dir DIR=../media
make allyesconfig
make -j4
sudo make install

Post-installation

Loading the modules

You should now unload/reload the modules manually or otherwise reboot the system.

  • Reload the module with CX23885 based cards:
~/media_build $ sudo make rmmod
~/media_build $ sudo modprobe cx23885
  • Reload the module with SAA716x based cards:
~/media_build $ sudo make rmmod
~/media_build $ sudo modprobe saa716x_budget int_type=1
  • The lazy way, just reboot:
sudo reboot


Checking that modules loaded properly

The following examples are given for both CX23885 and SAA716x based cards.

  • For CX23885 based cards:
dmesg | grep 'DVB: registering'
[19.421423] dvbdev: DVB: registering new adapter (cx88[0])
[19.421432] cx88-mpeg driver manager 0000:04:01.2: DVB: registering adapter 0 frontend 0 (TurboSight TBS 8922 DVB-S/S2)...
[19.528979] dvbdev: DVB: registering new adapter (cx88[1])
[19.528989] cx88-mpeg driver manager 0000:04:02.2: DVB: registering adapter 1 frontend 0 (TurboSight TBS 8922 DVB-S/S2)...
sudo lspci -v | grep --after-context=10 CX2388
04:01.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
       Subsystem: Device 8922:8888
       Flags: bus master, medium devsel, latency 32, IRQ 22
       Memory at fa000000 (32-bit, non-prefetchable) [size=16M]
       Capabilities: [44] Vital Product Data
       Capabilities: [4c] Power Management version 2
       Kernel driver in use: cx8800
       Kernel modules: cx8800
  • For SAA716x based cards:
dmesg | grep 'DVB: registering'
[19659.585518] DVB: registering new adapter (SAA716x dvb adapter)
[19660.201340] SAA716x Budget 0000:02:00.0: DVB: registering adapter 0 frontend 0 (Sony CXD2820R)...
[19660.202234] DVB: registering new adapter (SAA716x dvb adapter)
[19660.212991] SAA716x Budget 0000:02:00.0: DVB: registering adapter 1 frontend 0 (Sony CXD2820R)...
sudo lspci -v | grep --after-context=10 7160
04:00.0 Multimedia controller: Philips Semiconductors SAA7160 (rev 03)
       Subsystem: Device 6280:0011
       Flags: bus master, fast devsel, latency 0, IRQ 18
       Memory at e0300000 (64-bit, non-prefetchable) [size=1M]
       Capabilities: [40] MSI: Enable- Count=1/32 Maskable- 64bit+
       Capabilities: [50] Express Endpoint, MSI 00
       Capabilities: [74] Power Management version 2
       Capabilities: [80] Vendor Specific Information: Len=50 <?>
       Capabilities: [100] Vendor Specific Information: ID=0000 Rev=0 Len=088 <?>
       Kernel driver in use: SAA716x Budget
       Kernel modules: saa716x_budget

Note : "Capabilities" information are only show if you use the root account, else you will have "Capabilities: <access denied>".


You need to see the 2 following lines that show that the driver for the TBS TV card is loaded :

  • For CX23885 based cards:
       Kernel driver in use: cx8800
       Kernel modules: cx8800
  • For SAA716x based cards:
       Kernel driver in use: SAA716x Budget
       Kernel modules: saa716x_budget 


Checking that dvb adaptor nodes have been created

If the cx88_dvb or SAA716x drivers are loaded, the dvb adaptor nodes should now exist

ls -al /dev/dvb
drwxr-xr-x  4 root root   80 oct.  23 08:37 ./
drwxr-xr-x 19 root root 4140 oct.  23 08:40 ../
drwxr-xr-x  2 root root  120 oct.  23 08:37 adapter0/
drwxr-xr-x  2 root root  120 oct.  23 08:37 adapter1/


In case you have the dvb-apps package installed, you can double check with the lsdvb tool.

  • Output example with a CX23885 based card:
sudo lsdvb
               lsdvb: Simple utility to list PCI/PCIe DVB devices
               Version: 0.0.4
               Copyright (C) Manu Abraham

cx88-mpeg driver manager (14:8802 8922:8888) on PCI Domain:0 Bus:4 Device:2 Function:2
       DEVICE:0 ADAPTER:1 FRONTEND:0 (TurboSight TBS 8922 DVB-S/S2) 
                FE_QPSK Fmin=950MHz Fmax=2150MHz
       DEVICE:0 ADAPTER:0 FRONTEND:0 (TurboSight TBS 8922 DVB-S/S2) 
                FE_QPSK Fmin=950MHz Fmax=2150MHz
  • Output example with a SAA716x based card:
sudo lsdvb
               lsdvb: Simple utility to list PCI/PCIe DVB devices
               Version: 0.0.4
               Copyright (C) Manu Abraham

SAA716x Budget (1131:7160 6280:11) on PCI Domain:0 Bus:4 Device:0 Function:0
       DEVICE:0 ADAPTER:0 FRONTEND:0 (Sony CXD2820R) 
                FE_OFDM Fmin=48MHz Fmax=864MHz
       DEVICE:0 ADAPTER:1 FRONTEND:0 (Sony CXD2820R) 
                FE_OFDM Fmin=48MHz Fmax=864MHz


Confirming the presence of the required modules in the kernel

We can see the driver modules needed by TBS TV card:

for SAA716x based cards: saa716x_budget, tda18212, cxd2820r...
for CX23885 based cards: cx88_dvb, av201x, tas2101..
  • Output example with a CX23885 based card:
sudo lsmod
Module                  Size  Used by
...
av201x                 16384  2
cx88_dvb               36864  0
tas2101                20480  3 cx88_dvb
cx88_vp3054_i2c        16384  1 cx88_dvb
...
videobuf2_dvb          16384  1 cx88_dvb
dvb_core              122880  2 videobuf2_dvb,cx88_dvb
i2c_mux                16384  1 tas2101
videobuf2_vmalloc      16384  1 dvb_core
rc_tbs_nec             16384  0
cx8802                 20480  1 cx88_dvb
cx8800                 28672  0
cx88xx                 81920  3 cx88_dvb,cx8802,cx8800
videobuf2_dma_sg       16384  2 cx88_dvb,cx8800
videobuf2_memops       16384  2 videobuf2_dma_sg,videobuf2_vmalloc
tveeprom               20480  1 cx88xx
videobuf2_v4l2         24576  2 cx88_dvb,cx8800
rc_core                40960  4 cx88xx,rc_tbs_nec
v4l2_common            16384  2 cx88xx,cx8800
videobuf2_common       49152  7 videobuf2_dvb,cx88_dvb,dvb_core,cx8802,cx88xx,videobuf2_v4l2,cx8800
videodev              163840  5 v4l2_common,videobuf2_common,cx88xx,videobuf2_v4l2,cx8800
mc                     40960  4 videobuf2_common,videodev,dvb_core,videobuf2_v4l2
...
i2c_algo_bit           16384  3 cx88_vp3054_i2c,cx88xx,i915
  • Output example with a SAA716x based card:
sudo lsmod
Module                  Size  Used by
...
tda18212               13180  2 
regmap_i2c             12915  1 tda18212
...
saa716x_budget         34859  0 
tas2101                19952  1 saa716x_budget
cxd2820r               31562  1 saa716x_budget
mb86a16                27647  1 saa716x_budget
cx24117                25174  1 saa716x_budget
saa716x_core           71005  1 saa716x_budget
stv090x                70354  1 saa716x_budget
dvb_core              117590  3 saa716x_core,saa716x_budget,cxd2820r
i2c_mux                12896  1 tas2101
...
i2c_core               40643  19 drm,i2c_i801,i2c_mux,saa716x_core,mb86a16,saa716x_budget,regmap_i2c,tas2101,i2c_algo_bit,stv090x,cxd2820r,nvidia,v4l2_common,tveeprom,tda18212,videode


Troubleshooting

If you find module load errors like "module has wrong symbol version" means that there still are old modules from your previous media tree installation (usually duplicated modules in two different places). The brute-force approach is to simply do:

sudo rm -rf /lib/modules/`uname -r`/kernel/drivers/media/*

Other workarounds may be offered on the aforementioned authors' wiki pages on Github, and on TBS' forum, depending on specific problems reported by users.


Upgrading sources and re-installing

cd ljalves-tbsdriver

or

cd tbsdriver

then

cd media
git remote update
git pull
cd ../media_build
git remote update
git pull
make
sudo make install

You should now unload/reload the modules manually or simply reboot.


Specific instructions to saa716x based cards owners

If your card uses the saa716x_budget kernel module, you need to set up the configuration options persistantly for it. Start with checkinh if the configuration has already been added using:

grep saa716x /etc/modprobe.d/*

You will see something like this if it is:

/etc/modprobe.d/saa716x_budget.conf:options saa716x_budget int_type=1

If it is not there, create a file containing the config:

sudo sh -c 'echo options saa716x_budget int_type=1 > /etc/modprobe.d/saa716x_budget.conf'

See also TBS_driver_installation#IRQ_Issues for module config of the closed source drivers.


Supporting the open-source driver

Any help that you can give to Luis or crazycat69 (another contributor to the project) through testing, patches or getting the driver merged into the upstream code will (hopefully) be appreciated.

Luis also has a donate link on github.


Closed-source drivers

Proprietary drivers are available from the TBS dtv website or TBS iptv website.

However, TBS advises to choose the open-source driver for each of the hardware supported by them.


Installing drivers

As of 11 September 2017, the latest version is 170330

Version 170330 compiles cleanly on gentoo linux kernels "gentoo-sources-4.9.<x>". gentoo-sources-4.11 and newer give missing symbols.


0. Download the drivers


1. Extract the ZIP file tbs-linux-drivers_v[VERSION NUMBER].zip.

mkdir tbs-linux-drivers
cd tbs-linux-drivers
unzip ../tbs-linux-drivers_v[VERSION_NUMBER].zip


The directory tbs-linux-drivers will now contain README_* for various TBS-cards, check for your options (combinations of DVB-T/T2/S/C wil require various adjustments). The procedure below is a summary of those READMEs, as well as some hints/caveats. The directory will also contain linux-tbs-drivers.tar.bz2 which has v4l modules meant to be compiled out-of-tree from the kernel you are actually running. Source for your currently running kernel should be installed before attempting build. Search the files for the string 'uname -r' if you are not happy with that.


2. Extract linux-tbs-drivers.tar.bz2 archive

bzcat linux-tbs-drivers.tar.bz2 | tar xv


3. Change to driver package directory

We also need to correct some strange file & directory permissions.

cd linux-tbs-drivers
sudo chown -R $USER:$USER .
find -type d -exec chmod u+x {} \;
find ./v4l/scripts -exec chmod u+x {} \;


4. Select platform architecture

This will rename arch-specific blobs to '*.o' so that the module-build will find them.

for x86 kernel 3.x (x86 32 bit installations of kernel 3.x)

./v4l/tbs-x86_r3.sh

or for x86 kernel 2.6.x (x86 32 bit installations of kernel 2.6.x)

./v4l/tbs-x86.sh

or for any x86_64 kernel (x86 64 bit installations of Linux)

./v4l/tbs-x86_64.sh

You should then receive a message along these lines:

TBS drivers configured for [NAME OF PLATFORM] platform.


5. Build the driver.

Recompiles v4l for a wide range of cards, currently about 500; will take many minutes.

We're ready to build; add -j3 parameter for make command line for a faster build on a dual core machine, -j5 on a quad core machine, etc.

make

If you get -bash: make: command not found, then sudo apt-get install build-essential


6. Install driver. Existing drivers for other v4l related hardware, such as lirc could also get updated.

sudo make install


7. Load newly installed driver

sudo modprobe -v tbs62x0fe


8. Check it loaded correctly

tail /var/log/syslog

You should get a message about tainting the kernel. This is fine.

kernel: tbs62x0fe: module license 'TurboSight Proprietary' taints kernel.

Running dmesg | tail should end with something along these lines:

[7330.361868] tbs62x0fe: module license 'TurboSight Proprietary' taints kernel.
[7330.361875] Disabling lock debugging due to kernel taint

dvb adaptor nodes should now exist

ls -al /dev/dvb 
drwxr-xr-x  2 root root  120 Jul  9 21:12 adapter0
drwxr-xr-x  2 root root  120 Jul  9 21:12 adapter1
drwxr-xr-x  2 root root  120 Jul  9 21:12 adapter2
drwxr-xr-x  2 root root  120 Jul  9 21:12 adapter3
sudo lsdvb
               lsdvb: Simple utility to list PCI/PCIe DVB devices
               Version: 0.0.4
               Copyright (C) Manu Abraham
SAA716x TBS (1131:7160 6280:11) on PCI Domain:0 Bus:4 Device:0 Function:0
       DEVICE:0 ADAPTER:0 FRONTEND:0 (TurboSight TBS 62x0 DVBT/T2 frontend) 
                FE_OFDM Fmin=47MHz Fmax=870MHz
       DEVICE:0 ADAPTER:1 FRONTEND:0 (TurboSight TBS 62x0 DVBT/T2 frontend) 
                FE_OFDM Fmin=47MHz Fmax=870MHz


Troubleshooting

Compilation problems

make[3]: *** No rule to make target `tbs8921ctrl.o', needed by `v4l/media.o'.  Stop.

Did you select the correct platform in step 4 above?

During compilation:

make[1]: *** No rule to make target `.myconfig', needed by `config-compat.h'. Stop.

Make sure you have the right C header files installed for your Linux kernel version.


Problems after kernel update

Some weeks later your /dev/dvb directory has disappeared? Perhaps your kernel was updated, and your machine rebooted. The driver needs to be recompiled.

If you just run make, it will try to compile against the old kernel headers, so first run

make distclean

Then go back to step 4.


Deleting media drivers directory to resolve conflicts

Some users have found that deleting the whole kernel media drivers folder (i.e. /lib/modules/`uname -r`/kernel/drivers/media ) and then compiling can resolve conflicts.

This process will fix issues resulting in "disagrees about version of symbol dvb_frontend_detach" messages in the dmesg output.

Normally it should be enough to make sure that you recompile the tbs drivers after every kernel build.

Instructions for this can be found in the TBS forum. They are as follows:

  1. First remove the existing media modules:
    sudo rm -rf /lib/modules/$(uname -r)/kernel/drivers/media/
  2. Then reinstall the modules, following steps 3 and 6 above.


Compatibility with other cards

As noted above you should remove the kernel's existing media drivers before installing the TBS driver package, I omitted this step when installing the drivers and whilst the card worked fine (Mythtv 0.27/Debian 7) my other DVB-S2 tuner card would fail to initialize on start up. There were no obvious messages in the dmesg output indicating symbol issues, the card simply wouldn't work. Once I removed the media directory before installing the TBS drivers the card worked correctly. (The driver in the v4l tree used by the TBS drivers was actually a different name than the one in the Linux kernel I had installed).

Fighting with another tuner card in load order at boot time - See http://www.tbsdtv.com/forum/viewtopic.php?f=62&t=7747. Additionally it's worth noting that the TBS drivers don't appear to support the 'adapter_nr' argument.

Fix UDEV problems :
Device nodes and character devices
Notes for configuring udev rules for em28xx USB capture card
Linux: howto avoid video devices getting mixed up after reboot, using udev rules
About udev rules
Statically Assign /dev Nodes to Hardware Devices in Linux
/dev/video0 problem


IRQ Issues

After an extended period the combined TBS driver may crash with messages (check using dmesg) such as:

irq 16: nobody cared (try booting with the "irqpoll" option)
...
Disabling IRQ #16

This will render the device inoperable until rebooting (including IR receiver), meaning it won't be able to record anything.

This can be resolved by configuring the driver to use MSI instead of IRQ:

sudo sh -c 'echo options saa716x_tbs_dvb int_type=1 > /etc/modprobe.d/tbs.conf'

If you have a newer TBS card such as a TBS6905, or a mix of older and newer ones, then you need TWO lines in /etc/modprobe.d/tbs.conf:

options tbs_pcie-dvb tbs_int_type=1
options saa716x_tbs-dvb int_type=1

See this TBS forum thread and this blog post for more details.


IR-receiver malfunctions

Some TBS devices have an infrared receiver, that may send spurious keypresses. They are hooked into the kernel as normal input (keyboards).

[13.760749] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:03.0/0000:01:00.0/usb3/3-2/input/input8
[15.783470] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:03.0/0000:01:00.0/usb3/3-2/input/input9

To disable the remote control edit /etc/modprobe.d/dvbt.conf to read:

options dvb-usb disable_rc_polling=1

And reload `dvb-usb`, or reboot.


Remap IR-remote keys

Another problem might be that the keypress received from the remote do not match your software. You can rewrite what keys the keypresses map to with `input-events`, `input-kbd`, `lsinput`.

sudo apt install input-utils
sudo lsinput
sudo input-kbd 2
sudo input-events 2
man input-kbd
man input-events

sudo input-kbd 2 > my-keys
nano my-keys
sudo input-kbd -f ./my-keys 2


Changelog

Old releases for drivers if you have problem with your kernel:

  • v151229

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v151229.zip

  • v141019 (2014-10-19)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v141019.zip

Changelog :
TBS6280 Linux Driver is updated to v141019., which has below updating:
* Fix numerous bugs from the previous release
  • v140707 (2014-07-07)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v140707.zip

Changelog :
TBS6280 Linux Driver is updated to v140707., which has below updating:
* improve work of TBS 5990
* add support for latest hardware revisions of TBS 5220, TBS 5881, TBS 5281
* numerous improvements in bug fixes in drivers for TBS 6221, TBS6281, TBS 6285 and TBS 6290
  • v140425 (2014-04-25)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v140425.zip

Changelog :
TBS6280 Linux Driver is updated to v140425., which has below updating:
* Fixed the TBS6928SE ID problem
  • v140323 (2014-03-23)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v140323.zip

Changelog :
TBS6280 Linux Driver is updated to v140323., which has below updating:
* Add support for 5922SE
* Add proper support for retail version of 6922SE
* Add T2 lite support for latest hardware revision of 6221, 6281, 6285
* Add "ClearQAM" (J83B) US Digital Cable support to DVB-C driver for latest T2 lite hardware revision of 6221, 6281, 6285
  • v140113 (2014-01-13)

http://tbsdtv.com/download/document/common/tbs-linux-drivers_v140113.zip

Changelog :
TBS6280 Linux Driver is updated to v140113, which has below updating: 
* Improve compatibility with the upcoming Linux kernel 3.13.x
* Add full support (both DVBT/T2 and DVBC are supported) for TBS 5281 
  • v130927 (2013-09-27)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v130927.zip

Changelog :
TBS6280 Linux Driver is updated to v130927, which has below updating:
* Add DVB-C driver for TBS 6221, 6281, 6285, 5220, 5881
* Finalize DVB-T/T2 driver for TBS 6221, 6281, 6285, 5220, 5881
* Improve software compatibility for all DVB-C products
* Improve software compatibility for all DVB-T/T2 products
* Make power control for TBS 6984 more reliable
  • v130802 (2013-08-02)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v130802.zip

Changelog :
TBS6280 Linux Driver is updated to v130802, which has below updating:
* improve compatibility with Linux kernel version 3.10
* preliminary support for Linux kernel version 3.11
* add support for all revisions of TBS 6982
* add support for all revisions of TBS 6928SE
* add PLP (Physical Layer Pipe) support for 6220, 6280, 6284 (PLP, see http://en.wikipedia.org/wiki/DVB-T2#Technical_details)
* fix bug for DVB-C products (TBS 6618, TBS 6680, TBS 5680 and DVB-C USB Stick): improve performance in some DVB-C networks
  • v130506 (2013-05-06)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v130506.zip

Changelog :
TBS6280 Linux Driver is updated to v130506, which has below updating:
* Further improve compatibility with 32-bit Linux kernels version 3.8.x and 3.9.x.
* Add module parameter "enable_ir" that allows disabling IR support for TBS cards.
  • v121119 (2012-11-19)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v121119.zip

Changelog :
TBS6280 Linux Driver is updated to v121119, which has belowed updating:
* Add support for dBm reporting with TBS 6922.
* Improve performance of TBS 6922 and TBS 6985 in case lock can't be acquired.
  • v120617 (2012-06-17)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v120617.zip

Changelog :
TBS6280 linux driver is updated to v120617:
A) Add driver and software downloand for TBS5880.
B) Add DVB-C driver support for TBS6220, TBS6280 and TBS6284.
  • v120503 (2012-05-03)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v120503.zip

Changelog :
BS6280 linux driver is updated to v120503:
A) Add driver and software downloand for TBS5880.
B) Add DVB-C driver support for TBS6220, TBS6280 and TBS6284.
  • v120412 (2012-04-12)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v120412.zip

Changelog :
TBS6280 linux driver is updated to v120412, any Linux kernel version in the range 2.6.31 to 3.2.x and any Linux distribution is supported.
  • v120216 (2012-02-16)

http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v120216.zip

Changelog :
TBS6280 linux driver is updated to v120216, any Linux kernel version in the range 2.6.31 to 3.2.x and any Linux distribution is supported.