Leadtek WinFast DTV2000DS

From LinuxTVWiki
Revision as of 11:04, 24 January 2011 by Ross232 (talk | contribs)
Jump to navigation Jump to 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

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

Ensure you activate the firmware as per cloggys instructions below.

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"

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 - based on Mythbuntu 10.10] 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
       TV                 0x00179
       PREVIOUS           0x000A8
       PLAYPAUSE          0x000CF
       NEXT               0x000D0
       CLOCK              0x00167
       BACK               0x0019C
       STOP               0x00080
       FORWARD            0x00197
       RECORD             0x000A7
       ZERO               0X0000B
       ONE                0x00002
       TWO                0x00003
       THREE              0x00004
       FOUR               0x00005
       FIVE               0x00006
       SIX                0x00007
       SEVEN              0x00008
       EIGHT              0x00009
       NINE               0x0000A
       EPG                0x0016D
       FULLSCREEN         0x00177
       RECALL             0x00081
       DOT                0x00034
       OKINFO             0x00160
       SNAPSHOT           0x000D4
       MENU               0X0008B
       EXIT               0x00080
       MUTE               0x00071
       SLEEP              0x0008E
       UP                 0X00067
       DOWN               0x0006C
       LEFT               0x00069
       RIGHT              0x0006A
       OK                 0X00160
       VOL+               0x00073
       VOL-               0x00072
       CH+                0x00192
       CH-                0X00193
       AUDIO              0x00188
       VIDEO              0x00189
       RED                0x0018E
       GREEN              0X0018F
       YELLOW             0x00190
       BLUE               0x00191
       TELETEXT           0x00184
       UNKNOWN1           0X0016B
       PIP                0x000B5
       DELETE             0x00001
  end codes
end remote

Not every single button works yet (most notably the MCE button, but I suspect it needs a different "pre_data" which is probably a generic Windows MCE one.

External Links