Re: [PATCH 0/5] Digital Devices PCIe bridge update to 0.9.15a

2014-09-23 Thread Guy Martin


On 2014-08-02 05:48, Antti Palosaari wrote:



Tree for testing is here:
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=digitaldevices




Hi Antti,

I tried your digitaldevices branch but it does not work for me.

Using w_scan, I'm not able to find any DVB-C transponder.
The very same command works fine with the official drivers.

There is no indication of what is wrong. Everything seems fine, I just 
don't get a lock.


See the relevant output below.

Regards,
  Guy

02:00.0 Multimedia controller: Digital Devices GmbH Device 0005
Subsystem: Digital Devices GmbH Device 0004
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at d050 (64-bit, non-prefetchable) [size=64K]
Capabilities: [50] Power Management version 3
Capabilities: [70] MSI: Enable- Count=1/2 Maskable- 64bit+
Capabilities: [90] Express Endpoint, MSI 00
Capabilities: [100] Vendor Specific Information: ID= Rev=0 
Len=00c ?

Kernel driver in use: ddbridge
Kernel modules: ddbridge


[40396.241811] Digital Devices PCIE bridge driver 0.9.15, Copyright (C) 
2010-14 Digital Devices GmbH
[40396.242318] DDBridge driver detected: Digital Devices Octopus V3 DVB 
adapter

[40396.242358] HW 0001 REGMAP 00010004
[40396.352992] Port 0 (TAB 1): DUAL DVB-C/T/T2
[40396.354460] Port 1 (TAB 2): NO MODULE
[40396.355691] Port 2 (TAB 3): NO MODULE
[40396.464656] Port 3 (TAB 4): DUAL DVB-C/T/T2
[40396.467376] 0 netstream channels
[40396.467388] DVB: registering new adapter (DDBridge)
[40396.467392] DVB: registering new adapter (DDBridge)
[40396.467396] DVB: registering new adapter (DDBridge)
[40396.467399] DVB: registering new adapter (DDBridge)
[40396.505488] tda18212 0-0060: NXP TDA18212HN/M successfully identified
[40396.505546] ddbridge :02:00.0: DVB: registering adapter 0 
frontend 0 (CXD2837 DVB-C DVB-T/T2)...

[40396.552506] tda18212 0-0063: NXP TDA18212HN/S successfully identified
[40396.552545] ddbridge :02:00.0: DVB: registering adapter 1 
frontend 0 (CXD2837 DVB-C DVB-T/T2)...

[40396.599404] tda18212 3-0060: NXP TDA18212HN/M successfully identified
[40396.599440] ddbridge :02:00.0: DVB: registering adapter 2 
frontend 0 (CXD2837 DVB-C DVB-T/T2)...

[40396.647594] tda18212 3-0063: NXP TDA18212HN/S successfully identified
[40396.647632] ddbridge :02:00.0: DVB: registering adapter 3 
frontend 0 (CXD2837 DVB-C DVB-T/T2)...




--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Status of the ddbridge driver update

2014-07-07 Thread Guy Martin
Hi Maik,


What is the current status of the ddbridge driver update ?

Are you still working on it ?
I'm not seeing any update since November 2013.

Do you have an updated version of what you sent last ?
I'd like to continue your work if you cannot work on this anymore.


Regards,
  Guy


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Doing a v4l-utils-1.0.0 release

2013-07-25 Thread Guy Martin

Hi Gregor,

On 2013-07-25 14:36, Gregor Jasny wrote:

I saw your patches were merged to v4l-utils. Is there anything else
you'd like to have included in a v4l-utils 1.0.0 release?


Nope, that's all I wanted to have for this release.

Next thing will be to work on better diseqc support but it can wait for 
another release.


  Guy


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters

2013-06-18 Thread Guy Martin
The parsing of those extra parameters is buggy and completely useless since 
they are parsed
individually later on in the code.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 lib/libdvbv5/dvb-file.c | 25 -
 1 file changed, 25 deletions(-)

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index d8d583c..aa42a37 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -392,31 +392,6 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
return 0;
}
 
-   /* Handle the DVB extra DTV_foo properties */
-   for (i = 0; i  ARRAY_SIZE(dvb_user_name); i++) {
-   if (!dvb_user_name[i])
-   continue;
-   if (!strcasecmp(key, dvb_user_name[i]))
-   break;
-   }
-   if (i  ARRAY_SIZE(dvb_user_name)) {
-   const char * const *attr_name = dvb_attr_names(i);
-   n_prop = entry-n_props;
-   entry-props[n_prop].cmd = i + DTV_USER_COMMAND_START;
-   if (!attr_name || !*attr_name)
-   entry-props[n_prop].u.data = atol(value);
-   else {
-   for (j = 0; attr_name[j]; j++)
-   if (!strcasecmp(value, attr_name[j]))
-   break;
-   if (!attr_name[j])
-   return -2;
-   entry-props[n_prop].u.data = j + 
DTV_USER_COMMAND_START;
-   }
-   entry-n_props++;
-   return 0;
-   }
-
/* Handle the other properties */
 
if (!strcasecmp(key, SERVICE_ID)) {
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite()

2013-06-18 Thread Guy Martin
This patch makes the function dvb_fe_is_satellite() availble from libdvbv5. 
This function is simple
but yet very handful to have around.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 lib/include/dvb-fe.h  |  1 +
 lib/libdvbv5/dvb-fe.c | 14 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index d725a42..7352218 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -203,6 +203,7 @@ int dvb_fe_diseqc_cmd(struct dvb_v5_fe_parms *parms, const 
unsigned len,
  const unsigned char *buf);
 int dvb_fe_diseqc_reply(struct dvb_v5_fe_parms *parms, unsigned *len, char 
*buf,
   int timeout);
+int dvb_fe_is_satellite(uint32_t delivery_system);
 
 #ifdef __cplusplus
 }
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 550b6e2..b786a85 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -230,7 +230,7 @@ struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int 
frontend, unsigned verbose
 }
 
 
