Leadtek WinFast DTV2000DS

From LinuxTVWiki
Revision as of 01:29, 8 September 2012 by Cloggy (Talk | contribs)

Jump to: navigation, search
Leadtek dtv 2000ds 2s.jpg
Leadtek dtv 2000ds 3s.jpg
Leadtek dtv 2000ds 4s.jpg

A dual tuner DVB-T PCI card from Leadtek.

Currently supported by recent V4L-DVB (as at Sep 2010) The card is not working out of the box, however there is a solution (patch to V4L really).

Your mileage may vary. There are still some issues in using this card; please read on.


Overview/Features

Formats:

  • DVB-T

Inputs:

  • RF
  • Infrared

Components Used

Contains

  • NXP TDA18211

or

  • TDA18271HD/C2

Identification

Output of lsusb -v:

Bus 002 Device 002: ID 0413:6a04 Leadtek Research, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0413 Leadtek Research, Inc.
  idProduct          0x6a04
  bcdDevice            2.00
  iManufacturer           1 Afatech
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Making it work in Ubuntu

Updated 24 June 2012

I made a simple GUI which installs Leadtek DTV2000DS, configures the remote control for Mythtv and fixes the missing second tuner.

https://github.com/map7/tvconfig

Updated 29 October 2011 by Mrgrrr

Running Mythbuntu 11.10 the card works on this kernel but need the firmware bellow sudo apt-get install linux-firmware-nonfree

In Brisbane I have had odd results with channel 9, first time showing this station fails to lock but after checking other channels it then works.

Enjoy


Updated 14 May 2011 by BenWise.

Two channel tuning on this card (at least) now works out of the box on kernel 2.6.38 (taken from Ubuntu PPA).

I use Mythbuntu 10.04.

To upgrade Mythbuntu 10.04 to use 2.6.38 kernel:

# get the firmware version 4.95
sudo apt-get install linux-firmware-nonfree
# upgrade kernel to 2.6.38 
sudo add-apt-repository ppa:kernel-ppa/ppa
sudo apt-get update
sudo apt-get install linux-headers-2.6.38-1-generic linux-image-2.6.38-1-generic

