# How to configure the TwinHan VisionPlus 1020 DVB-S TV Card

## Auka

** Edit: **

2004-07-11: added devfs & udev

2004-10-06: Updated the device node script as recent kernel versions changed the device number from 250 to 212.

2005-04-17: updated kernel configuration for >2.6.9 kernels. Added link to patch from linuxtv.org.

 Note: the kernel parameter for the dst module apparently has changed. I have to fiddle with this as soon as I find a bit of free time. Does anyone know more?

How to install/configure the TwinHan VisionPlus 1020 DVB-S TV Card on linux

The VisionPlus DVB-S card is a PCI DVB-S (i.e. digital satellite) TV card. As it just sends mpeg streams over the PCI bus and depends on you CPU decoding it, it is quite cheap (you can get on for about < 50-60  here in Germany). Two weeks ago I finally managed to use mine in Gentoo Linux - got rid of the last good reason for booting into that certain other "OS"...  :Smile: 

Now that I know how long I had to fiddle and search until I got that thing working I thought I'd write up a short Howto.

1.) Kernel configuration

The worst problem that one faces when configuring the card is probably that as long as you don't specify exactly the right driver parameters the kernel and so your computer will hard lock up completely.  (As far as I remember this is because of some i2c scanning issues...) 

Because of this do not, repeat do NOT compile the drivers into your kernel but use modules! Also always keep a second working kernel configuration in you bootloader...  :Wink: 

This is the kernel configuration part, based on kernel 2.6.5:

```
Device Drivers -> Multimedia Devices:

[*] Video for Linux

     Video for Linux-->

            <M> BT848 Video For Linux

            <M> Conexant 2388x (bt878 successor) support

     Digital Video Broadcasting Devices  --->

         [*] DVB For Linux

         <*>   DVB Core

          ---   Supported Frontend Modules

          <M> TWINHAN DST based DVB-S frontend (QPSK)

          --- Supported BT878 Adapters

          <M> Nebula/Pinnacle PCTV PCI cards

```

For more current 2.6 kernels (>=2.6.9) the kernel configuration has changed a bit:

```
Device Drivers -> Multimedia Devices:

[*] Video for Linux

     Video For Linux  --->

          --- Video Adapters

          <M> BT848 Video For Linux

          ...

          <M> Conexant 2388x (bt878 successor) support

     Digital Video Broadcasting Devices  --->

          [*] DVB For Linux

          <*>   DVB Core Support

           ---     Supported BT878 Adapters

           <M>     Nebula/Pinnacle PCTV/Twinhan PCI cards

           --- DVB-S (satellite) frontends

          //** Note: I added all DVB-S frontends. Have to reduce this sometime. ;-)

             *  Does anyone already know which ones are needed?

```

For 2.6.11.x kernels you'll need this patch - thanks to Robert K. for finding this.

Add this to /etc/modules.autoload.d/kernel-2.6:

```
video-buf

bttv i2c_hw=1 card=0x71

bt878

dst dst_type_flags=4

dvb-bt8xx

```

Now this is the tricky and most important part - the card parameter for the bttv module! It basically tells the driver that we have a DST VisionPlus card. 

For details please consult: /usr/src/linux/Documentation/video4linux/CARDLIST.bttv also have a look at the other documentation files there!

lsmod:

```
Module                  Size  Used by

dvb_bt8xx               7748  0

dst                    14220  1

bt878                  11188  2 dvb_bt8xx,dst

tuner                  17356  0

bttv                  147692  3 dvb_bt8xx,bt878

btcx_risc               4744  1 bttv

video_buf              20804  1 bttv

```

dmesg should look similar to this:

```
bttv: driver version 0.9.12 loaded

bttv: using 8 buffers with 2080k (520 pages) each for capture

bttv: Bt8xx card found (0).

bttv0: Bt878 (rev 17) at 0000:01:08.0, irq: 11, latency: 84, mmio: 0xd8000000

bttv0: using: Twinhan DST + clones [card=113,insmod option]

bttv0: gpio: en=00000000, out=00000000 in=00f5fffe [init]

bttv0: using tuner=4

bttv0: add subdevice "dvb0"

bt878: AUDIO driver version 0.0.0 loaded

bt878: Bt878 AUDIO function found (0).

bt878(0): Bt878 (rev 17) at 01:08.1, irq: 11, latency: 84, memory: 0xd8001000

attach: checking "bt878 #0 [hw]"

find by pci: checking "bt878 #0 [hw]"

attach: "bt878 #0 [hw]", to card 0

DVB: registering new adapter (DST).

bt878 find by dvb adap: checking "DST"

dst_check_ci: recognize DST-020

DST type : satellite

dst_check_ci: user override dst type flags 0x4

DST type flags : 0x4 symdiv

DVB: registering frontend 0:0 (DST SAT)...

```

