TerraTec Cinergy T Stick

From LinuxTVWiki
Revision as of 17:40, 11 April 2012 by Uto.ughi (talk | contribs)
Jump to navigation Jump to search

TerraTec Cinergy T Stick is a USB 2.0 DVB-T device.


Vendor
Device/Model
Supported ID on
Interface
Hardware Firmware Comment / Pictures URL E
TerraTec Cinergy T Stick Yes, but see device page for details. 0ccd:00aa USB2.0 Afatech AF9035, TUA9001 Jump to the place where you can edit this entry


Currently not supported by LinuxTV. The manufacturer's Linux page links to vendor driver.

(TerraTec Cinergy T Stick Black / 0ccd:00a9 is a different device, based on Realtek RTL2832U and Fitipower FC0012)

Based on:

  • Afatech AF9033
  • Afatech AF9035
  • Infineon TUA9001


Install instructions for manufacturer driver

Method A

This method install the same drivers as in section B, with some small patches and a Makefile that directly creates the kernel modules, without compiling a whole kernel. The patches are (as in method B): to support the alternative USB code of the stick; to correct the frequency calculations.

  • Download kernel source and headers equal to the ones you are using (check with 'uname -a'); e.g., for a Debian or Ubuntu distribution,
apt-get install linux-source-2.6.30 linux-headers-2.6.30-1-686 kernel-package
  • and unpack the kernel source
 cd /usr/src ; tar xjf linux-source-2.6.30.tar.bz2
make
  • install (as root)
make install
  • Copy firmware (dvb-usb-af9035-01.fw) to /lib/firmware.

Note that currently, with kernel 2.6.30, the remote does not work: the module 'hiddev' recognizes the stick as a keyboard, and offers it as a input device /dev/input/event?? (use 'evtest' to test it).

Patch needed for Kernel >= 3.2

http://pastebin.com/0Y6ixyFs

Method B

  • Download the driver from Terratec http://linux.terratec.de/files/Cinergy_T_Stick/terratec_af9035.zip
  • Apply patch (AF9035-AF9033-TUA9001_DRIVER.patch) to kernel source, ignore the other files.
  • Copy firmware (dvb-usb-af9035-01.fw) to /lib/firmware.
  • The stick come with two different identifications, either 93 or AA . Check the USB identifier of the stick using 'lsusb' ; if you see 'AA' in a line such as
ID 0ccd:00aa TerraTec Electronic GmbH 

then you should edit the file drivers/media/dvb/dvb-usb/dvb-usb-ids.h and change the line from

#define USB_PID_TERRATEC_CINERGY_T_STICK		0x0093 

to

#define USB_PID_TERRATEC_CINERGY_T_STICK		0x00AA
  • Apply the following patch to the tuner code.
--- a/linux/drivers/media/common/tuners/tua9001.c	2009-07-03 04:04:40.000000000 +0200
+++ b/linux/drivers/media/common/tuners/tua9001.c	2009-07-18 20:41:32.000000000 +0200
@@ -93,6 +93,7 @@
 	struct tua9001_priv *priv = fe->tuner_priv;
 	int ret;
 	u16 val;
+	u32 freq;
 	u8 i;
 	struct regdesc data[2];
 
@@ -117,12 +118,19 @@
 	data[0].reg = 0x04;
 	data[0].val = val;
 
+freq = params->frequency;
+
 #define OFFSET 150000000
-	val = 0.000048 * (params->frequency - OFFSET);
+freq = freq - OFFSET;
+freq  = freq/1000;
+freq  = 48 * freq;
+freq  = freq/1000;
+
+val = freq;
+
 	data[1].reg = 0x1f;
 	data[1].val = val;
 
-	priv->frequency = (val * 20833.33334) + OFFSET;
 
 	deb_info("%s: freq:%d bw:%d freq tuner:%d val:%d\n", __func__,
 		params->frequency, params->u.ofdm.bandwidth, priv->frequency,

  • Configure and compile your kernel
  • Have a beer

Tested with 2.6.30.1, in case the patches fail just work them in by hand. Don't give up!

Tested with 2.6.30.8, patch fails on file /usr/source/linux-`uname -r`/drivers/media/dvb/frontends/Makefile but it is sufficient to patch it file by hand to make it work. To patch the file add the following line just under line 74 (i.e. at the end of the file):

obj-$(CONFIG_DVB_AF9033) += af9033.o

Method C

Patch for adding device USB IDs to the manufacturer's driver.

72a73
> #define USB_PID_TERRATEC_CINERGY_T			0x0093
78a80
> 		{USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_CINERGY_T)},
146c148
< 		.num_device_descs =1,
---
> 		.num_device_descs =2,
152a155,159
> 			{
> 				.name = "TerraTec Cinergy T-Stick",
> 				.cold_ids = {&af903x_usb_id_table[5], NULL},
> 				.warm_ids = {NULL},
> 			},

Install instructions

  • copy above patch to file (e.g. TerraTec_Cinergy_T-Stick.patch) and save it your home directory
  • download driver from TerraTec support site