Then shut down your computer (important if you've been trying to load this card already, as the correct firmware will be loaded) and turn it on again... You should have the card operating correctly now.

I expect this means the card is supported out of the box on 11.04 (as it uses 2.6.38 kernel) but haven't tested this yet.


Updated 20 Nov 2010 by AMX.

Here is a simple HOWTO/Workaround to get this card working . This is based on debian flavours. Although there are some people that have come up with shell scrips and patches to get something similar, it is better that everyone knows how things are done, and also hopefully this will be incorporated into the new releases of V4L. Until then we all have to sweat it a bit!!

The real solution is based on the bug found in http://www.xpmediacentre.com.au/community/tuners/41937-leadtek-dtv2000ds-4.html . There is another issue that better get fixed and it is to do with I2C byte write numbers.

Please leave comments in the discussion session or put comments in http://www.xpmediacentre.com.au/community/tuners/41937-leadtek-dtv2000ds-4.html so that we keep this updated.

1- Starting from a clean install of 10.04 or 10.10, perform the initial steps to install V4L drivers

sudo apt-get install mercurial linux-headers-$(uname -r) build-essential


2- go to http://linuxtv.org/hg/v4l-dvb/rev/abd3aac6644e and click on the "bz2" link and download the file.

Note: Here I am referring to a specific tag of the repository, i.e. abd3aac6644e. If you have recent kernels such as 2.6.36, you may need to grab the latest source rather than this particular tag. The rest of the process is still the same.


3- run

bzcat v4l-dvb-abd3aac6644e.tar.bz2 | tar xv
cd v4l-dvb-abd3aac6644e

This should create a directory called v4l-dvb-abd3aac6644e

4- Do the following modifications

4.1- The small_i2c fix: This fix is from discussions here http://www.spinics.net/lists/linux-usb/msg37741.html .

Edit the file linux/drivers/media/dvb/dvb-usb/af9015.c and replace

static struct tda18271_config af9015_tda18271_config = {
	.gate = TDA18271_GATE_DIGITAL,
	.small_i2c = 1,
};

with

static struct tda18271_config af9015_tda18271_config = {
	.gate = TDA18271_GATE_DIGITAL,
	.small_i2c = TDA18271_16_BYTE_CHUNK_INIT,
};

Then edit the file linux/drivers/media/common/tuners/tda18271.h

and replace

enum tda18271_small_i2c {
        TDA18271_39_BYTE_CHUNK_INIT = 0,
	TDA18271_16_BYTE_CHUNK_INIT = 1,
	TDA18271_08_BYTE_CHUNK_INIT = 2,

};

with

enum tda18271_small_i2c {
        TDA18271_39_BYTE_CHUNK_INIT = 0,
	TDA18271_16_BYTE_CHUNK_INIT = 16,
	TDA18271_08_BYTE_CHUNK_INIT = 8,
	TDA18271_03_BYTE_CHUNK_INIT = 3,
};


4.2- The main and the nasty bug i.e. the if_sample_freq bug: This fix is from http://www.xpmediacentre.com.au/community/tuners/41937-leadtek-dtv2000ds-4.html . If you have a quick look inside the file (just out of interest), you will notice that how this bug was messing up all the tuner frequency calculations. The frequencies are given in Table 41 in the datasheet (http://www.nxp.com/documents/data_sheet/TDA18211HD.pdf)

Anyway

edit the file linux/drivers/media/dvb/frontends/af9013.c

and replace

		/* TDA18271 uses different sampling freq for every bw */
		if (state->config.tuner == AF9013_TUNER_TDA18271) {
			switch (bw) {
			case BANDWIDTH_6_MHZ:
				if_sample_freq = 3300000; /* 3.3 MHz */
				break;
			case BANDWIDTH_7_MHZ:
				if_sample_freq = 3800000; /* 3.8 MHz */
				break;
			case BANDWIDTH_8_MHZ:
			default:
				if_sample_freq = 4300000; /* 4.3 MHz */
				break;
			}
		}

with

		/* TDA18271 uses different sampling freq for every bw */
		if (state->config.tuner == AF9013_TUNER_TDA18271) {
			switch (bw) {
			case BANDWIDTH_6_MHZ:
				if_sample_freq = 3300000; /* 3.3 MHz */
				break;
			case BANDWIDTH_7_MHZ:
				if_sample_freq = 3500000; /* 3.5 MHz */
				break;
			case BANDWIDTH_8_MHZ:
			default:
				if_sample_freq = 4000000; /* 4.0 MHz */
				break;
			}
		}


5- Compile and install the drivers

make sure you are back in the v4l-dvb-abd3aac6644e directory

make config
sed -i -e "s/FIREDTV=m/FIREDTV=n/" v4l/.config
make
sudo make install
wget http://palosaari.fi/linux/v4l-dvb/firmware/af9015/5.1.0.0/dvb-usb-af9015.fw
sudo cp dvb-usb-af9015.fw /lib/firmware

6- Shutdown (you have to shutdown)

7- Startup

8- Hopefully now your tuner is recognized and works happily. If not, double check the process, check for errors that might have been missed, and if it all fails, post to a forum.


Fix for the 5.1 Firmware

[Comments added by Ross] As per the notes added by Cloggy below the 5.1 firmware causes issues if you just follow the guide above. However there is a patch missing which enables support :) This is based on the following commit: http://linuxtv.org/hg/~anttip/af9015/rev/6904cb7bd11d

Replace linux/drivers/media/dvb/frontends/af9013_priv.h with the following file:

http://linuxtv.org/hg/~anttip/af9015/raw-file/6904cb7bd11d/linux/drivers/media/dvb/frontends/af9013_priv.h

Frequent lockups during live TV and recording of TV shows

[Comments added by Cloggy - based on Mythbuntu 10.10] Using the firmware mentioned above (5.1.0.0) on my system resulted in frequent lockups during recording or watching live TV. Mythbackend.log has entries "Poll giving up", "Device error detected" and "Stream handler died unexpectedly". The previous firmware version is more stable. To use the previous version replace the "wget" line in step 5 with:

