TBS driver installation

From LinuxTVWiki
Revision as of 13:31, 3 January 2016 by Richvdh (talk | contribs) (Add open-source drivers)
Jump to navigation Jump to search

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

Open-source drivers

The open source driver is available here. These instructions are taken directly from those pages.

It 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 official TBS 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

These instructions are taken from here:

 git clone git://linuxtv.org/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

Loading the Modules

The simplest option is to reboot, but if you would rather not, execute these commands:

 sudo make rmmod
 sudo modprobe saa716x_budget int_type=1

Identification / Check module loaded correctly

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

With kernel 3.14.24 and Mageia Linux.

# 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

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

       Kernel driver in use: SAA716x Budget
       Kernel modules: saa716x_budget 

Check if dvb adaptor nodes are created

Now, if the SAA716x driver is 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/
# 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

Linux kernel modules loaded

  • DVB Tuner card part only

We can saw the driver modules needed by TBS TV card : saa716x_budget, tda18212, cxd2820r.

# lsmod
...
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).

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

Upgrading Sources and Re-installing

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

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

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 website.

1. Extract the ZIP file tbs-linux-drivers_v[VERSION NUMBER].zip. As of 5 April 2015, the latest version is 150313. You may want to do this in an empty directory as this archive does not extract into a single root directory of its own.

unp -u tbs-linux-drivers_v140113.zip

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

unp linux-tbs-drivers.tar.bz2

3. Change to driver package directory

cd linux-tbs-drivers

4. Select platform architecture

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 485. This will take many minutes.

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

insmod /lib/modules/3.(your kernel version)-generic/kernel/drivers/media/dvb/frontends/tbs62x0fe.ko

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

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?

Fighting with another tuner card in load order at boot time - http://www.tbsdtv.com/forum/viewtopic.php?f=62&t=7747

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 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.

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).

Additionally it's worth noting that the TBS drivers don't appear to support the 'adapter_nr' argument.

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.