-static int is_satellite(uint32_t delivery_system)
+int dvb_fe_is_satellite(uint32_t delivery_system)
 {
switch (delivery_system) {
case SYS_DVBS:
@@ -254,7 +254,7 @@ void dvb_fe_close(struct dvb_v5_fe_parms *parms)
return;
 
/* Disable LNBf power */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
dvb_fe_sec_voltage(parms, 0, 0);
 
close(parms-fd);
@@ -298,8 +298,8 @@ int dvb_set_sys(struct dvb_v5_fe_parms *parms,
 
if (sys != parms-current_sys) {
/* Disable LNBf power */
-   if (is_satellite(parms-current_sys) 
-   !is_satellite(sys))
+   if (dvb_fe_is_satellite(parms-current_sys) 
+   !dvb_fe_is_satellite(sys))
dvb_fe_sec_voltage(parms, 0, 0);
 
/* Can't change standard with the legacy FE support */
@@ -594,7 +594,7 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
 
 ret:
/* For satellite, need to recover from LNBf IF frequency */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
return dvb_sat_get_parms(parms);
 
return 0;
@@ -609,7 +609,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
 
struct dtv_property fe_prop[DTV_MAX_COMMAND];
 
-   if (is_satellite(parms-current_sys)) {
+   if (dvb_fe_is_satellite(parms-current_sys)) {
dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, freq);
dvb_sat_set_parms(parms);
}
@@ -673,7 +673,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
}
 ret:
/* For satellite, need to recover from LNBf IF frequency */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
 
return 0;
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend

2013-06-18 Thread Guy Martin
Apply polarization parameters even if a satellite number is not provided. This 
allow
proper setup of the tone and voltage.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 lib/include/dvb-fe.h  |  1 -
 lib/libdvbv5/dvb-sat.c| 57 ---
 lib/libdvbv5/dvb-v5-std.c |  9 ++--
 3 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index 7352218..b0e2bf9 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -104,7 +104,6 @@ struct dvb_v5_fe_parms {
unsignedfreq_bpf;
 
/* Satellite specific stuff, used internally */
-   //enum dvb_sat_polarization   pol;
int high_band;
unsigneddiseqc_wait;
unsignedfreq_offset;
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index d00a09e..f84b5a4 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -273,7 +273,7 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
 {
int rc;
enum dvb_sat_polarization pol;
-   dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
+   dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
int pol_v = (pol == POLARIZATION_V) || (pol == POLARIZATION_R);
int high_band = parms-high_band;
int sat_number = parms-sat_number;
@@ -284,12 +284,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
 
if (!lnb-rangeswitch) {
/*
-* Bandstacking and single LO may not be using DISEqC
-*/
-   if (sat_number  0)
-   return 0;
-
-   /*
 * Bandstacking switches don't use 2 bands nor use
 * DISEqC for setting the polarization. It also doesn't
 * use any tone/tone burst
@@ -297,11 +291,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
pol_v = 0;
high_band = 1;
} else {
-   if (sat_number  0) {
-   dvb_logerr(Need a satellite number for DISEqC);
-   return -EINVAL;
-   }
-
/* Adjust voltage/tone accordingly */
if (parms-sat_number  2) {
vol_high = pol_v ? 0 : 1;
@@ -310,32 +299,35 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
}
}
 
-   rc = dvb_fe_sec_tone(parms, SEC_TONE_OFF);
-   if (rc)
-   return rc;
-
rc = dvb_fe_sec_voltage(parms, 1, vol_high);
if (rc)
return rc;
-   usleep(15 * 1000);
+   
+   if (parms-sat_number  0) {
+   rc = dvb_fe_sec_tone(parms, SEC_TONE_OFF);
+   if (rc)
+   return rc;
 
-   if (!t)
-   rc = dvbsat_diseqc_write_to_port_group(parms, cmd, high_band,
-  pol_v, sat_number);
-   else
-   rc = dvbsat_scr_odu_channel_change(parms, cmd, high_band,
-  pol_v, sat_number, t);
+   usleep(15 * 1000);
 
-   if (rc) {
-   dvb_logerr(sending diseq failed);
-   return rc;
-   }
-   usleep((15 + parms-diseqc_wait) * 1000);
+   if (!t)
+   rc = dvbsat_diseqc_write_to_port_group(parms, cmd, 
high_band,
+  pol_v, 
sat_number);
+   else
+   rc = dvbsat_scr_odu_channel_change(parms, cmd, 
high_band,
+  pol_v, sat_number, 
t);
 
-   rc = dvb_fe_diseqc_burst(parms, mini_b);
-   if (rc)
-   return rc;
-   usleep(15 * 1000);
+   if (rc) {
+   dvb_logerr(sending diseq failed);
+   return rc;
+   }
+   usleep((15 + parms-diseqc_wait) * 1000);
+
+   rc = dvb_fe_diseqc_burst(parms, mini_b);
+   if (rc)
+   return rc;
+   usleep(15 * 1000);
+   }
 
rc = dvb_fe_sec_tone(parms, tone_on ? SEC_TONE_ON : SEC_TONE_OFF);
 
@@ -354,7 +346,6 @@ int dvb_sat_set_parms(struct dvb_v5_fe_parms *parms)
dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
uint32_t freq;
uint16_t t = 0;
-   /*uint32_t voltage = SEC_VOLTAGE_18;*/
int rc;
 
dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, freq);
diff --git a/lib/libdvbv5/dvb-v5-std.c b/lib/libdvbv5/dvb-v5-std.c
index 5a1854b..574ae1e 100644
--- a/lib/libdvbv5/dvb-v5-std.c
+++ b/lib/libdvbv5/dvb-v5-std.c
@@ -125,8 +125,6 @@ const unsigned int sys_dvbs_props[] = {
DTV_INVERSION

[PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file

2013-06-18 Thread Guy Martin
Parsing the LNB needs to be done for proper tuning.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 utils/dvb/dvbv5-zap.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index c84cf70..d6c1152 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -165,6 +165,15 @@ static int parse(struct arguments *args,
return -3;
}
 
+   if (entry-lnb) {
+   int lnb = dvb_sat_search_lnb(entry-lnb);
+   if (lnb == -1) {
+   PERROR(unknown LNB %s\n, entry-lnb);
+   return -1;
+   }
+   parms-lnb = dvb_sat_get_lnb(lnb);
+   }
+
if (entry-video_pid) {
if (args-n_vpid  entry-video_pid_len)
*vpid = entry-video_pid[args-n_vpid];
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] libdvbv5: Add parsing of POLARIZATION

2013-06-18 Thread Guy Martin
This patch add parsing support for the POLARIZATION parameter for the DVBv5 
file format.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 lib/include/dvb-file.h  |  1 -
 lib/libdvbv5/dvb-file.c | 65 ++---
 2 files changed, 29 insertions(+), 37 deletions(-)

diff --git a/lib/include/dvb-file.h b/lib/include/dvb-file.h
index ea76080..e38fe85 100644
--- a/lib/include/dvb-file.h
+++ b/lib/include/dvb-file.h
@@ -35,7 +35,6 @@ struct dvb_entry {
 
char *location;
 
-// enum dvbsat_polarization pol;
int sat_number;
unsigned freq_bpf;
unsigned diseqc_wait;
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index aa42a37..02b28e7 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -357,6 +357,29 @@ error:
return -1;
 }
 
+static int store_entry_prop(struct dvb_entry *entry,
+   uint32_t cmd, uint32_t value)
+{
+   int i;
+
+   for (i = 0; i  entry-n_props; i++) {
+   if (cmd == entry-props[i].cmd)
+   break;
+   }
+   if (i == entry-n_props) {
+   if (i == DTV_MAX_COMMAND) {
+   fprintf(stderr, Can't add property %s\n,
+  dvb_v5_name[cmd]);
+   return -1;
+   }
+   entry-n_props++;
+   entry-props[i].cmd = cmd;
+   }
+
+   entry-props[i].u.data = value;
+
+   return 0;
+}
 
 #define CHANNEL CHANNEL
 
@@ -428,16 +451,15 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
is_video = 1;
else if (!strcasecmp(key, AUDIO_PID))
is_audio = 1;
-   /*else if (!strcasecmp(key, POLARIZATION)) {
-   entry-service_id = atol(value);
-   for (j = 0; ARRAY_SIZE(pol_name); j++)
-   if (!strcasecmp(value, pol_name[j]))
+   else if (!strcasecmp(key, POLARIZATION)) {
+   for (j = 0; ARRAY_SIZE(dvb_sat_pol_name); j++)
+   if (!strcasecmp(value, dvb_sat_pol_name[j]))
break;
-   if (j == ARRAY_SIZE(pol_name))
+   if (j == ARRAY_SIZE(dvb_sat_pol_name))
return -2;
-   entry-pol = j;
+   store_entry_prop(entry, DTV_POLARIZATION, j);
return 0;
-   }*/ else if (!strncasecmp(key,PID_, 4)){
+   } else if (!strncasecmp(key,PID_, 4)){
type = strtol(key[4], NULL, 16);
if (!type)
return 0;
@@ -647,11 +669,6 @@ int write_dvb_file(const char *fname, struct dvb_file 
*dvb_file)
fprintf(fp, \n);
}
 
-   /*if (entry-pol != POLARIZATION_OFF) {*/
-   /*fprintf(fp, \tPOLARIZATION = %s\n,*/
-   /*pol_name[entry-pol]);*/
-   /*}*/
-
if (entry-sat_number = 0) {
fprintf(fp, \tSAT_NUMBER = %d\n,
entry-sat_number);
@@ -751,29 +768,6 @@ char *dvb_vchannel(struct dvb_v5_descriptors *dvb_desc,
return buf;
 }
 
-static int store_entry_prop(struct dvb_entry *entry,
-   uint32_t cmd, uint32_t value)
-{
-   int i;
-
-   for (i = 0; i  entry-n_props; i++) {
-   if (cmd == entry-props[i].cmd)
-   break;
-   }
-   if (i == entry-n_props) {
-   if (i == DTV_MAX_COMMAND) {
-   fprintf(stderr, Can't add property %s\n,
-  dvb_v5_name[cmd]);
-   return -1;
-   }
-   entry-n_props++;
-   }
-
-   entry-props[i].u.data = value;
-
-   return 0;
-}
-
 static void handle_std_specific_parms(struct dvb_entry *entry,
  struct dvb_v5_descriptors *dvb_desc)
 {
@@ -812,7 +806,6 @@ static void handle_std_specific_parms(struct dvb_entry 
*entry,
 nit_table-frequency[0]);
store_entry_prop(entry, DTV_MODULATION,
 nit_table-modulation);
-   /*entry-pol = nit_table-pol;*/
store_entry_prop(entry, DTV_POLARIZATION,
 nit_table-pol);
store_entry_prop(entry, DTV_DELIVERY_SYSTEM,
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning

2013-06-18 Thread Guy Martin
This patch copies the parms provided into a temporary buffer. This buffer will 
then
be used for any modification that needs to be performed. It makes the function
dvb_fe_set_parms() thread-safe. Also, since the DTV_FREQUENCY is not modified, 
it fixes
a bug where dvbv5-scan retrieves the frequency from the parms and write it to 
the
channel file.

Signed-off-by: Guy Martin gms...@tuxicoman.be
---
 lib/include/dvb-sat.h  |  1 -
 lib/libdvbv5/dvb-fe.c  | 71 ++
 lib/libdvbv5/dvb-sat.c | 11 
 3 files changed, 31 insertions(+), 52 deletions(-)

diff --git a/lib/include/dvb-sat.h b/lib/include/dvb-sat.h
index 23df228..8b20c9e 100644
--- a/lib/include/dvb-sat.h
+++ b/lib/include/dvb-sat.h
@@ -49,7 +49,6 @@ int print_lnb(int i);
 void print_all_lnb(void);
 const struct dvb_sat_lnb *dvb_sat_get_lnb(int i);
 int dvb_sat_set_parms(struct dvb_v5_fe_parms *parms);
-int dvb_sat_get_parms(struct dvb_v5_fe_parms *parms);
 
 #ifdef __cplusplus
 }
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index b786a85..408423f 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -551,7 +551,7 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
   delivery_system_name[parms-current_sys]);
dvb_fe_prt_parms(parms);
}
-   goto ret;
+   return 0;
}
/* DVBv3 call */
if (ioctl(parms-fd, FE_GET_FRONTEND, v3_parms) == -1) {
@@ -592,32 +592,27 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
return -EINVAL;
}
 
-ret:
-   /* For satellite, need to recover from LNBf IF frequency */
-   if (dvb_fe_is_satellite(parms-current_sys))
-   return dvb_sat_get_parms(parms);
-
return 0;
 }
 
 int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
 {
+   /* Use a temporary copy of the parameters so we can safely perform
+* adjustments for satellite */
+   struct dvb_v5_fe_parms tmp_parms = *parms;
+
struct dtv_properties prop;
struct dvb_frontend_parameters v3_parms;
-   uint32_t freq;
uint32_t bw;
 
-   struct dtv_property fe_prop[DTV_MAX_COMMAND];
-
-   if (dvb_fe_is_satellite(parms-current_sys)) {
-   dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, freq);
-   dvb_sat_set_parms(parms);
-   }
+   if (dvb_fe_is_satellite(tmp_parms.current_sys))
+   dvb_sat_set_parms(tmp_parms);
 
-   int n = dvb_copy_fe_props(parms-dvb_prop, parms-n_props, fe_prop);
+   /* Filter out any user DTV_foo property such as DTV_POLARIZATION */
+   tmp_parms.n_props = dvb_copy_fe_props(tmp_parms.dvb_prop, 
tmp_parms.n_props, tmp_parms.dvb_prop);
 
-   prop.props = fe_prop;
-   prop.num = n;
+   prop.props = tmp_parms.dvb_prop;
+   prop.num = tmp_parms.n_props;
prop.props[prop.num].cmd = DTV_TUNE;
prop.num++;
 
@@ -628,53 +623,49 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
dvb_fe_prt_parms(parms);
return -1;
}
-   goto ret;
+   return 0;
}
/* DVBv3 call */
 
-   dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, v3_parms.frequency);
-   dvb_fe_retrieve_parm(parms, DTV_INVERSION, v3_parms.inversion);
-   switch (parms-current_sys) {
+   dvb_fe_retrieve_parm(tmp_parms, DTV_FREQUENCY, v3_parms.frequency);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_INVERSION, v3_parms.inversion);
+   switch (tmp_parms.current_sys) {
case SYS_DVBS:
-   dvb_fe_retrieve_parm(parms, DTV_SYMBOL_RATE, 
v3_parms.u.qpsk.symbol_rate);
-   dvb_fe_retrieve_parm(parms, DTV_INNER_FEC, 
v3_parms.u.qpsk.fec_inner);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_SYMBOL_RATE, 
v3_parms.u.qpsk.symbol_rate);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_INNER_FEC, 
v3_parms.u.qpsk.fec_inner);
break;
case SYS_DVBC_ANNEX_AC:
-   dvb_fe_retrieve_parm(parms, DTV_SYMBOL_RATE, 
v3_parms.u.qam.symbol_rate);
-   dvb_fe_retrieve_parm(parms, DTV_INNER_FEC, 
v3_parms.u.qam.fec_inner);
-   dvb_fe_retrieve_parm(parms, DTV_MODULATION, 
v3_parms.u.qam.modulation);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_SYMBOL_RATE, 
v3_parms.u.qam.symbol_rate);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_INNER_FEC, 
v3_parms.u.qam.fec_inner);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_MODULATION, 
v3_parms.u.qam.modulation);
break;
case SYS_ATSC:
case SYS_ATSCMH:
case SYS_DVBC_ANNEX_B:
-   dvb_fe_retrieve_parm(parms, DTV_MODULATION, 
v3_parms.u.vsb.modulation);
+   dvb_fe_retrieve_parm(tmp_parms, DTV_MODULATION, 
v3_parms.u.vsb.modulation);
break;
case SYS_DVBT:
for (bw = 0; fe_bandwidth_name[bw] != 0

[PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools

2013-06-18 Thread Guy Martin
Hi all,

This set of patch fix sat support for dvbv5 libs and utils.
In this set, a different approach is used. The polarization parameter is stored 
in
the DTV_POLARIZATION property.

  Guy

Guy Martin (6):
  libdvbv5: Remove buggy parsing of extra DTV_foo parameters
  libdvbv5: Add parsing of POLARIZATION
  libdvbv5: Export dvb_fe_is_satellite()
  libdvbv5: Fix satellite handling and apply polarization parameter to
the frontend
  libdvbv5: Use a temporary copy of the dvb parameters when tuning
  dvbv5-zap: Parse the LNB from the channel file

 lib/include/dvb-fe.h  |  2 +-
 lib/include/dvb-file.h|  1 -
 lib/include/dvb-sat.h |  1 -
 lib/libdvbv5/dvb-fe.c | 79 ++---
 lib/libdvbv5/dvb-file.c   | 90 +++
 lib/libdvbv5/dvb-sat.c| 68 +--
 lib/libdvbv5/dvb-v5-std.c |  9 ++---
 utils/dvb/dvbv5-zap.c |  9 +
 8 files changed, 100 insertions(+), 159 deletions(-)

-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Doing a v4l-utils-1.0.0 release

2013-06-15 Thread Guy Martin

On Fri, 14 Jun 2013 10:34:04 -0300
Mauro Carvalho Chehab mche...@redhat.com wrote:

 Em Fri, 14 Jun 2013 09:15:02 +0200
 Hans de Goede hdego...@redhat.com escreveu:
 
  Hi All,
  
  IIRC the 0.9.x series were meant as development releases leading up
  to a new stable 1.0.0 release. Lately there have been no
  maintenance 0.8.x releases and a lot of interesting development
  going on in the 0.9.x, while at the same time there have been no
  issues reported against 0.9.x (iow it seems stable).
  
  So how about taking current master and releasing that as a 1.0.0
  release ?
 
 Fine for me. 
 
 There are 5 patches floating at patchwork to improve the DVB-S
 support with different types of DiSEqC, but applying them would break
 library support for tvd. So, they won't be applied as-is, and Guy
 needs to take some other approach. As he is also planning to add
 support there for rotors, it looks ok to postpone such changes to a
 latter version.

Can we wait a little bit more like a week max ?
I'd like to see the polarization stuff fixed because otherwise you
can't use sat at all with libdvbv5.

I'll work on the new patches this weekend. I'll hopefully have
something today.
I'll see what I can do wrt DiSEqC stuff but that can definitely wait a
latter release.

  Guy


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] libdvbv5: Add parsing of POLARIZATION

2013-05-14 Thread Guy Martin
This patch add parsing support for the POLARIZATION parameter for the DVBv5 
file format.

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/lib/include/dvb-file.h b/lib/include/dvb-file.h
index ea76080..2259844 100644
--- a/lib/include/dvb-file.h
+++ b/lib/include/dvb-file.h
@@ -35,7 +35,7 @@ struct dvb_entry {
 
char *location;
 
-// enum dvbsat_polarization pol;
+   enum dvb_sat_polarization pol;
int sat_number;
unsigned freq_bpf;
unsigned diseqc_wait;
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index aa42a37..3ea40cc 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -428,16 +428,15 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
is_video = 1;
else if (!strcasecmp(key, AUDIO_PID))
is_audio = 1;
-   /*else if (!strcasecmp(key, POLARIZATION)) {
-   entry-service_id = atol(value);
-   for (j = 0; ARRAY_SIZE(pol_name); j++)
-   if (!strcasecmp(value, pol_name[j]))
+   else if (!strcasecmp(key, POLARIZATION)) {
+   for (j = 0; ARRAY_SIZE(dvb_sat_pol_name); j++)
+   if (!strcasecmp(value, dvb_sat_pol_name[j]))
break;
-   if (j == ARRAY_SIZE(pol_name))
+   if (j == ARRAY_SIZE(dvb_sat_pol_name))
return -2;
entry-pol = j;
return 0;
-   }*/ else if (!strncasecmp(key,PID_, 4)){
+   } else if (!strncasecmp(key,PID_, 4)){
type = strtol(key[4], NULL, 16);
if (!type)
return 0;
@@ -647,10 +646,10 @@ int write_dvb_file(const char *fname, struct dvb_file 
*dvb_file)
fprintf(fp, \n);
}
 
-   /*if (entry-pol != POLARIZATION_OFF) {*/
-   /*fprintf(fp, \tPOLARIZATION = %s\n,*/
-   /*pol_name[entry-pol]);*/
-   /*}*/
+   if (entry-pol != POLARIZATION_OFF) {
+   fprintf(fp, \tPOLARIZATION = %s\n,
+   dvb_sat_pol_name[entry-pol]);
+   }
 
if (entry-sat_number = 0) {
fprintf(fp, \tSAT_NUMBER = %d\n,
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] libdvbv5: Apply polarization parameters to the frontend

2013-05-14 Thread Guy Martin
Apply polarization parameters even if a satellite number is not provided.
The polarization is fetched from struct dvb_v5_fe_parms directly and not from 
the
parameter DTV_POLARIZATION.
Since DTV_VOLTAGE and DTV_TONE are set according the polarization, those 
parameters
are removed from the props structures in dvb-v5-std.c.

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index 7352218..571d4ac 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -104,7 +104,7 @@ struct dvb_v5_fe_parms {
unsignedfreq_bpf;
 
/* Satellite specific stuff, used internally */
-   //enum dvb_sat_polarization   pol;
+   enum dvb_sat_polarization   pol;
int high_band;
unsigneddiseqc_wait;
unsignedfreq_offset;
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index d00a09e..89f8e88 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -272,8 +272,7 @@ static int dvbsat_scr_odu_channel_change(struct 
dvb_v5_fe_parms *parms, struct d
 static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms *parms, uint16_t t)
 {
int rc;
-   enum dvb_sat_polarization pol;
-   dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
+   enum dvb_sat_polarization pol = parms-pol;
int pol_v = (pol == POLARIZATION_V) || (pol == POLARIZATION_R);
int high_band = parms-high_band;
int sat_number = parms-sat_number;
@@ -284,12 +283,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
 
if (!lnb-rangeswitch) {
/*
-* Bandstacking and single LO may not be using DISEqC
-*/
-   if (sat_number  0)
-   return 0;
-
-   /*
 * Bandstacking switches don't use 2 bands nor use
 * DISEqC for setting the polarization. It also doesn't
 * use any tone/tone burst
@@ -297,11 +290,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
pol_v = 0;
high_band = 1;
} else {
-   if (sat_number  0) {
-   dvb_logerr(Need a satellite number for DISEqC);
-   return -EINVAL;
-   }
-
/* Adjust voltage/tone accordingly */
if (parms-sat_number  2) {
vol_high = pol_v ? 0 : 1;
@@ -310,32 +298,35 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
}
}
 
-   rc = dvb_fe_sec_tone(parms, SEC_TONE_OFF);
-   if (rc)
-   return rc;
-
rc = dvb_fe_sec_voltage(parms, 1, vol_high);
if (rc)
return rc;
-   usleep(15 * 1000);
+   
+   if (parms-sat_number  0) {
+   rc = dvb_fe_sec_tone(parms, SEC_TONE_OFF);
+   if (rc)
+   return rc;
 
-   if (!t)
-   rc = dvbsat_diseqc_write_to_port_group(parms, cmd, high_band,
-  pol_v, sat_number);
-   else
-   rc = dvbsat_scr_odu_channel_change(parms, cmd, high_band,
-  pol_v, sat_number, t);
+   usleep(15 * 1000);
 
-   if (rc) {
-   dvb_logerr(sending diseq failed);
-   return rc;
-   }
-   usleep((15 + parms-diseqc_wait) * 1000);
+   if (!t)
+   rc = dvbsat_diseqc_write_to_port_group(parms, cmd, 
high_band,
+  pol_v, 
sat_number);
+   else
+   rc = dvbsat_scr_odu_channel_change(parms, cmd, 
high_band,
+  pol_v, sat_number, 
t);
 
-   rc = dvb_fe_diseqc_burst(parms, mini_b);
-   if (rc)
-   return rc;
-   usleep(15 * 1000);
+   if (rc) {
+   dvb_logerr(sending diseq failed);
+   return rc;
+   }
+   usleep((15 + parms-diseqc_wait) * 1000);
+
+   rc = dvb_fe_diseqc_burst(parms, mini_b);
+   if (rc)
+   return rc;
+   usleep(15 * 1000);
+   }
 
rc = dvb_fe_sec_tone(parms, tone_on ? SEC_TONE_ON : SEC_TONE_OFF);
 
@@ -350,8 +341,7 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms 
*parms, uint16_t t)
 int dvb_sat_set_parms(struct dvb_v5_fe_parms *parms)
 {
const struct dvb_sat_lnb *lnb = parms-lnb;
-   enum dvb_sat_polarization pol;
-   dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
+   enum dvb_sat_polarization pol = parms-pol;
uint32_t freq;
uint16_t t = 0;
/*uint32_t voltage = SEC_VOLTAGE_18

[PATCH 0/5] v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools

2013-05-14 Thread Guy Martin

Hi all,

These patches fix satellite support in current dvbv5-{scan,zap} tools by
fixing the parsing of the POLARIZATION parameter as well as applying those
parameters to the frontend.

This pathset is a broken down and improved version of the previous patch I send 
in
my mail Fix POLARIZATION support for dvbv5-scan. Please disregard this 
previous patch.

  Guy


Guy Martin (5):
  libdvbv5: Remove buggy parsing of extra DTV_foo properties
  libdvbv5: Add parsing of POLARIZATION
  libdvbv5: Export dvb_fe_is_satellite()
  libdvbv5: Apply polarization parameters to the frontend
  dvbv5-zap: Copy satellite parameters before tuning
  dvbv5-scan:  Likewise

 lib/include/dvb-fe.h  |  3 ++-
 lib/include/dvb-file.h|  2 +-
 lib/libdvbv5/dvb-fe.c | 14 +--
 lib/libdvbv5/dvb-file.c   | 44 +++---
 lib/libdvbv5/dvb-sat.c| 60 ---
 lib/libdvbv5/dvb-v5-std.c |  9 ---
 utils/dvb/dvbv5-scan.c| 14 +++
 utils/dvb/dvbv5-zap.c | 14 +++
 8 files changed, 72 insertions(+), 88 deletions(-)

-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] libdvbv5: Remove buggy parsing of extra DTV_foo properties

2013-05-14 Thread Guy Martin
The parsing of those extra parameters is buggy and completely useless since 
they are parsed
individually later on in the code.

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index d8d583c..aa42a37 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -392,31 +392,6 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
return 0;
}
 
-   /* Handle the DVB extra DTV_foo properties */
-   for (i = 0; i  ARRAY_SIZE(dvb_user_name); i++) {
-   if (!dvb_user_name[i])
-   continue;
-   if (!strcasecmp(key, dvb_user_name[i]))
-   break;
-   }
-   if (i  ARRAY_SIZE(dvb_user_name)) {
-   const char * const *attr_name = dvb_attr_names(i);
-   n_prop = entry-n_props;
-   entry-props[n_prop].cmd = i + DTV_USER_COMMAND_START;
-   if (!attr_name || !*attr_name)
-   entry-props[n_prop].u.data = atol(value);
-   else {
-   for (j = 0; attr_name[j]; j++)
-   if (!strcasecmp(value, attr_name[j]))
-   break;
-   if (!attr_name[j])
-   return -2;
-   entry-props[n_prop].u.data = j + 
DTV_USER_COMMAND_START;
-   }
-   entry-n_props++;
-   return 0;
-   }
-
/* Handle the other properties */
 
if (!strcasecmp(key, SERVICE_ID)) {
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] libdvbv5: Export dvb_fe_is_satellite()

2013-05-14 Thread Guy Martin
This patch makes the function dvb_fe_is_satellite() availble from libdvbv5. 
This function is simple
but yet very handful to have around.

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index d725a42..7352218 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -203,6 +203,7 @@ int dvb_fe_diseqc_cmd(struct dvb_v5_fe_parms *parms, const 
unsigned len,
  const unsigned char *buf);
 int dvb_fe_diseqc_reply(struct dvb_v5_fe_parms *parms, unsigned *len, char 
*buf,
   int timeout);
+int dvb_fe_is_satellite(uint32_t delivery_system);
 
 #ifdef __cplusplus
 }
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 550b6e2..b786a85 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -230,7 +230,7 @@ struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int 
frontend, unsigned verbose
 }
 
 
-static int is_satellite(uint32_t delivery_system)
+int dvb_fe_is_satellite(uint32_t delivery_system)
 {
switch (delivery_system) {
case SYS_DVBS:
@@ -254,7 +254,7 @@ void dvb_fe_close(struct dvb_v5_fe_parms *parms)
return;
 
/* Disable LNBf power */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
dvb_fe_sec_voltage(parms, 0, 0);
 
close(parms-fd);
@@ -298,8 +298,8 @@ int dvb_set_sys(struct dvb_v5_fe_parms *parms,
 
if (sys != parms-current_sys) {
/* Disable LNBf power */
-   if (is_satellite(parms-current_sys) 
-   !is_satellite(sys))
+   if (dvb_fe_is_satellite(parms-current_sys) 
+   !dvb_fe_is_satellite(sys))
dvb_fe_sec_voltage(parms, 0, 0);
 
/* Can't change standard with the legacy FE support */
@@ -594,7 +594,7 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
 
 ret:
/* For satellite, need to recover from LNBf IF frequency */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
return dvb_sat_get_parms(parms);
 
return 0;
@@ -609,7 +609,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
 
struct dtv_property fe_prop[DTV_MAX_COMMAND];
 
-   if (is_satellite(parms-current_sys)) {
+   if (dvb_fe_is_satellite(parms-current_sys)) {
dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, freq);
dvb_sat_set_parms(parms);
}
@@ -673,7 +673,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
}
 ret:
/* For satellite, need to recover from LNBf IF frequency */
-   if (is_satellite(parms-current_sys))
+   if (dvb_fe_is_satellite(parms-current_sys))
dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
 
return 0;
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] dvbv5-zap: Copy satellite parameters before tuning dvbv5-scan: Likewise

2013-05-14 Thread Guy Martin
Copy satellite parameters to the frontend params. Since an LNB can be specified 
in
the channel/tuning file, set it correctly as well.

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
index 9a29b34..fa236fc 100644
--- a/utils/dvb/dvbv5-scan.c
+++ b/utils/dvb/dvbv5-scan.c
@@ -436,6 +436,20 @@ static int run_scan(struct arguments *args,
}
}
 
+   /* Copy sat parameters */
+   if (dvb_fe_is_satellite(parms-current_sys)) {
+   parms-pol = entry-pol;
+   /* If an LNB is specified for this entry, parse it */
+   if (entry-lnb) {
+   int lnb = dvb_sat_search_lnb(entry-lnb);
+   if (lnb == -1) {
+   PERROR(unknown LNB %s\n, entry-lnb);
+   return -1;
+   }
+   parms-lnb = dvb_sat_get_lnb(lnb);
+   }
+   }
+
/*
 * If the channel file has duplicated frequencies, or some
 * entries without any frequency at all, discard.
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index c84cf70..3d8ac8c 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -237,6 +237,20 @@ static int parse(struct arguments *args,
}
}
 
+   /* Copy sat parameters */
+   if (dvb_fe_is_satellite(parms-current_sys)) {
+   parms-pol = entry-pol;
+   /* If an LNB is specified for this entry, parse it */
+   if (entry-lnb) {
+   int lnb = dvb_sat_search_lnb(entry-lnb);
+   if (lnb == -1) {
+   PERROR(unknown LNB %s\n, entry-lnb);
+   return -1;
+   }
+   parms-lnb = dvb_sat_get_lnb(lnb);
+   }
+   }
+
 #if 0
/* HACK to test the write file function */
write_dvb_file(dvb_channels.conf, dvb_file);
-- 
1.8.1.5


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] v4l-utils: Fix POLARIZATION support for dvbv5-scan

2013-05-03 Thread Guy Martin

Hi all,

The attached patch fix support for the POLARIZATION parameter in 
channel files used by dvbv5-scan.
I took the liberty of removing the parsing of the 'extra DTV_foo' 
properties since they are all handled separately in dvb-file.c.
Please note that the size of struct dvb_v5_fe_parms as well as struct 
dvb_entry changes which might require a bump in library version.

Tested with DVB-S and DVB-S2.

Support for POLARIZATION is not working yet with dvbv5-zap and will 
come in a later patch.


Regards,
  Guy

dvbv5-scan: Add support for POLARIZATION setting

Signed-off-by: Guy Martin gms...@tuxicoman.be

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index d725a42..9e87d14 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -104,7 +104,7 @@ struct dvb_v5_fe_parms {
 	unsigned			freq_bpf;
 
 	/* Satellite specific stuff, used internally */
-	//enum dvb_sat_polarization   pol;
+	enum dvb_sat_polarization	pol;
 	inthigh_band;
 	unsigned			diseqc_wait;
 	unsigned			freq_offset;
diff --git a/lib/include/dvb-file.h b/lib/include/dvb-file.h
index ea76080..2259844 100644
--- a/lib/include/dvb-file.h
+++ b/lib/include/dvb-file.h
@@ -35,7 +35,7 @@ struct dvb_entry {
 
 	char *location;
 
-//	enum dvbsat_polarization pol;
+	enum dvb_sat_polarization pol;
 	int sat_number;
 	unsigned freq_bpf;
 	unsigned diseqc_wait;
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index d8d583c..3ea40cc 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -392,31 +392,6 @@ static int fill_entry(struct dvb_entry *entry, char *key, char *value)
 		return 0;
 	}
 
-	/* Handle the DVB extra DTV_foo properties */
-	for (i = 0; i  ARRAY_SIZE(dvb_user_name); i++) {
-		if (!dvb_user_name[i])
-			continue;
-		if (!strcasecmp(key, dvb_user_name[i]))
-			break;
-	}
-	if (i  ARRAY_SIZE(dvb_user_name)) {
-		const char * const *attr_name = dvb_attr_names(i);
-		n_prop = entry-n_props;
-		entry-props[n_prop].cmd = i + DTV_USER_COMMAND_START;
-		if (!attr_name || !*attr_name)
-			entry-props[n_prop].u.data = atol(value);
-		else {
-			for (j = 0; attr_name[j]; j++)
-if (!strcasecmp(value, attr_name[j]))
-	break;
-			if (!attr_name[j])
-return -2;
-			entry-props[n_prop].u.data = j + DTV_USER_COMMAND_START;
-		}
-		entry-n_props++;
-		return 0;
-	}
-
 	/* Handle the other properties */
 
 	if (!strcasecmp(key, SERVICE_ID)) {
@@ -453,16 +428,15 @@ static int fill_entry(struct dvb_entry *entry, char *key, char *value)
 		is_video = 1;
 	else if (!strcasecmp(key, AUDIO_PID))
 		is_audio = 1;
-	/*else if (!strcasecmp(key, POLARIZATION)) {
-		entry-service_id = atol(value);
-		for (j = 0; ARRAY_SIZE(pol_name); j++)
-			if (!strcasecmp(value, pol_name[j]))
+	else if (!strcasecmp(key, POLARIZATION)) {
+		for (j = 0; ARRAY_SIZE(dvb_sat_pol_name); j++)
+			if (!strcasecmp(value, dvb_sat_pol_name[j]))
 break;
-		if (j == ARRAY_SIZE(pol_name))
+		if (j == ARRAY_SIZE(dvb_sat_pol_name))
 			return -2;
 		entry-pol = j;
 		return 0;
-	}*/ else if (!strncasecmp(key,PID_, 4)){
+	} else if (!strncasecmp(key,PID_, 4)){
 		type = strtol(key[4], NULL, 16);
 		if (!type)
 			return 0;
@@ -672,10 +646,10 @@ int write_dvb_file(const char *fname, struct dvb_file *dvb_file)
 			fprintf(fp, \n);
 		}
 
-		/*if (entry-pol != POLARIZATION_OFF) {*/
-			/*fprintf(fp, \tPOLARIZATION = %s\n,*/
-/*pol_name[entry-pol]);*/
-		/*}*/
+		if (entry-pol != POLARIZATION_OFF) {
+			fprintf(fp, \tPOLARIZATION = %s\n,
+dvb_sat_pol_name[entry-pol]);
+		}
 
 		if (entry-sat_number = 0) {
 			fprintf(fp, \tSAT_NUMBER = %d\n,
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index d00a09e..89f8e88 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -272,8 +272,7 @@ static int dvbsat_scr_odu_channel_change(struct dvb_v5_fe_parms *parms, struct d
 static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms *parms, uint16_t t)
 {
 	int rc;
-	enum dvb_sat_polarization pol;
-	dvb_fe_retrieve_parm(parms, DTV_POLARIZATION, pol);
+	enum dvb_sat_polarization pol = parms-pol;
 	int pol_v = (pol == POLARIZATION_V) || (pol == POLARIZATION_R);
 	int high_band = parms-high_band;
 	int sat_number = parms-sat_number;
@@ -284,12 +283,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms *parms, uint16_t t)
 
 	if (!lnb-rangeswitch) {
 		/*
-		 * Bandstacking and single LO may not be using DISEqC
-		 */
-		if (sat_number  0)
-			return 0;
-
-		/*
 		 * Bandstacking switches don't use 2 bands nor use
 		 * DISEqC for setting the polarization. It also doesn't
 		 * use any tone/tone burst
@@ -297,11 +290,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms *parms, uint16_t t)
 		pol_v = 0;
 		high_band = 1;
 	} else {
-		if (sat_number  0) {
-			dvb_logerr(Need a satellite number for DISEqC);
-			return -EINVAL;
-		}
-
 		/* Adjust voltage/tone accordingly */
 		if (parms-sat_number  2) {
 			vol_high = pol_v ? 0 : 1;
@@ -310,32 +298,35 @@ static int dvbsat_diseqc_set_input(struct

[PATCH] stv090x: set status bits when there is no lock

2011-06-01 Thread Guy Martin

Currently, the stv090x driver only set the status bits to SCVYL when
there is a lock. This patch set the right bits even if there is no lock.

Signed-off-by: Guy Martin gms...@tuxicoman.be

--
 drivers/media/dvb/frontends/stv090x.c |   35 ++--
 1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv090x.c 
b/drivers/media/dvb/frontends/stv090x.c
index 52d8712..ebda419 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3463,9 +3463,15 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe, struct dvb_fron
 static int stv090x_read_status(struct dvb_frontend *fe, enum fe_status *status)
 {
struct stv090x_state *state = fe-demodulator_priv;
-   u32 reg;
+   u32 reg, dstatus;
u8 search_state;
 
+   *status = 0;
+
+   dstatus = STV090x_READ_DEMOD(state, DSTATUS);
+   if (STV090x_GETFIELD_Px(dstatus, CAR_LOCK_FIELD))
+   *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER;
+
reg = STV090x_READ_DEMOD(state, DMDSTATE);
search_state = STV090x_GETFIELD_Px(reg, HEADER_MODE_FIELD);
 
@@ -3474,41 +3480,30 @@ static int stv090x_read_status(struct dvb_frontend *fe, 
enum fe_status *status)
case 1: /* first PLH detected */
default:
dprintk(FE_DEBUG, 1, Status: Unlocked (Searching ..));
-   *status = 0;
break;
 
case 2: /* DVB-S2 mode */
dprintk(FE_DEBUG, 1, Delivery system: DVB-S2);
-   reg = STV090x_READ_DEMOD(state, DSTATUS);
-   if (STV090x_GETFIELD_Px(reg, LOCK_DEFINITIF_FIELD)) {
+   if (STV090x_GETFIELD_Px(dstatus, LOCK_DEFINITIF_FIELD)) {
reg = STV090x_READ_DEMOD(state, PDELSTATUS1);
if (STV090x_GETFIELD_Px(reg, PKTDELIN_LOCK_FIELD)) {
+   *status |= FE_HAS_VITERBI;
reg = STV090x_READ_DEMOD(state, TSSTATUS);
-   if (STV090x_GETFIELD_Px(reg, 
TSFIFO_LINEOK_FIELD)) {
-   *status = FE_HAS_SIGNAL |
- FE_HAS_CARRIER |
- FE_HAS_VITERBI |
- FE_HAS_SYNC |
- FE_HAS_LOCK;
-   }
+   if (STV090x_GETFIELD_Px(reg, 
TSFIFO_LINEOK_FIELD))
+   *status |= FE_HAS_SYNC | FE_HAS_LOCK;
}
}
break;
 
case 3: /* DVB-S1/legacy mode */
dprintk(FE_DEBUG, 1, Delivery system: DVB-S);
-   reg = STV090x_READ_DEMOD(state, DSTATUS);
-   if (STV090x_GETFIELD_Px(reg, LOCK_DEFINITIF_FIELD)) {
+   if (STV090x_GETFIELD_Px(dstatus, LOCK_DEFINITIF_FIELD)) {
reg = STV090x_READ_DEMOD(state, VSTATUSVIT);
if (STV090x_GETFIELD_Px(reg, LOCKEDVIT_FIELD)) {
+   *status |= FE_HAS_VITERBI;
reg = STV090x_READ_DEMOD(state, TSSTATUS);
-   if (STV090x_GETFIELD_Px(reg, 
TSFIFO_LINEOK_FIELD)) {
-   *status = FE_HAS_SIGNAL |
- FE_HAS_CARRIER |
- FE_HAS_VITERBI |
- FE_HAS_SYNC |
- FE_HAS_LOCK;
-   }
+   if (STV090x_GETFIELD_Px(reg, 
TSFIFO_LINEOK_FIELD))
+   *status |= FE_HAS_SYNC | FE_HAS_LOCK;
}
}
break;
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


STV6110 FE_READ_STATUS implementation

2011-05-24 Thread Guy Martin

Hi Manu,

I'm currently writing an application that needs to know the detailed
frontend status when there is no lock.
As far as I can see from the sources, the code will only set the right
status when there is a lock in stv6110x_get_status().

Does the STV6110 supports reporting of signal, carrier, viterbi and
sync ?

I'd be happy to implement that if it does but I wasn't able to find the
datasheet. Do you have that available ?

Regards,
  Guy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: STV090x FE_READ_STATUS implementation

2011-05-24 Thread Guy Martin
On Tue, 24 May 2011 19:47:17 +0200
Sébastien RAILLARD (COEXSI) s...@coexsi.fr wrote:

  Does the STV6110 supports reporting of signal, carrier, viterbi and
  sync ?
  
 
 I've done some tests with the CineS2, that is using the STV6110A as
 the tuner and the STV0903 as the demodulator.
 
 The values you are searching for don't come from the tuner, but the
 demodulator.
 
 In my case, the STV0903 is reporting the five following states :
 SCVYL.
 

Indeed, after some more troubleshooting, I found out that the problem
is not in the STV6110 but in the STV090X code. The card I'm using is a
TT S2-1600.

The function stv090x_read_status() only reports the status when locked.

I couldn't find the datasheet either for this one. Manu is the
maintainer as well. Maybe he has more input on this.

In the meantime, I'll give a closer look at the code see if I can figure
out a way to fix that.


Thanks,
  Guy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: STV090x FE_READ_STATUS implementation

2011-05-24 Thread Guy Martin
On Tue, 24 May 2011 21:05:33 +0200
Sébastien RAILLARD (COEXSI) s...@coexsi.fr wrote:

 
 
   In my case, the STV0903 is reporting the five following states :
   SCVYL.
  
  
  Indeed, after some more troubleshooting, I found out that the
  problem is not in the STV6110 but in the STV090X code. The card I'm
  using is a TT S2-1600.
  
  The function stv090x_read_status() only reports the status when
  locked.
  
  I couldn't find the datasheet either for this one. Manu is the
  maintainer as well. Maybe he has more input on this.
  
 
 Strange, as it must be the same demodulator and code as for the
 CineS2!

I think there is some missunderstanding about the issue I'm facing.
When I have a lock, it does report all the SCVYL bits.
The problem occurs when there is no lock. For instance if you try to
tune to a transponder with an invalid symbol rate, you should get
SIGNAL and CARRIER but no SYNC.

Provided the demod would report that correctly, that'd allow me to try
other possible symbol rate and only do so when the demod detects a
carrier wave.

Since I'm probing a lot of frequencies, trying ~10 possible
symbol rates when there isn't a signal slows down the process a lot.


 
 Not easy to get the datasheets from ST, they have never replied to my
 enquiries...
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Disable dynamic current limit for ttpci budget cards

2011-05-21 Thread Guy Martin

Disable dynamic current limit for ttpci budget cards.
According to the ISL6423 datasheet, if dynamic current limiting is turned on,
the static limit is ignored and the current drawn can be as high as 990mW.
This is not what we want as it might overload the PCI bus. Disabling
dynamic limit also avoid issues with rotors and DiSEqC switches which
might require a higher current for a short period when powered on.

Signed-off-by: Guy Martin gms...@tuxicoman.be

--
 drivers/media/dvb/ttpci/budget.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index d238fb9..91340ab 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -462,7 +462,7 @@ static struct stv6110x_config tt1600_stv6110x_config = {
 
 static struct isl6423_config tt1600_isl6423_config = {
.current_max= SEC_CURRENT_515m,
-   .curlim = SEC_CURRENT_LIM_ON,
+   .curlim = SEC_CURRENT_LIM_OFF,
.mod_extern = 1,
.addr   = 0x08,
 };
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Well supported USB DVB-C device?

2011-03-10 Thread Guy Martin
On Mon, 28 Feb 2011 02:28:37 +0200
Antti Palosaari cr...@iki.fi wrote:

 
 I am not sure which is status of TT CT-3650, it could be other one
 which is working.
 

The CT-3650 works well. I belive everything works (CI, IR) but DVB-T is
not yet implemented on that one.

HTH,
  Guy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Simultaneous recordings from one frontend

2011-03-09 Thread Guy Martin

Hi Pascal,

I've written a very small program that does just that :
https://svn.tuxicoman.be/listing.php?repname=dvbsplit
It's a quick hack, there is probably a better way to do this but at
least it works :)

To get the sources : svn checkout
https://svn.tuxicoman.be/svn/dvbsplit/trunk dvbsplit. Check the readme
for compilation.

You'll need to tune to the right TP with `{stc}zap -r`, then start it
and it will dump everything in the directory.

HTH,
  Guy

On Wed, 9 Mar 2011 15:20:06 +0100
Pascal Jürgens  lists.pascal.juerg...@googlemail.com wrote:

 Hi all,
 
 SUMMARY: What's the best available tool for demultiplexing into
 multiple simultaneous recordings (files)?
 
 I'm looking for a way to record a program (video, audio, subtitle,
 teletext PIDs) to overlapping files (ie, files2 should start 5
 minutes before file1 ends). This means that two readers need to
 access the card at once. As far as I can tell from past discussions
 [1], this is not a feature that's currently present or planned in the
 kernel.
 
 So while searching for a userspace app that is capable of this, I
 found two options[3]:
 
 - Adam Charrett's dvbstreamer [2] seems to run a sort-of ringbuffer
 and can output to streams and files. However, it's not all too
 stable, especially when using the remote control protocol and in low
 signal situations.
 
 - the RTP streaming apps (dvblast, mumudvb, dvbyell etc.) are
 designed to allow multiple listeners. The ideal solution would be
 something like an interface-local ipv6 multicast. Sadly, I haven't
 gotten that to work [4].
 
 Hence my questions are:
 - Am I doing something wrong and is there actually an easy way to
 stream to two files locally?
 - Is there some other solution that I'm not aware of that fits my
 scenario perfectly?
 
 Thanks in advance,
 regards,
 Pascal Juergens
 
 [1]
 http://www.linuxtv.org/pipermail/linux-dvb/2008-February/024093.html /
 http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/15413
 [2] http://sourceforge.net/projects/dvbstreamer/
 
 [3] There's also the Linux::DVB::DVBT perl extension, but in my tests
 it wasn't happy about recording anything: timed out waiting for
 data : Inappropriate ioctl for device at /usr/local/bin/dvbt-record
 line 53
 
 [4] dvblast, for example, gives warning: getaddrinfo error: Name or
 service not known error: Invalid target address for -d switch when
 using [ff01::1%eth0] as the target address. Additionally, I wasn't
 able to consume a regular ipv4 multicast with two instances of
 mplayer - the first one worked, the second one couldn't access the
 url.-- To unsubscribe from this list: send the line unsubscribe
 linux-media in the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Status of the patches under review (85 patches) and some misc notes about the devel procedures

2010-05-27 Thread Guy Martin

Hi Mauro,


Sorry for the delay, I was abroad.
Let me detail the issue a bit more.

In budget.c, the the frontend is attached this way :

budget-dvb_frontend = dvb_attach(stv090x_attach,
tt1600_stv090x_config, budget-i2c_adap, STV090x_DEMODULATOR_0);

This means that the tt1600_stv090x_config structure will be common for
all the cards.

Then the tuner is attached to the frontend :

ctl = dvb_attach(stv6110x_attach, budget-dvb_frontend,
tt1600_stv6110x_config, budget-i2c_adap);

Once the tuner is attached, the ops are copied to the config :
tt1600_stv090x_config.tuner_sleep = ctl-tuner_sleep;

This results in the ops being set for subsequently attached cards while
fe-tuner_priv is NULL.

This is why a check for tuner_priv being set is mandatory when calling
tuner_sleep(). However as pointed out, it may not be the best fix.

Regards,
  Guy



On Fri, 07 May 2010 22:26:13 -0300
Mauro Carvalho Chehab mche...@redhat.com wrote:

 Manu Abraham wrote:
  On Fri, May 7, 2010 at 4:39 PM, Mauro Carvalho Chehab
  mche...@redhat.com wrote:
  Hi,
 
  
  This is the summary of the patches that are currently under review.
  Each patch is represented by its submission date, the subject (up
  to 70 chars) and the patchwork link (if submitted via email).
 
  P.S.: This email is c/c to the developers that some review action
  is expected.
 
  May, 7 2010: [v2] stv6110x Fix kernel null pointer deref when
  plugging two TT s2-16 http://patchwork.kernel.org/patch/97612
  
  
  How is this patch going to fix a NULL ptr dereference when more
  than 1 card is plugged in ? The patch doesn't seem to do what the
  patch title implies. At least the patch title seems to be wrong.
  Maybe the patch is supposed to check for a possible NULL ptr
  dereference when put to sleep ?
 
 (c/c patch author, to be sure that he'll see your explanation request)
 
 His original patch is at:
   https://patchwork.kernel.org/patch/91929/
 
 The original description with the bug were much better than version 2.
 
 From his OOPS log and description, I suspect that he's facing some
 sort of race condition with the two cards. 
 
 This fix seems still valid (with an updated comment), as his dump
 proofed that there are some cases where fe-tuner_priv can be null, 
 generating an OOPS, but it seems that his patch is combating
 the effect, and not the cause.
 
 So, I am for adding his patch for now, and then work on a more
 complete approach for the two cards environment.
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] stv6110x Fix kernel null pointer deref when plugging two TT s2-1600

2010-05-07 Thread Guy Martin

Hi Mauro,

 This fix seem to be at the wrong place. There's nothing on stv090x.c
 that require a not null value for fe-tuner_priv.

Thanks for the review !

 So, a better fix for your bug is to add a check for fe-tuner_priv
 inside stv6110x_sleep().


Fix initialization of the TT s2-1600 card when plugging two of them in
the same box. Check for fe-tuner_priv to be set when
stv6110x_sleep() is called.

Signed-off-by : Guy Martin gms...@tuxicoman.be


Regards,
  Guy

diff -r 4a8d6d981f07 linux/drivers/media/dvb/frontends/stv6110x.c
--- a/linux/drivers/media/dvb/frontends/stv6110x.c	Wed May 05 11:58:44 2010 -0300
+++ b/linux/drivers/media/dvb/frontends/stv6110x.c	Fri May 07 08:51:18 2010 +0200
@@ -302,7 +302,10 @@
 
 static int stv6110x_sleep(struct dvb_frontend *fe)
 {
-	return stv6110x_set_mode(fe, TUNER_SLEEP);
+	if (fe-tuner_priv)
+		return stv6110x_set_mode(fe, TUNER_SLEEP);
+
+	return 0;
 }
 
 static int stv6110x_get_status(struct dvb_frontend *fe, u32 *status)
diff -r 4a8d6d981f07 linux/drivers/media/dvb/ttpci/budget.c
--- a/linux/drivers/media/dvb/ttpci/budget.c	Wed May 05 11:58:44 2010 -0300
+++ b/linux/drivers/media/dvb/ttpci/budget.c	Fri May 07 08:51:18 2010 +0200
@@ -461,8 +461,8 @@
 };
 
 static struct isl6423_config tt1600_isl6423_config = {
-	.current_max		= SEC_CURRENT_515m,
-	.curlim			= SEC_CURRENT_LIM_ON,
+	.current_max		= SEC_CURRENT_800m,
+	.curlim			= SEC_CURRENT_LIM_OFF,
 	.mod_extern		= 1,
 	.addr			= 0x08,
 };


[PATCH] TT CT-3650 DVB-C support

2010-05-07 Thread Guy Martin

Hi linux-media,


Add support for the DVB-C frontend of the TT CT-3650.
DVB-T fe, CI and IR are not implemented.

Signed-off-by: Guy Martin gms...@tuxicoman.be


Regards,
  Guydiff -r 4a8d6d981f07 linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Wed May 05 11:58:44 2010 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Fri May 07 08:40:10 2010 +0200
@@ -198,6 +198,7 @@
 #define USB_PID_AVERMEDIA_A8500x850a
 #define USB_PID_AVERMEDIA_A8050xa805
 #define USB_PID_TECHNOTREND_CONNECT_S2400   0x3006
+#define USB_PID_TECHNOTREND_CONNECT_CT3650		0x300d
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY	0x005a
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2	0x0081
 #define USB_PID_TERRATEC_CINERGY_HT_USB_XE		0x0058
diff -r 4a8d6d981f07 linux/drivers/media/dvb/dvb-usb/ttusb2.c
--- a/linux/drivers/media/dvb/dvb-usb/ttusb2.c	Wed May 05 11:58:44 2010 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/ttusb2.c	Fri May 07 08:40:10 2010 +0200
@@ -29,6 +29,8 @@
 
 #include tda826x.h
 #include tda10086.h
+#include tda1002x.h
+#include tda827x.h
 #include lnbp21.h
 
 /* debug */
@@ -159,7 +161,17 @@
 	.xtal_freq = TDA10086_XTAL_16M,
 };
 
-static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
+static struct tda10023_config tda10023_config = {
+	.demod_address = 0x0c,
+	.invert = 0,
+	.xtal = 1600,
+	.pll_m = 11,
+	.pll_p = 3,
+	.pll_n = 1,
+	.deltaf = 0xa511,
+};
+
+static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap)
 {
 	if (usb_set_interface(adap-dev-udev,0,3)  0)
 		err(set interface to alts=3 failed);
@@ -172,7 +184,27 @@
 	return 0;
 }
 
-static int ttusb2_tuner_attach(struct dvb_usb_adapter *adap)
+static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap)
+{
+	if (usb_set_interface(adap-dev-udev,0,3)  0)
+		err(set interface to alts=3 failed);
+	if ((adap-fe = dvb_attach(tda10023_attach, tda10023_config, adap-dev-i2c_adap, 0x48)) == NULL) {
+		deb_info(TDA10023 attach failed\n);
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap) {
+
+	if (dvb_attach(tda827x_attach, adap-fe, 0x61, adap-dev-i2c_adap, NULL) == NULL) {
+		printk(KERN_ERR %s: No tda827x found!\n, __func__);
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap)
 {
 	if (dvb_attach(tda826x_attach, adap-fe, 0x60, adap-dev-i2c_adap, 0) == NULL) {
 		deb_info(TDA8263 attach failed\n);
@@ -189,6 +221,7 @@
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties ttusb2_properties;
 static struct dvb_usb_device_properties ttusb2_properties_s2400;
+static struct dvb_usb_device_properties ttusb2_properties_ct3650;
 
 static int ttusb2_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
@@ -196,6 +229,8 @@
 	if (0 == dvb_usb_device_init(intf, ttusb2_properties,
  THIS_MODULE, NULL, adapter_nr) ||
 	0 == dvb_usb_device_init(intf, ttusb2_properties_s2400,
+ THIS_MODULE, NULL, adapter_nr) ||
+	0 == dvb_usb_device_init(intf, ttusb2_properties_ct3650,
  THIS_MODULE, NULL, adapter_nr))
 		return 0;
 	return -ENODEV;
@@ -206,6 +241,8 @@
 	{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_450E) },
 	{ USB_DEVICE(USB_VID_TECHNOTREND,
 		USB_PID_TECHNOTREND_CONNECT_S2400) },
+	{ USB_DEVICE(USB_VID_TECHNOTREND,
+		USB_PID_TECHNOTREND_CONNECT_CT3650) },
 	{}		/* Terminating entry */
 };
 MODULE_DEVICE_TABLE (usb, ttusb2_table);
@@ -223,8 +260,8 @@
 		{
 			.streaming_ctrl   = NULL, // ttusb2_streaming_ctrl,
 
-			.frontend_attach  = ttusb2_frontend_attach,
-			.tuner_attach = ttusb2_tuner_attach,
+			.frontend_attach  = ttusb2_frontend_tda10086_attach,
+			.tuner_attach = ttusb2_tuner_tda826x_attach,
 
 			/* parameter for the MPEG2-data transfer */
 			.stream = {
@@ -275,8 +312,8 @@
 		{
 			.streaming_ctrl   = NULL,
 
-			.frontend_attach  = ttusb2_frontend_attach,
-			.tuner_attach = ttusb2_tuner_attach,
+			.frontend_attach  = ttusb2_frontend_tda10086_attach,
+			.tuner_attach = ttusb2_tuner_tda826x_attach,
 
 			/* parameter for the MPEG2-data transfer */
 			.stream = {
@@ -310,6 +347,52 @@
 	}
 };
 
+static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
+	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+	.usb_ctrl = CYPRESS_FX2,
+
+	.size_of_priv = sizeof(struct ttusb2_state),
+
+	.num_adapters = 1,
+	.adapter = {
+		{
+			.streaming_ctrl   = NULL,
+
+			.frontend_attach  = ttusb2_frontend_tda10023_attach,
+			.tuner_attach = ttusb2_tuner_tda827x_attach,
+
+			/* parameter for the MPEG2-data transfer */
+			.stream = {
+.type = USB_ISOC,
+.count = 5,
+.endpoint = 0x02,
+.u = {
+	.isoc = {
+		.framesperurb = 4,
+		.framesize = 940,
+		.interval = 1,
+	}
+}
+			}
+		},
+	},
+
+	.power_ctrl   = ttusb2_power_ctrl,
+	.identify_state   = ttusb2_identify_state,
+
+	.i2c_algo = ttusb2_i2c_algo

Re: [PATCH v2] stv6110x Fix kernel null pointer deref when plugging two TT s2-1600

2010-05-07 Thread Guy Martin

Hi Mauro,

Seems that I've sent the wrong patch. It contained additional things
which are irrelevant.

Attached the correct one.

Signed-off-by : Guy Martin gms...@tuxicoman.be

Regards,
  Guy

On Fri, 7 May 2010 09:05:15 +0200
Guy Martin gms...@tuxicoman.be wrote:

 
 Hi Mauro,
 
  This fix seem to be at the wrong place. There's nothing on stv090x.c
  that require a not null value for fe-tuner_priv.
 
 Thanks for the review !
 
  So, a better fix for your bug is to add a check for fe-tuner_priv
  inside stv6110x_sleep().
 
 
 Fix initialization of the TT s2-1600 card when plugging two of them in
 the same box. Check for fe-tuner_priv to be set when
 stv6110x_sleep() is called.
 
 Signed-off-by : Guy Martin gms...@tuxicoman.be
 
 
 Regards,
   Guy
 

diff -r 4a8d6d981f07 linux/drivers/media/dvb/frontends/stv6110x.c
--- a/linux/drivers/media/dvb/frontends/stv6110x.c	Wed May 05 11:58:44 2010 -0300
+++ b/linux/drivers/media/dvb/frontends/stv6110x.c	Fri May 07 08:51:18 2010 +0200
@@ -302,7 +302,10 @@
 
 static int stv6110x_sleep(struct dvb_frontend *fe)
 {
-	return stv6110x_set_mode(fe, TUNER_SLEEP);
+	if (fe-tuner_priv)
+		return stv6110x_set_mode(fe, TUNER_SLEEP);
+
+	return 0;
 }
 
 static int stv6110x_get_status(struct dvb_frontend *fe, u32 *status)


Re: [PATCH] TT S2-1600 allow more current for diseqc

2010-04-28 Thread Guy Martin

Hi Andre,

On Wed, 28 Apr 2010 14:29:10 +0200
André Weidemann andre.weidem...@web.de wrote:

 
 How come there is such a high current drain to drive the switch plus
 the LNBs? From what I understand, the switch should only power one
 LNB at a time. Usually the switch plus the LNB should not drain more
 than 300-400mA, or am I wrong here?

This is what I understood as well. It's cheap switch and LNBs so
that may explain it :)

I don't know how I can measure the current being drained tho. I only
found out that increasing the limit made my setup work.

It may be as well that the isl6423 driver doesnt' set the limit
correctly and configures a lower current limit than what is expected.


 
  Is there another way to solve this ?
  Maybe add a module parameter for people who want to override the
  default ?
 
 
 I think this could be done. Nevertheless, the card would still
 operate outside its specification.


Ok I'll work on a patch in that direction. Probably an integer parameter
with multiple possible values allowing to choose the limit or disable
it and add a big fat warning along the way.

Cheers,
  Guy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Xawtv sparc 64bit fix

2010-04-26 Thread Guy Martin

Hi Mauro,

Thanks for the feedback. Here is the fixed version.

Cheers,
  Guy

On Sun, 25 Apr 2010 13:55:44 -0300
Mauro Carvalho Chehab mche...@redhat.com wrote:

 Guy Martin wrote:
  
  Hi,
  
  Here is an old patch of mine which I tried to submit in 2006 but
  never got it. I didn't really know who was xawtv's maintainer at
  that time.
  
  
  
  The calculation to compute the 64bit alignement in struct-dump.c is
  plain wrong. The alignment has to be computed with a structure
  containing a char and then a 64bit integer and then substract the
  pointer of the 64bit int to the one of the char.
  
  This fix v4l-info doing a Bus Error on sparc with structs containing
  64 bit integer following a non 64bit field aligned on a 8 byte
  boundary like v4l2_standard.
  
  
  Signed-off-by: Guy Martin gms...@tuxicoman.be
 
 I tried to compile it (x86_64 arch) and your patch produced two
 warnings:
 
 ../structs/struct-dump.c: In function ‘print_struct’:
 ../structs/struct-dump.c:48: warning: cast from pointer to integer of
 different size ../structs/struct-dump.c:48: warning: cast from
 pointer to integer of different size
 
 Could you please fix it?
 
  
  
  Regards,
Guy
  
 
 

diff --git a/structs/struct-dump.c b/structs/struct-dump.c
index 0ee7fc8..49bfe2d 100644
--- a/structs/struct-dump.c
+++ b/structs/struct-dump.c
@@ -43,7 +43,9 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 	int16_t  s16;
 	uint8_t  u8;
 	int8_t   s8;
-	int al = sizeof(long)-1; /* struct + union + 64bit alignment */
+	struct al64_t { char c; uint64_t t; } al64_t;
+	int al = sizeof(long)-1; /* struct + union */
+	int al64 = (unsigned long)al64_t.t - (unsigned long)al64_t.c - 1; /* 64 bit alignement */
 	void *p;
 	unsigned int i,j,first;
 
@@ -149,7 +151,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 			ptr += 4;
 			break;
 		case BITS64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			u64 = *((uint64_t*)ptr);
 			first = 1;
 			fprintf(fp,0x% PRIx64  [,u64);
@@ -166,13 +168,13 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 			break;
 
 		case UINT64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			u64 = *((uint64_t*)ptr);
 			fprintf(fp,% PRIu64,u64);
 			ptr += 8;
 			break;
 		case SINT64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			s64 = *((int64_t*)ptr);
 			fprintf(fp,% PRId64,s64);
 			ptr += 8;


Xawtv sparc 64bit fix

2010-04-23 Thread Guy Martin


Hi,

Here is an old patch of mine which I tried to submit in 2006 but never
got it. I didn't really know who was xawtv's maintainer at that time.



The calculation to compute the 64bit alignement in struct-dump.c is
plain wrong. The alignment has to be computed with a structure
containing a char and then a 64bit integer and then substract the
pointer of the 64bit int to the one of the char.

This fix v4l-info doing a Bus Error on sparc with structs containing
64 bit integer following a non 64bit field aligned on a 8 byte boundary
like v4l2_standard.


Signed-off-by: Guy Martin gms...@tuxicoman.be


Regards,
  Guydiff --git a/structs/struct-dump.c b/structs/struct-dump.c
index 0ee7fc8..ba1dc6f 100644
--- a/structs/struct-dump.c
+++ b/structs/struct-dump.c
@@ -43,7 +43,9 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 	int16_t  s16;
 	uint8_t  u8;
 	int8_t   s8;
-	int al = sizeof(long)-1; /* struct + union + 64bit alignment */
+	struct al64_t { char c; uint64_t t; } al64_t;
+	int al = sizeof(long)-1; /* struct + union */
+	int al64 = (unsigned)al64_t.t - (unsigned)al64_t.c - 1; /* 64 bit alignement */
 	void *p;
 	unsigned int i,j,first;
 
@@ -149,7 +151,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 			ptr += 4;
 			break;
 		case BITS64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			u64 = *((uint64_t*)ptr);
 			first = 1;
 			fprintf(fp,0x% PRIx64  [,u64);
@@ -166,13 +168,13 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
 			break;
 
 		case UINT64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			u64 = *((uint64_t*)ptr);
 			fprintf(fp,% PRIu64,u64);
 			ptr += 8;
 			break;
 		case SINT64:
-			ptr = (void*)(((intptr_t)ptr + al)  ~al);
+			ptr = (void*)(((intptr_t)ptr + al64)  ~al64);
 			s64 = *((int64_t*)ptr);
 			fprintf(fp,% PRId64,s64);
 			ptr += 8;


[PATCH] stv090x Fix kernel oops when plugging two cards

2010-04-11 Thread Guy Martin

Hi linux-media,

This patch fix initialization of the TT s2-1600 card when plugging two
of them in the same box. The frontend relies on the fact that
state-config-tuner_sleep is set to put the tuner sleep. However the
config struct is shared amongst all cards. The patch adds a check for
fe-tuner_priv to be set, validating that a tuner has been attached to
the frontend.

This has been introduced in commit 5ff2bc2dc92c on linux-tv's v4l-dvb mercurial.

Signed-off-by : Guy Martin gms...@tuxicoman.be

For reference, here is the null pointer deref :
[   96.521023] saa7146: register extension 'budget dvb'.
[   96.521052] budget dvb :05:00.0: PCI INT A - GSI 16 (level, low) - IRQ 
16
[   96.521070] IRQ 16/: IRQF_DISABLED is not guaranteed on shared IRQs
[   96.521076] saa7146: found saa7146 @ mem c90011182c00 (revision 1, irq 
16) (0x13c2,0x101c). 
[   96.521080] saa7146 (0): dma buffer size 192512
[   96.521081] DVB: registering new adapter (TT-Budget S2-1600 PCI)
[   96.539929] adapter has MAC addr = 00:d0:5c:cc:b0:a2 
[   96.890149] stv6110x_attach: Attaching STV6110x 
[   96.912516] DVB: registering adapter 0 frontend 0 (STV090x Multistandard)...
[   96.912600] budget dvb :05:01.0: PCI INT A - GSI 17 (level, low) - IRQ 
17
[   96.912639] IRQ 17/: IRQF_DISABLED is not guaranteed on shared IRQs
[   96.912667] saa7146: found saa7146 @ mem c90011314800 (revision 1, irq 
17) (0x13c2,0x101c). 
[   96.912673] saa7146 (1): dma buffer size 192512
[   96.912676] DVB: registering new adapter (TT-Budget S2-1600 PCI)
[   96.930893] adapter has MAC addr = 00:d0:5c:cc:b0:a3 
[   97.233478] BUG: unable to handle kernel NULL pointer dereference at 
0010
[   97.233647] IP: [a029c450] stv6110x_set_mode+0x70/0x80 [stv6110x]
[   97.233753] PGD 3c16f067 PUD 3c383067 PMD 0 
[   97.234147] CPU 0 
[   97.234246] Pid: 5200, comm: modprobe Not tainted 2.6.33.2 #1 P5Q SE/P5Q SE
[   97.234317] RIP: 0010:[a029c450]  [a029c450] 
stv6110x_set_mode+0x70/0x80 [stv6110x]
[   97.234456] RSP: 0018:88003c125c98  EFLAGS: 00010246
[   97.234461] RAX: a029c460 RBX: 88003f84d800 RCX: 88003a19e140
[   97.234461] RDX:  RSI: 0001 RDI: 
[   97.234461] RBP: 88003f84d828 R08: 0002 R09: 0004
[   97.234461] R10: 0003 R11: 0010 R12: 88003f84d800
[   97.234461] R13: 88003f84d828 R14: 88003f84d828 R15: 0001
[   97.234461] FS:  7f9f7253e6f0() GS:88000180() 
knlGS:
[   97.234461] CS:  0010 DS:  ES:  CR0: 8005003b
[   97.234461] CR2: 0010 CR3: 3c382000 CR4: 06b0
[   97.234461] DR0:  DR1:  DR2: 
[   97.234461] DR3:  DR6: 0ff0 DR7: 0400
[   97.234461] Process modprobe (pid: 5200, threadinfo 88003c124000, task 
88003e893ac0)
[   97.234461]  88003f84d800 88003f84d828 88003f84d800 
a0292343
[   97.234461] 0 88003f84d828 88003ef70ae0 a0280800 
a02934d2
[   97.234461] 0 a0295260  a02948b0 
88003df79800
[   97.234461]  [a0292343] ? stv090x_sleep+0x33/0x120 [stv090x]
[   97.234461]  [a02934d2] ? stv090x_attach+0x1e2/0x73c [stv090x]
[   97.234461]  [81007cc5] ? dma_generic_alloc_coherent+0xa5/0x160
[   97.234461]  [a026e1f5] ? saa7146_init_one+0x7d5/0x910 [saa7146]
[   97.234461]  [811b84b2] ? local_pci_probe+0x12/0x20
[   97.234461]  [811b87d0] ? pci_device_probe+0x110/0x120
[   97.234461]  [81221788] ? driver_probe_device+0x98/0x1b0
[   97.234461]  [81221933] ? __driver_attach+0x93/0xa0
[   97.234461]  [812218a0] ? __driver_attach+0x0/0xa0 
[   97.234461]  [81220f18] ? bus_for_each_dev+0x58/0x80
[   97.234461]  [8122079d] ? bus_add_driver+0x14d/0x280
[   97.234461]  [a0284000] ? budget_init+0x0/0xc [budget]
[   97.234461]  [81221c29] ? driver_register+0x79/0x170
[   97.234461]  [a0284000] ? budget_init+0x0/0xc [budget]
[   97.234461]  [811b8a48] ? __pci_register_driver+0x58/0xe0
[   97.234461]  [a0284000] ? budget_init+0x0/0xc [budget]
[   97.234461]  [810001d5] ? do_one_initcall+0x35/0x190
[   97.234461]  [81063d37] ? sys_init_module+0xe7/0x260
[   97.234461]  [8100256b] ? system_call_fastpath+0x16/0x1b
[   97.234461] RIP  [a029c450] stv6110x_set_mode+0x70/0x80 [stv6110x]
[   97.234461]  RSP 88003c125c98
[   97.240074] ---[ end trace b53ecef15e99 ]---


Regards,
  Guydiff -r 7c0b887911cf linux/drivers/media/dvb/frontends/stv090x.c
--- a/linux/drivers/media/dvb/frontends/stv090x.c	Mon Apr 05 22:56:43 2010 -0400
+++ b/linux/drivers/media/dvb/frontends/stv090x.c	Sun Apr 11 13:46:43 2010 +0200
@@ -4664,7 +4664,7 @@
 	if (stv090x_i2c_gate_ctrl(state, 1)  0)
 		goto

[PATCH] TT S2-1600 allow more current for diseqc

2010-04-11 Thread Guy Martin

Hi linux-media,

The following patch increases the current limit for the isl6423 chip
on the TT S2-1600 card. This allows DiSEqC to work with more complex
and current demanding configurations.

Signed-off-by: Guy Martin gms...@tuxicoman.be

Regards,
  Guydiff -r 7c0b887911cf linux/drivers/media/dvb/ttpci/budget.c
--- a/linux/drivers/media/dvb/ttpci/budget.c	Mon Apr 05 22:56:43 2010 -0400
+++ b/linux/drivers/media/dvb/ttpci/budget.c	Sun Apr 11 13:46:43 2010 +0200
@@ -461,7 +461,7 @@
 };
 
 static struct isl6423_config tt1600_isl6423_config = {
-	.current_max		= SEC_CURRENT_515m,
+	.current_max		= SEC_CURRENT_800m,
 	.curlim			= SEC_CURRENT_LIM_ON,
 	.mod_extern		= 1,
 	.addr			= 0x08,


Re: [linux-dvb] What is the status of the driver TT CT-3650

2009-11-09 Thread Guy Martin

Hanno,

I've been working on having the CT-3650 supported however I didn't go
very farther than having the dvb-c frontend to work. Nothing else
works : no CI, no DVB-T, no IR.

I've attached a patch which is working for me. Again, only the dvb-c
interface works. Also this patch should definitely not go upstream.
The cold firmware should not be used but it's there because I erased
the eeprom of my card by mistake.

I'm still planning to have a better support for this card but I
unfortunately have other things to work on before.

HTH,
  Guy


On Mon, 09 Nov 2009 11:55:23 +0100
Hanno Zulla a...@hanno.de wrote:

 Hi,
 
  Anyone know how to get this working or this card is in a working
  state under linux. Because if it not working yet I will stop
  wasting my time
 
 Second that request. Is anybody working on a driver for this device?
 Is it worth waiting?
 
 Technotrend DVB products have been good for me in the past and this
 combination of DVB-C with CI is something well suited for my next vdr
 hardware setup.
 
 Thanks,
 
 Hanno
 

diff -r 6f58a5d8c7c6 linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sat Aug 29 09:01:54 2009 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sat Nov 07 12:27:27 2009 +0100
@@ -61,7 +61,7 @@
 #define USB_VID_HUMAX_COEX			0x10b9
 
 /* Product IDs */
-#define USB_PID_ADSTECH_USB2_COLD			0xa333
+//#define USB_PID_ADSTECH_USB2_COLD			0xa333
 #define USB_PID_ADSTECH_USB2_WARM			0xa334
 #define USB_PID_AFATECH_AF90050x9020
 #define USB_PID_AFATECH_AF9015_9015			0x9015
@@ -178,6 +178,7 @@
 #define USB_PID_AVERMEDIA_A8500x850a
 #define USB_PID_AVERMEDIA_A8050xa805
 #define USB_PID_TECHNOTREND_CONNECT_S2400   0x3006
+#define USB_PID_TECHNOTREND_CONNECT_CT3650		0x300d
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY	0x005a
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2	0x0081
 #define USB_PID_TERRATEC_CINERGY_HT_USB_XE		0x0058
diff -r 6f58a5d8c7c6 linux/drivers/media/dvb/dvb-usb/ttusb2.c
--- a/linux/drivers/media/dvb/dvb-usb/ttusb2.c	Sat Aug 29 09:01:54 2009 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/ttusb2.c	Sat Nov 07 12:27:27 2009 +0100
@@ -29,6 +29,9 @@
 
 #include tda826x.h
 #include tda10086.h
+#include tda1002x.h
+#include tda827x.h
+#include tda10048.h
 #include lnbp21.h
 
 /* debug */
@@ -159,7 +162,34 @@
 	.xtal_freq = TDA10086_XTAL_16M,
 };
 
-static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
+static struct tda10023_config tda10023_config = {
+	.demod_address = 0x0c,
+	.invert = 0,
+	.xtal = 1600,
+	.pll_m = 11,
+	.pll_p = 3,
+	.pll_n = 1,
+	.deltaf = 0xa511,
+};
+
+static struct tda10048_config tda10048_config = {
+	.demod_address  = 0x8,
+	.output_mode= TDA10048_SERIAL_OUTPUT,
+	.fwbulkwritelen = TDA10048_BULKWRITE_50,
+	.inversion  = TDA10048_INVERSION_ON,
+	.dtv6_if_freq_khz = TDA10048_IF_3300,
+	.dtv7_if_freq_khz = TDA10048_IF_3800,
+	.dtv8_if_freq_khz = TDA10048_IF_4300,
+	.clk_freq_khz	= TDA10048_CLK_16000,
+	.disable_gate_access = 1,
+};
+
+static struct tda827x_config tda827x_config = {
+	.config = 0,
+//	.switch_addr = 0x4b,
+};
+
+static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap)
 {
 	if (usb_set_interface(adap-dev-udev,0,3)  0)
 		err(set interface to alts=3 failed);
@@ -172,7 +202,40 @@
 	return 0;
 }
 
-static int ttusb2_tuner_attach(struct dvb_usb_adapter *adap)
+static int ttusb2_frontend_tda10048_attach(struct dvb_usb_adapter *adap)
+{
+	if (usb_set_interface(adap-dev-udev,0,3)  0)
+		err(set interface to alts=3 failed);
+
+	if ((adap-fe = dvb_attach(tda10048_attach, tda10048_config, adap-dev-i2c_adap)) == NULL) {
+		deb_info(TDA10048 attach failed\n);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap)
+{
+	if (usb_set_interface(adap-dev-udev,0,3)  0)
+		err(set interface to alts=3 failed);
+	if ((adap-fe = dvb_attach(tda10023_attach, tda10023_config, adap-dev-i2c_adap, 0x48)) == NULL) {
+		deb_info(TDA10023 attach failed\n);
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap) {
+
+	if (dvb_attach(tda827x_attach, adap-fe, 0x60, adap-dev-i2c_adap, tda827x_config) == NULL) {
+		printk(KERN_ERR %s: No tda827x found!\n, __func__);
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap)
 {
 	if (dvb_attach(tda826x_attach, adap-fe, 0x60, adap-dev-i2c_adap, 0) == NULL) {
 		deb_info(TDA8263 attach failed\n);
@@ -189,6 +252,7 @@
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties ttusb2_properties;
 static struct dvb_usb_device_properties ttusb2_properties_s2400;
+static struct dvb_usb_device_properties ttusb2_properties_ct3650;
 
 static int ttusb2_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
@@ -196,6 +260,8 @@
 	if (0 == dvb_usb_device_init(intf, ttusb2_properties,
  THIS_MODULE, NULL, adapter_nr) ||