TerraTec T6 Dual DVB-T Stick: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
(New Device Entry for TerraTec T6 Dual DVB-T Stick (first created as "TerraTec T6", but wanted to rename it)
 
(Corrected an error in the patches)
 
Line 181: Line 181:
return (error);
return (error);
}
}
--- a/api/Fitipower_FC0012_Script.h 2009-08-14 16:17:10.000000000 +0200
+++ b/api/Fitipower_FC0012_Script.h 2011-08-13 16:53:41.984092888 +0200
@@ -15,7 +15,7 @@
#define VERSION4 0
-#define FC0012_ADDRESS 0xC0
+#define FC0012_ADDRESS 0xC6
#define FC0012_SCRIPTSETLENGTH 0x00000001
Word FC0012_scriptSets[] = {
--- a/api/user.h 2009-08-14 16:17:10.000000000 +0200
--- a/api/user.h 2009-08-14 16:17:10.000000000 +0200
+++ b/api/user.h 2011-08-10 22:21:31.192856393 +0200
+++ b/api/user.h 2011-08-10 22:21:31.192856393 +0200
Line 203: Line 192:
/** Define USB frame size */
/** Define USB frame size */
#define User_USB20_MAX_PACKET_SIZE 512
#define User_USB20_MAX_PACKET_SIZE 512
--- a/api/Fitipower_FC0012_Script.h 2009-08-14 16:17:10.000000000 +0200
+++ b/api/Fitipower_FC0012_Script.h 2011-08-13 18:19:10.430567920 +0200
@@ -15,62 +15,50 @@
#define VERSION4 0
-#define FC0012_ADDRESS 0xC0
+#define FC0012_ADDRESS 0xC6
#define FC0012_SCRIPTSETLENGTH 0x00000001
Word FC0012_scriptSets[] = {
-0x32
+0x26
};
ValueSet FC0012_scripts[] = {
{0x0046, 0x2E},
{0x0057, 0x00},
{0x0058, 0x01},
+ {0x0059, 0x01},
{0x005f, 0x00},
{0x0060, 0x00},
- {0x006e, 0x01},
- {0x0071, 0x0A},
+ {0x006d, 0x00},
+ {0x0071, 0x05},
{0x0072, 0x02},
{0x0074, 0x01},
- {0x0079, 0x01},
+ {0x0075, 0x03},
+ {0x0076, 0x02},
+ {0x0077, 0x01},
+ {0x0078, 0x00},
+ {0x0079, 0x00},
+ {0x007a, 0x90},
+ {0x007b, 0x90},
{0x0093, 0x00},
- {0x0094, 0x00},
- {0x0095, 0x00},
- {0x0096, 0x00},
- {0x009b, 0x2D},
- {0x009c, 0x60},
- {0x009d, 0x23},
- {0x00b3, 0x01},
- {0x00c3, 0x01},
- {0x00c4, 0x00},
+ {0x0094, 0x01},
+ {0x0095, 0x02},
+ {0x0096, 0x01},
+ {0x0098, 0x0a},
+ {0x009b, 0x05},
+ {0x009c, 0x80},
+ {0x00b3, 0x00},
+ {0x00c5, 0x01},
+ {0x00c6, 0x00},
+ {0x00c9, 0x5d},
{0xF007, 0x00},
- {0xF00A, 0x1B},
- {0xF00B, 0x1B},
- {0xF00C, 0x1B},
- {0xF00D, 0x1B},
- {0xF00E, 0xFF},
- {0xF00F, 0x01},
- {0xF010, 0x00},
- {0xF011, 0x02},
- {0xF012, 0xFF},
- {0xF013, 0x01},
- {0xF014, 0x00},
- {0xF015, 0x02},
- {0xF01B, 0xEF},
- {0xF01C, 0x01},
- {0xF01D, 0x0f},
- {0xF01E, 0x02},
- {0xF01F, 0x6E},
+ {0xF01F, 0xa0},
{0xF020, 0x00},
- {0xF025, 0xDE},
- {0xF026, 0x00},
- {0xF027, 0x0A},
- {0xF028, 0x03},
- {0xF029, 0x6E},
+ {0xF029, 0x82},
{0xF02A, 0x00},
{0xF047, 0x00},
- {0xF054, 0x0},
- {0xF055, 0x0},
+ {0xF054, 0x00},
+ {0xF055, 0x00},
{0xF077, 0x01},
{0xF1E6, 0x00},


After that, continue with the instructions in [[EzCap_DVB_T_Stick]].
After that, continue with the instructions in [[EzCap_DVB_T_Stick]].

Latest revision as of 16:29, 13 August 2011

It consists of

  • Afatech AF9035B-N2 USB Interface with included AF9033 Demodulator
  • Afatech AF9033B-N2 second Demodulator
  • Fitipower FC0012 Tuner (2 off)
top side of PCB with all major chips and IR receiver
bottom side of PCB








This device is currently not officially supported by Linux, however it is possible to get it working using a slightly patched version of the AF9035 driver as used in EzCap_DVB_T_Stick.

Instructions how to get the stick working

Follow the instruction to get the AF903x source code archive AF903x.tar.gz in EzCap_DVB_T_Stick.

I run kernel 3.0.1 and therefore I needed a few patched just to get the source code compiled (you may not need all of them, but they shouldn't hurt either).

--- a/src/af903x.h      2009-08-14 16:17:10.000000000 +0200
+++ b/src/af903x.h      2011-08-13 16:49:49.799506005 +0200
@@ -9,7 +9,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/kref.h>
-#include <linux/smp_lock.h>
 #include <linux/usb.h>
 #include <asm/uaccess.h>
 #include "dvb-usb.h"
--- a/src/userdef.h     2009-08-14 16:17:10.000000000 +0200
+++ b/src/userdef.h     2011-08-01 22:56:02.626583791 +0200
@@ -8,7 +8,9 @@
 typedef     int             INT;       // 4 bytes
 //typedef     void *          HANDLE; 

+#ifndef NULL
 #define NULL    0
+#endif

 #ifdef IN
 #undef IN
--- a/api/type.h        2009-08-14 16:17:10.000000000 +0200
+++ b/api/type.h        2011-08-01 22:54:38.197342415 +0200
@@ -3,6 +3,15 @@

 #include "userdef.h"// for Linux

+#ifdef IN
+#undef IN
+#endif
+#ifdef OUT
+#undef OUT
+#endif
+#ifdef INOUT
+#undef INOUT
+#endif
 #define IN
 #define OUT
 #define INOUT
--- a/api/usb2impl.c    2011-02-15 11:12:59.000000000 +0100
+++ b/api/usb2impl.c    2011-08-01 21:59:17.635389432 +0200
@@ -6,7 +6,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/kref.h>
-#include <linux/smp_lock.h>
 #include <linux/usb.h>
 #include <asm/uaccess.h>
 #include <linux/device.h>

Then, here are some bug fixes to prevent deadlocks of the mutexes:

--- a/src/af903x-drv.c  2009-08-14 16:17:10.000000000 +0200
+++ b/src/af903x-drv.c  2011-08-12 21:26:10.610770606 +0200
@@ -1075,7 +1075,7 @@ DWORD DL_ApCtrl (

     if(PDC->architecture != Architecture_PIP)
     {
-       if ( PDC->Demodulator.chipNumber == 2 && bOn) dwError = DL_NIMSuspend(PDC, false);
+       if ( PDC->Demodulator.chipNumber == 2 && bOn) dwError = DRV_NIMSuspend(PDC, false);

        for (i=0; i<PDC->Demodulator.chipNumber; i++)
        {
@@ -1091,7 +1091,7 @@ DWORD DL_ApCtrl (
            }
        }

-       if(PDC->Demodulator.chipNumber == 2 && !bOn) dwError = DL_NIMSuspend(PDC, true);
+       if(PDC->Demodulator.chipNumber == 2 && !bOn) dwError = DRV_NIMSuspend(PDC, true);
     }
     else
     {
@@ -1100,7 +1100,7 @@ DWORD DL_ApCtrl (
            PDC->fc[ucSlaveDemod].GraphBuilt = 1;

            if (PDC->fc[0].GraphBuilt == 0 ||  PDC->fc[1].GraphBuilt == 0)
-               dwError = DL_NIMSuspend(PDC, false);
+               dwError = DRV_NIMSuspend(PDC, false);

            dwError = DRV_ApCtrl (PDC, ucSlaveDemod, bOn);
        }
@@ -1112,7 +1112,7 @@ DWORD DL_ApCtrl (
            if (PDC->bTunerPowerOff != true) dwError = DRV_ApCtrl (PDC, ucSlaveDemod, bOn);

            if (PDC->fc[0].GraphBuilt == 0 && PDC->fc[1].GraphBuilt == 0 && PDC->bTunerPowerOff == true)
-               dwError = DL_NIMSuspend(PDC, true);
+               dwError = DRV_NIMSuspend(PDC, true);
        }
     }

And finally, the patches to support the TerraTec T6 Dual DVB-T stick:

--- a/src/af903x-devices.c      2009-08-14 16:17:10.000000000 +0200
+++ b/src/af903x-devices.c      2011-08-01 22:06:08.118919600 +0200
@@ -127,6 +127,7 @@ struct usb_device_id af903x_usb_id_table
                { USB_DEVICE(0x15A4,0x1002) },
                { USB_DEVICE(0x15A4,0x1003) },
                { USB_DEVICE(0x15A4,0x9035) },
+               { USB_DEVICE(0x0ccd,0x10b3) },  /* Terratec T6 */
                { 0},           /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, af903x_usb_id_table);
@@ -156,7 +157,7 @@ struct dvb_usb_device_properties af903x_
                        }
                },
 #else
-               .num_adapters = 1,
+               .num_adapters = 2,
                .adapter = {
                        {
                                .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
@@ -198,13 +199,17 @@ struct dvb_usb_device_properties af903x_
                        },
                },
 #endif
-               .num_device_descs =1,
+               .num_device_descs =2,
                .devices =  {
                         {      "ITEtech USB2.0 DVB-T Recevier",
                                { &af903x_usb_id_table[0], &af903x_usb_id_table[1],&af903x_usb_id_table[2],
                                &af903x_usb_id_table[3], &af903x_usb_id_table[4], NULL},
                                { NULL },
                         },
+                        {      "Terratec T6",
+                               { &af903x_usb_id_table[5], NULL},
+                               { NULL },
+                        },
                        {NULL},

                }
--- a/api/Fitipower_FC0012.c    2009-08-14 16:17:10.000000000 +0200
+++ b/api/Fitipower_FC0012.c    2011-08-11 22:54:23.390763425 +0200
@@ -35,6 +35,12 @@ Dword FC0012_open (
        IN  Byte                        chip
 ) {
     Dword error = Error_NO_ERROR;
+    int i;
+    Byte reg[] = {
+       0x05, 0x10, 0x00, 0x00, 0x0a, 0x00, 0x0f, 0xff,
+       0x6e, 0xb8, 0x83, 0xfe, 0x02, 0x00, 0x00, 0x0d,
+       0x00, 0x1f, 0x90, 0x00, 0x04,
+       };

     /** Control tuner enable */
        error = Standard_writeRegisterBits (demodulator, chip, Processor_LINK, p_reg_top_gpiot2_o, reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 1);
@@ -47,11 +53,16 @@ Dword FC0012_open (
        if (error) goto exit;

        /** Control pin diode **/
-    error = Standard_writeRegister (demodulator, chip, Processor_LINK, p_reg_top_gpioh8_on, 1);
+    error = Standard_writeRegister (demodulator, chip, Processor_LINK, p_reg_top_gpioh8_en, 1);
     if (error) goto exit;

-    error = Standard_writeRegister (demodulator, chip, Processor_LINK, p_reg_top_gpioh8_en, 1);
+    error = Standard_writeRegister (demodulator, chip, Processor_LINK, p_reg_top_gpioh8_on, 1);
     if (error) goto exit;
+
+    for (i=0; i<sizeof(reg)/sizeof(reg[0]); i++) {
+       error = Standard_writeTunerRegisters (demodulator, chip, i+1, 1, &reg[i]);
+       if (error) goto exit;
+    }
 exit:
     return (error);
 }
--- a/api/user.h        2009-08-14 16:17:10.000000000 +0200
+++ b/api/user.h        2011-08-10 22:21:31.192856393 +0200
@@ -22,7 +22,7 @@
 #define User_I2C_SPEED              0x07

 /** Define I2C address of secondary chip when Diversity mode or PIP mode is active. */
-#define User_I2C_ADDRESS            0x38
+#define User_I2C_ADDRESS            0x3a

 /** Define USB frame size */
 #define User_USB20_MAX_PACKET_SIZE      512
--- a/api/Fitipower_FC0012_Script.h	2009-08-14 16:17:10.000000000 +0200
+++ b/api/Fitipower_FC0012_Script.h	2011-08-13 18:19:10.430567920 +0200
@@ -15,62 +15,50 @@
 #define VERSION4 0
 
 
-#define FC0012_ADDRESS 0xC0
+#define FC0012_ADDRESS 0xC6
 #define FC0012_SCRIPTSETLENGTH 0x00000001
 
 Word FC0012_scriptSets[] = {
-0x32
+0x26
 };
 
 ValueSet FC0012_scripts[] = {
  {0x0046, 0x2E},
  {0x0057, 0x00},
  {0x0058, 0x01},
+ {0x0059, 0x01},
  {0x005f, 0x00},
  {0x0060, 0x00},
- {0x006e, 0x01},
- {0x0071, 0x0A},
+ {0x006d, 0x00},
+ {0x0071, 0x05},
  {0x0072, 0x02},
  {0x0074, 0x01},
- {0x0079, 0x01},
+ {0x0075, 0x03},
+ {0x0076, 0x02},
+ {0x0077, 0x01},
+ {0x0078, 0x00},
+ {0x0079, 0x00},
+ {0x007a, 0x90},
+ {0x007b, 0x90},
  {0x0093, 0x00},
- {0x0094, 0x00},
- {0x0095, 0x00},
- {0x0096, 0x00},
- {0x009b, 0x2D},
- {0x009c, 0x60},
- {0x009d, 0x23},
- {0x00b3, 0x01},
- {0x00c3, 0x01},
- {0x00c4, 0x00},
+ {0x0094, 0x01},
+ {0x0095, 0x02},
+ {0x0096, 0x01},
+ {0x0098, 0x0a},
+ {0x009b, 0x05},
+ {0x009c, 0x80},
+ {0x00b3, 0x00},
+ {0x00c5, 0x01},
+ {0x00c6, 0x00},
+ {0x00c9, 0x5d},
  {0xF007, 0x00},
- {0xF00A, 0x1B},
- {0xF00B, 0x1B},
- {0xF00C, 0x1B},
- {0xF00D, 0x1B},
- {0xF00E, 0xFF},
- {0xF00F, 0x01},
- {0xF010, 0x00},
- {0xF011, 0x02},
- {0xF012, 0xFF},
- {0xF013, 0x01},
- {0xF014, 0x00},
- {0xF015, 0x02},
- {0xF01B, 0xEF},
- {0xF01C, 0x01},
- {0xF01D, 0x0f},
- {0xF01E, 0x02},
- {0xF01F, 0x6E},
+ {0xF01F, 0xa0},
  {0xF020, 0x00},
- {0xF025, 0xDE},
- {0xF026, 0x00},
- {0xF027, 0x0A},
- {0xF028, 0x03},
- {0xF029, 0x6E},
+ {0xF029, 0x82},
  {0xF02A, 0x00},
  {0xF047, 0x00},
- {0xF054, 0x0},
- {0xF055, 0x0},
+ {0xF054, 0x00},
+ {0xF055, 0x00},
  {0xF077, 0x01},
  {0xF1E6, 0x00},

After that, continue with the instructions in EzCap_DVB_T_Stick.