wget http://palosaari.fi/linux/v4l-dvb/firmware/af9015/4.95.0.0/dvb-usb-af9015.fw

Remember to do a cold boot afterwards to activate this firmware, /var/log/messages should show "af9013: firmware version:4.95.0"

[Comments added by Cloggy - 14 Mar 2011 - based on Mythbuntu 10.10 / Myth 0.24]

Firmware 5.1.0.0 works fine after using fix mentioned by Ross. Still only 1 tuner working. Second tuner only works on rare occassions.

Losing 1 tuner

[Comments added by Cloggy - 30 Jun 2011 - based on Mythbuntu 11.04] I noticed that the second tuner would only work after a cold boot. After a while it would lose that tuner and the only way to get it to work again was to cold boot. This seems to be caused by power management on the USB bus. Even though it's a PCI card, it actually contains a VIA USB chip that the AF901* are connected to. Disabling the power management on the USB bus fixed this problem. Similar problem is described here for a Haupage card: http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-NOVA-T-500#Losing_one_tuner.3F

I fixed mine by adding this to /etc/init.d/rc.local:

# Turn off USB power management to keep both DVB tuners running
echo -n -1 > /sys/module/usbcore/parameters/autosuspend

[Comments added by Cloggy - 08 Sep 2012 - based on Mythbuntu 11.04] Even with the USB power management fix the problem of losing the second tuner still persisted albeit less often. Curiously, the power supply in my machine failed (a Dell OptiPlex 520 - Small Form Factor) and I connected the machine up to a bigger power supply from another machine. The second tuner has been fine for 4 weeks now without a single reboot.


Cold Boots

ATX power supplies when switched off still supply 5V to the motherboard which will keep various components and USB devices powered up so that functions like Wake on LAN can work. The 2000DS is a USB based device with a pair of USB tuners connected to the VIA USB->PCI bus interface chip. Power cycling by using the power button isn't enough in some cases to bring the malfunctioning 2000DS to a true cold boot state. To do a true cold boot (to replicate the act of pulling out a USB device) make sure the mains power cord is removed - some PSUs have a rocker switch that will do the same job - and wait about 10-20 seconds for the 5V bus to shut down completely before reapplying power. This was the only way I could get a pair of recently unresponsive 2000DS cards to start working again - the ATX power button cycling wasn't enough.

Remote Control Support

I (Gregoryo) have had no success with the remote, but there is hope from dmesg:

[   22.263721] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:0e.0/0000:02:0a.2/usb2/2-1/input/input5
user@host:~$ cat /proc/bus/input/devices
I: Bus=0003 Vendor=0413 Product=6a04 Version=0200
N: Name="IR-receiver inside an USB DVB receiver"
P: Phys=usb-0000:02:0a.2-1/ir0
S: Sysfs=/devices/pci0000:00/0000:00:0e.0/0000:02:0a.2/usb2/2-1/input/input5
U: Uniq=
H: Handlers=kbd event5
B: EV=3
B: KEY=108fc310 2802891 0 0 0 0 118000 200180 4803 e1680 0 100000 ffe

So I've been using /dev/input/event5 in my tests. I have tried using evtest, mode2, and irw to no avail. I get no indication of any signal coming from the remote. Am I missing a kernel driver module?

Remote Control Support (2)

[Comments added by Cloggy - 23 May 2011 - update based on Mythbuntu 11.04 / Myth 0.24] The tuner card itself works fine out of the box, you just have to copy the firmware file to the correct directory:

cd /lib/firmware
sudo wget http://palosaari.fi/linux/v4l-dvb/firmware/af9015/5.1.0.0/dvb-usb-af9015.fw