2.) Userspace 

As soon as you have the drivers working you're almost there. 

  2.1) if you are using devfs

Using devfs you should have a /dev/dvb/adapter0/ directory with the card's devices:

```
demux0  dvr0  frontend0  net0
```

As there was none, I then created a link /dev/video0 to the card's device:

```
cd /dev/; ln -s ./dvb/adapter0/dvr0 video0
```

.

  2.2) if you are using udev

As of current status (2004-07-11 and kernel 2.6.8_rc1) you need to manually create a few devices (code below is stolen from linuxtv's MAKEDEV-DVB.sh script)

```

# get rid of old DVB API devices; do it twice for good measure...

rm -rf /dev/ost

rm -rf /dev/ost

rm -rf /dev/dvb

rm -rf /dev/dvb

mkdir /dev/dvb

chmod 755 /dev/dvb

for i in `seq 0 3`; do

        echo "Creating DVB devices in /dev/dvb/adapter$i"

        mkdir /dev/dvb/adapter$i

        chmod 755 /dev/dvb/adapter$i

        mknod -m 0664 /dev/dvb/adapter$i/video0    c 212   `expr 64 \* $i + 0`

        mknod -m 0664 /dev/dvb/adapter$i/audio0    c 212   `expr 64 \* $i + 1`

        mknod -m 0664 /dev/dvb/adapter$i/frontend0 c 212   `expr 64 \* $i + 3`

        mknod -m 0664 /dev/dvb/adapter$i/demux0    c 212   `expr 64 \* $i + 4`

        mknod -m 0664 /dev/dvb/adapter$i/dvr0      c 212  `expr 64 \* $i + 5`

        mknod -m 0664 /dev/dvb/adapter$i/ca0       c 212   `expr 64 \* $i + 6`

        mknod -m 0664 /dev/dvb/adapter$i/net0      c 212   `expr 64 \* $i + 7`

        mknod -m 0664 /dev/dvb/adapter$i/osd0      c 212   `expr 64 \* $i + 8`

        chown root.video /dev/dvb/adapter$i/*

done
```

add the following line to /etc/udev/permissions/50-udev.permissions.

```
dvb/adapter*/*:root:video:0660
```

and to /etc/udev/rules.d/50-udev.rules

```
SYSFS{adap}="adapter*", NAME="dvb/adapter%n/%k"
```

  2.3) Tools

Unfortunately Gentoo does not provide up-to-date linuxtv-dvb packages. You can find updates ebuild on BerliOS, I currently don't have the link but search the forums and you'll find it.) But luckily we don't need these.

What we do need are just the szap and scan utilities and they are no longer included in the package installed by the ebuild anyway. There is a separate package which can be found here on www.linux-tv.org

just download, extract and compile the szap and scan binaries 

```
cd ./util/szap; make

cd ../scan; make
```

 Unfortunately there doesn't seem to be an ebuild for this. Maybe when I'll find some time...  :Wink: 

The first one is used to generate a channels.conf and the second tool is used to switch between channels. Please do consult the READMEs! 

  2.4) Xine

```
./scan dvb-s/Astra-19.2E | tee mychannels.conf
```

Once you have a (my)channels.conf copy it or one of the examples from the "szap" directory to ~/.xine/: 

```
cp channels.conf ~/.xine/channels.conf
```

Now check that you have got the DVB Useflag set, and (re)merge xine with DVB support.   

```
USE="dvb" emerge xine-lib xine-ui
```

 to (re-)emerge 

To improve playback for xine or mplayer you can add this to /etc/sysctrl.conf (optionally but recommended): 

```
 

# media playback (mplayer, xine tv etc.)

dev.rtc.max-user-freq=1024
```

Now when you start xine, you should be able to watch TV by choosing "DVB" as source. (check settings for correct device) To switch channels use "Page UP" and "Page Down" Key to switch channels in the OSD, "Enter" selects a new channel.