wget http://linux.terratec.de/files/Cinergy_T_Stick/Linux-Driver-for-T-Stick.rar
  • extract driver package
unrar x Linux-Driver-for-T-Stick.rar
  • enter driver directory
cd Linux_PC_AF9035_Afatech_2008.12.17/
  • enter driver directory according to your Kernel architecture
    • for 32 bit
cd Linux-32bit_AF9035_20081217/
    • for 64 bit
cd Linux-64bit_AF9035_20081217/
  • extract driver package
tar zxvf AF903x_SRC.tar.gz
  • enter driver directory
cd AF903x_SRC/
  • apply patch (from home directory)
patch af903x-devices.c ~/TerraTec_Cinergy_T-Stick.patch
  • compile
make
  • install (as root)
make install

Device should work if everything goes correctly. Few distribution specific install commands you may wish use:

Fedora:

su -c "make install"

Ubuntu:

sudo make install

Driver does support Kernels from 2.6.16 to 2.6.27. If you have newer Kernel then you could try compile it against 2.6.27 headers (cp v4l/kernel-2.6.27/* ./). In that case there is big risk it doesn't work and crashes your Kernel when device is plugged.

Method D

  • patch -p0 < v4l-dvb-af9033.patch && patch -p0 < v4l-dvb-af9035.patch && patch -p0 < v4l-dvb-tua9001.patch
  • cd v4l-dvb
  • make
  • sudo make install (sudo -c make install)

now should be ready to merge to main!!!!

Method D has been successfully tested on February 4th 2012 on an Ubuntu 10.04 PC with a Terratec Cinergy T stick USD IDs 0ccd-0093

lsmod shows :

% lsmod
Module                  Size  Used by
tua9001                 3071  1
af9033                 17239  1
dvb_usb_af9035         16474  9
dvb_usb                19779  1 dvb_usb_af9035
usbhid                 41116  0
dvb_core              102479  1 dvb_usb

Kernel logs show :

Feb  4 11:59:23 cadeau kernel: [ 5995.800330] usb 2-1.1: new high speed USB device using ehci_hcd and address 3
Feb  4 11:59:23 cadeau kernel: [ 5995.917204] usb 2-1.1: configuration #1 chosen from 1 choice
Feb  4 11:59:23 cadeau kernel: [ 5996.003244] WARNING: You're using an obsolete driver! You shouldn't be using it!
Feb  4 11:59:23 cadeau kernel: [ 5996.003247]          If you want anything new, you can use http://git.linuxtv.org/media_build.git.
Feb  4 11:59:23 cadeau kernel: [ 5996.003249]          The tree is still here just to preserve the development history.
Feb  4 11:59:23 cadeau kernel: [ 5996.008523] usbcore: registered new interface driver hiddev
Feb  4 11:59:23 cadeau kernel: [ 5996.012123] input: TerraTec Cinergy T-Stick as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input9
Feb  4 11:59:23 cadeau kernel: [ 5996.012253] generic-usb 0003:0CCD:0093.0001: input,hidraw0: USB HID v1.01 Keyboard [TerraTec Cinergy T-Stick] on usb-0000:00:1d.0-1.1/input1
Feb  4 11:59:23 cadeau kernel: [ 5996.012290] usbcore: registered new interface driver usbhid
Feb  4 11:59:23 cadeau kernel: [ 5996.012294] usbhid: v2.6:USB HID core driver
Feb  4 11:59:23 cadeau kernel: [ 5996.017224] dvb-usb: found a 'TerraTec Cinergy T Stick' in cold state, will try to load a firmware
Feb  4 11:59:23 cadeau kernel: [ 5996.017233] usb 2-1.1: firmware: requesting dvb-usb-af9035-01.fw
Feb  4 11:59:23 cadeau kernel: [ 5996.034581] dvb-usb: downloading firmware from file 'dvb-usb-af9035-01.fw'
Feb  4 11:59:24 cadeau kernel: [ 5996.390597] dvb-usb: found a 'TerraTec Cinergy T Stick' in warm state.
Feb  4 11:59:24 cadeau kernel: [ 5996.390696] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
Feb  4 11:59:24 cadeau kernel: [ 5996.391317] DVB: registering new adapter (TerraTec Cinergy T Stick)
Feb  4 11:59:24 cadeau kernel: [ 5996.412986] af9033: firmware version: LINK:11.15.10.0 OFDM:5.48.10.0
Feb  4 11:59:24 cadeau kernel: [ 5996.491170] DVB: registering adapter 0 frontend 0 (Afatech AF9033 DVB-T)...
Feb  4 11:59:24 cadeau kernel: [ 5996.530418] tua9001: Infineon TUA 9001 successfully attached.
Feb  4 11:59:24 cadeau kernel: [ 5996.530428] dvb-usb: TerraTec Cinergy T Stick successfully initialized and connected.

sometimes there are errors indicating:

af9035: bulk message failed:-xx af9033: I2C read failed reg:00xx