However, I spent two weeks trying to get the remote control (Y04G0051) to work with the new kernel 2.6.38 and it's been a frustrating experience. The remote control emulates a keyboard but it very often generates more keypresses than what was put in. For example, you press CANCEL twice but the driver recognises three key presses so you end up in menu screens you didn't intend. Playing around with the delay and repeat settings didn't make any difference. I've also experimented with inputlirc but this didn't resolve my problem. A friend donated a Chinese made MCE remote control (what used to be sold in Australia as a Jaycar MCE remote control) and it's been fantastic! It emulates a keyboard so no LIRC required. Only problem with it is that some keys generate Shift+<some key> codes and MythTV doesn't differentiate between upper and lower case so you just have to remap some keys. All is described here:

http://www.mythtv.org/wiki/Generic_HID_%22MCE%22_Remotes

To get you started, here my ~/.Xmodmap

keycode 22 = Escape Escape Escape Escape
keycode 27 = R R R R
keycode 39 = S S S S
keycode 33 = p P P F13
keycode 56 = B F14 B F14
keycode 41 = F F15 F F15
keycode 28 = t T t F16
keycode 58 = F17 F17 F17 F17
keycode 52 = Z Z Z Z
keycode 38 = A A A A

[Comments added by Cloggy - 14 Mar 2011 - based on Mythbuntu 10.10 / Myth 0.24] Here my config files to get the remote control (part number y04g0051) working:

/etc/udev/rules.d/20-mythtv.rules:

# /etc/udev/rules.d/20-mythtv.rules

# Leadtek DTV2000DS Remote Control
KERNELS=="2-1",ATTRS{idVendor}=="0413",ATTRS{idProduct}=="6a04",SYMLINK+="input/dtv2000ds_remote"

/etc/lirc/hardware.conf:

# /etc/lirc/hardware.conf

REMOTE="Leadtek dtv2000ds y04g0051"
REMOTE_MODULES=""
REMOTE_DRIVER="devinput"
REMOTE_DEVICE="/dev/input/dtv2000ds_remote"
REMOTE_LIRCD_CONF="/etc/lirc/lircd.conf"
REMOTE_LIRCD_ARGS=""

#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""

#Enable lircd
START_LIRCD="true"

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"

#Try to load appropriate kernel modules
LOAD_MODULES="true"

# Default configuration files for your hardware if any
LIRCMD_CONF=""

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="true"
START_LIRCMD="true"

/etc/lirc/lircd.conf:

# /etc/lirc/lircd.conf
# brand: Leadtek
# model no. of remote control: Y04G0051
# devices being controlled by this remote: DTV2000DS

begin remote
  name            Y04G0051
  bits            16
  eps             30
  aeps            100
  one             0 0
  zero            0 0
  gap             263992
  pre_data_bits   16
  pre_data        0x8001

  begin codes
       POWER              0x0164
       TV                 0x0179
       PREVIOUS           0x00A8
       PLAYPAUSE          0x00CF
       NEXT               0x00D0
       CLOCK              0x0167
       BACK               0x019C
       STOP               0x0080
       FORWARD            0x0197
       RECORD             0x00A7
       ZERO               0X000B
       ONE                0x0002
       TWO                0x0003
       THREE              0x0004
       FOUR               0x0005
       FIVE               0x0006
       SIX                0x0007
       SEVEN              0x0008
       EIGHT              0x0009
       NINE               0x000A
       EPG                0x016D
       FULLSCREEN         0x0177
       RECALL             0x0081
       DOT                0x0034
       OKINFO             0x0160
       SNAPSHOT           0x00D4
       MENU               0X008B
       EXIT               0x0080
       MUTE               0x0071
       SLEEP              0x008E
       UP                 0X0067
       DOWN               0x006C
       LEFT               0x0069
       RIGHT              0x006A
       OK                 0X0160
       VOL+               0x0073
       VOL-               0x0072
       CH+                0x0192
       CH-                0X0193
       AUDIO              0x0188
       VIDEO              0x0189
       RED                0x018E
       GREEN              0X018F
       YELLOW             0x0190
       BLUE               0x0191
       TELETEXT           0x0184
       UNKNOWN1           0X016B
       PIP                0x00B5
       DELETE             0x0001
  end codes
end remote

External Links