Hint: Enable deinterlacing (I'd suggest "bob" as deinterlace method which seemed to work best for me).

Much to my surprise I found the image quality to be even better than when using it under windows. (No clue why, maybe it's just xine *g*) On the other hand switching between channels takes much longer when using xine .  :Sad: 

3.) ToDo

I didn't manage to get some other TV programs such as kdetv or tvtime working or to record. So far I was quite happy that watching tv using xine works...   :Wink: Last edited by Auka on Sun Apr 17, 2005 10:12 am; edited 8 times in total

----------

## chinesebob

Thanks Auka! 

This was very helpful, it certainly sped things up for me.

Too bad udev support isn't ready, I guess we'll

just have to wait a while.

----------

## skyfolly

auka, ever get soft cam or perhaps other dvb plugins work in Linux?

Do you think dvb software running under Linux is stable?

----------

## Auka

No, sorrry, never tried those things.  :Wink: 

(At the moment even my xine is again making trouble refusing playback... :-/)

----------

## skyfolly

shoot, I thought i replied this post already.

i am going to buy a new 1030A dvb card. I will try and use that 1020 on linux when it arrived. too bad there is not enough support on linux.

EDIT: That DreamBox 7000S is using Linux Embbeded, how come DVB CARD is not well supported?

----------

## Auka

FYI

Seems like there is a problem with current kernel versions (at least 2.6.10_rcX) and the driver. Not even szap works. (But does work fine on older kernel versions...)

```
./szap -c ./channels.conf-dvbs-astra ZDF

reading channels from file './channels.conf-dvbs-astra'

zapping to 2 'ZDF':

sat 0, frequency = 11954 MHz H, symbolrate 27500000, vpid = 0x006e, apid = 0x0078

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'

opening frontend failed: No such devicec
```

----------

## Luxus

you have to add the right frontends to your kernel

for me it works with my skystar2 and 2.6.10 kernel

----------

## skyfolly

i think i will stick my card to windows xp. lol.

----------

## phate

There is a problem... I do not have a "DVB" switch in "emerge -pv xine-lib"  :Sad: 

So my xine does not have DVB support and I get following Error:

```
Error: there is no output plugin able to handle DVB://. Maybe the MRL syntax is wrong or file/stream source doesn't exist.
```

----------

## obrut<-

same problem here!  :Sad: 

no "dvb" use flag for xine-lib. kaffeine refuses to give me dvb-support, too. on my notebook xine works great with dvb and kaffeine has dvb-support, but it hangs when trying to tune a channel.

edit:

i have a terratec cinergy t² (usb2.0 dvb-t adapter)

----------

## prolific

anyone know if twinhan 102g cards work in linux ?

----------

## Jovana

 *prolific wrote:*   

> anyone know if twinhan 102g cards work in linux ?

 

Has the card the Bt878 chip? Than it will work.

----------

## Alexandr

my TwinHan 1022A working fine on 2.6.15-gentoo-r5 kernel, even without patch

tanx for guide

----------

## cyberfloatie

I've been trying to work through this but have not had much success with my Twinhan 1020a.  Has anyone else managed to get theirs working under 2.6.20r8?  I've got the kernel compiled successfully but the screens differ somewhat from those mentioned Auka's post.  As a result, I don't have the modules he listed.  Here's what I do have:

localhost ~ # find /lib/modules/2.6.20-gentoo-r8/ -type f -iname '*.o' -or -iname '*.ko'

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/isl6421.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/lgh06xf.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/cx22702.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/mt352.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/ves1x93.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/stv0299.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/s5h1420.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/cx24110.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/lgdt330x.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/or51132.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/tda8083.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/dvb-pll.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/cx24123.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/zl10353.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/tda10086.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/mt312.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/frontends/nxt200x.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/dvb/dvb-core/dvb-core.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/common/ir-common.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/v4l1-compat.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx8802.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx88xx.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx8800.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx88-dvb.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx88-blackbird.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx88/cx88-vp3054-i2c.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/tveeprom.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/v4l2-common.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/cx2341x.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/tuner.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/compat_ioctl32.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/videodev.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/video-buf-dvb.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/vivi.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/video-buf.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/media/video/btcx-risc.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/i2c-core.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/i2c-dev.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/busses/i2c-piix4.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/algos/i2c-algo-bit.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/algos/i2c-algo-pcf.ko

/lib/modules/2.6.20-gentoo-r8/kernel/drivers/i2c/algos/i2c-algo-pca.ko

Any suggestions?

----------

## cyberfloatie

A quick follow-up to my last post... here's what dmesg shows after I added all those modules to the autoload.

piix4_smbus 0000:00:02.3: Found 0000:00:02.3 device

piix4_smbus 0000:00:02.3: IBM system detected; this module may corrupt your serial eeprom! Refusing to load module!

piix4_smbus: probe of 0000:00:02.3 failed with error -1

EXT3 FS on hda3, internal journal

Linux video capture interface: v2.00

cx2388x cx88-mpeg Driver Manager version 0.0.6 loaded

cx2388x dvb driver version 0.0.6 loaded

cx8802_register_driver() ->registering driver type=dvb access=shared

cx2388x v4l2 driver version 0.0.6 loaded

cx2388x dvb driver version 0.0.6 loaded

cx8802_register_driver() ->registering driver type=dvb access=shared

cx2388x blackbird driver version 0.0.6 loaded

cx8802_register_driver() ->registering driver type=blackbird access=shared

videodev: "vivi" has no release callback. Please fix your driver for proper sysfs support, see http://lwn.net/Articles/36850/

Video Technology Magazine Virtual Video Capture Board (Load status: 0)

i2c /dev entries driver

----------

