* [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
@ 2013-06-18 14:19 Guy Martin
2013-06-18 14:19 ` [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters Guy Martin
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:28 ` André Roth
2013-06-18 14:19 ` [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION Guy Martin
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
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 <gmsoft@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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
2013-06-18 14:19 ` [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:29 ` André Roth
2013-06-18 14:19 ` [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite() Guy Martin
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
This patch add parsing support for the POLARIZATION parameter for the DVBv5 file format.
Signed-off-by: Guy Martin <gmsoft@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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite()
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
2013-06-18 14:19 ` [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters Guy Martin
2013-06-18 14:19 ` [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:29 ` André Roth
2013-06-18 14:19 ` [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend Guy Martin
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
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 <gmsoft@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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
` (2 preceding siblings ...)
2013-06-18 14:19 ` [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite() Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:30 ` André Roth
2013-06-18 14:19 ` [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning Guy Martin
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
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 <gmsoft@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 {
unsigned freq_bpf;
/* Satellite specific stuff, used internally */
- //enum dvb_sat_polarization pol;
int high_band;
unsigned diseqc_wait;
unsigned freq_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,
DTV_SYMBOL_RATE,
DTV_INNER_FEC,
- /*DTV_VOLTAGE,*/
- /*DTV_TONE,*/
DTV_POLARIZATION,
0
};
@@ -136,8 +134,6 @@ const unsigned int sys_dvbs2_props[] = {
DTV_INVERSION,
DTV_SYMBOL_RATE,
DTV_INNER_FEC,
- /*DTV_VOLTAGE,*/
- /*DTV_TONE,*/
DTV_MODULATION,
DTV_PILOT,
DTV_ROLLOFF,
@@ -150,9 +146,8 @@ const unsigned int sys_turbo_props[] = {
DTV_INVERSION,
DTV_SYMBOL_RATE,
DTV_INNER_FEC,
- DTV_VOLTAGE,
- DTV_TONE,
DTV_MODULATION,
+ DTV_POLARIZATION,
0
};
@@ -161,8 +156,8 @@ const unsigned int sys_isdbs_props[] = {
DTV_INVERSION,
DTV_SYMBOL_RATE,
DTV_INNER_FEC,
- DTV_VOLTAGE,
DTV_ISDBS_TS_ID_LEGACY,
+ DTV_POLARIZATION,
0
};
--
1.8.1.5
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
` (3 preceding siblings ...)
2013-06-18 14:19 ` [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:31 ` André Roth
2013-06-18 14:19 ` [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file Guy Martin
2013-07-02 18:04 ` [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools André Roth
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
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 <gmsoft@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; bw++) {
if (fe_bandwidth_name[bw] == v3_parms.u.ofdm.bandwidth)
break;
}
- dvb_fe_retrieve_parm(parms, DTV_BANDWIDTH_HZ, &bw);
- dvb_fe_retrieve_parm(parms, DTV_CODE_RATE_HP, &v3_parms.u.ofdm.code_rate_HP);
- dvb_fe_retrieve_parm(parms, DTV_CODE_RATE_LP, &v3_parms.u.ofdm.code_rate_LP);
- dvb_fe_retrieve_parm(parms, DTV_MODULATION, &v3_parms.u.ofdm.constellation);
- dvb_fe_retrieve_parm(parms, DTV_TRANSMISSION_MODE, &v3_parms.u.ofdm.transmission_mode);
- dvb_fe_retrieve_parm(parms, DTV_GUARD_INTERVAL, &v3_parms.u.ofdm.guard_interval);
- dvb_fe_retrieve_parm(parms, DTV_HIERARCHY, &v3_parms.u.ofdm.hierarchy_information);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_BANDWIDTH_HZ, &bw);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_CODE_RATE_HP, &v3_parms.u.ofdm.code_rate_HP);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_CODE_RATE_LP, &v3_parms.u.ofdm.code_rate_LP);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_MODULATION, &v3_parms.u.ofdm.constellation);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_TRANSMISSION_MODE, &v3_parms.u.ofdm.transmission_mode);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_GUARD_INTERVAL, &v3_parms.u.ofdm.guard_interval);
+ dvb_fe_retrieve_parm(&tmp_parms, DTV_HIERARCHY, &v3_parms.u.ofdm.hierarchy_information);
break;
default:
return -EINVAL;
}
- if (ioctl(parms->fd, FE_SET_FRONTEND, &v3_parms) == -1) {
+ if (ioctl(tmp_parms.fd, FE_SET_FRONTEND, &v3_parms) == -1) {
dvb_perror("FE_SET_FRONTEND");
- if (parms->verbose)
- dvb_fe_prt_parms(parms);
+ if (tmp_parms.verbose)
+ dvb_fe_prt_parms(&tmp_parms);
return -1;
}
-ret:
- /* For satellite, need to recover from LNBf IF frequency */
- if (dvb_fe_is_satellite(parms->current_sys))
- dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
return 0;
}
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index f84b5a4..3cbcf03 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -394,17 +394,6 @@ ret:
return rc;
}
-int dvb_sat_get_parms(struct dvb_v5_fe_parms *parms)
-{
- uint32_t freq = 0;
-
- dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, &freq);
- freq = abs(freq + parms->freq_offset);
- dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
-
- return 0;
-}
-
const char *dvbsat_polarization_name[5] = {
"OFF",
"H",
--
1.8.1.5
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
` (4 preceding siblings ...)
2013-06-18 14:19 ` [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning Guy Martin
@ 2013-06-18 14:19 ` Guy Martin
2013-07-02 18:31 ` André Roth
2013-07-02 18:04 ` [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools André Roth
6 siblings, 1 reply; 14+ messages in thread
From: Guy Martin @ 2013-06-18 14:19 UTC (permalink / raw)
To: linux-media
Parsing the LNB needs to be done for proper tuning.
Signed-off-by: Guy Martin <gmsoft@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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
` (5 preceding siblings ...)
2013-06-18 14:19 ` [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file Guy Martin
@ 2013-07-02 18:04 ` André Roth
6 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:04 UTC (permalink / raw)
To: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:03 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> 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(-)
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters
2013-06-18 14:19 ` [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters Guy Martin
@ 2013-07-02 18:28 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:28 UTC (permalink / raw)
To: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:04 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> 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 <gmsoft@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")) {
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION
2013-06-18 14:19 ` [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION Guy Martin
@ 2013-07-02 18:29 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:29 UTC (permalink / raw)
To: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:05 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> This patch add parsing support for the POLARIZATION parameter for the DVBv5 file format.
>
> Signed-off-by: Guy Martin <gmsoft@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,
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite()
2013-06-18 14:19 ` [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite() Guy Martin
@ 2013-07-02 18:29 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:29 UTC (permalink / raw)
To: Guy Martin; +Cc: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:06 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> 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 <gmsoft@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;
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend
2013-06-18 14:19 ` [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend Guy Martin
@ 2013-07-02 18:30 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:30 UTC (permalink / raw)
To: Guy Martin; +Cc: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:07 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> 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 <gmsoft@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 {
> unsigned freq_bpf;
>
> /* Satellite specific stuff, used internally */
> - //enum dvb_sat_polarization pol;
> int high_band;
> unsigned diseqc_wait;
> unsigned freq_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,
> DTV_SYMBOL_RATE,
> DTV_INNER_FEC,
> - /*DTV_VOLTAGE,*/
> - /*DTV_TONE,*/
> DTV_POLARIZATION,
> 0
> };
> @@ -136,8 +134,6 @@ const unsigned int sys_dvbs2_props[] = {
> DTV_INVERSION,
> DTV_SYMBOL_RATE,
> DTV_INNER_FEC,
> - /*DTV_VOLTAGE,*/
> - /*DTV_TONE,*/
> DTV_MODULATION,
> DTV_PILOT,
> DTV_ROLLOFF,
> @@ -150,9 +146,8 @@ const unsigned int sys_turbo_props[] = {
> DTV_INVERSION,
> DTV_SYMBOL_RATE,
> DTV_INNER_FEC,
> - DTV_VOLTAGE,
> - DTV_TONE,
> DTV_MODULATION,
> + DTV_POLARIZATION,
> 0
> };
>
> @@ -161,8 +156,8 @@ const unsigned int sys_isdbs_props[] = {
> DTV_INVERSION,
> DTV_SYMBOL_RATE,
> DTV_INNER_FEC,
> - DTV_VOLTAGE,
> DTV_ISDBS_TS_ID_LEGACY,
> + DTV_POLARIZATION,
> 0
> };
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning
2013-06-18 14:19 ` [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning Guy Martin
@ 2013-07-02 18:31 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:31 UTC (permalink / raw)
To: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:08 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> 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 <gmsoft@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; bw++) {
> if (fe_bandwidth_name[bw] == v3_parms.u.ofdm.bandwidth)
> break;
> }
> - dvb_fe_retrieve_parm(parms, DTV_BANDWIDTH_HZ, &bw);
> - dvb_fe_retrieve_parm(parms, DTV_CODE_RATE_HP, &v3_parms.u.ofdm.code_rate_HP);
> - dvb_fe_retrieve_parm(parms, DTV_CODE_RATE_LP, &v3_parms.u.ofdm.code_rate_LP);
> - dvb_fe_retrieve_parm(parms, DTV_MODULATION, &v3_parms.u.ofdm.constellation);
> - dvb_fe_retrieve_parm(parms, DTV_TRANSMISSION_MODE, &v3_parms.u.ofdm.transmission_mode);
> - dvb_fe_retrieve_parm(parms, DTV_GUARD_INTERVAL, &v3_parms.u.ofdm.guard_interval);
> - dvb_fe_retrieve_parm(parms, DTV_HIERARCHY, &v3_parms.u.ofdm.hierarchy_information);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_BANDWIDTH_HZ, &bw);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_CODE_RATE_HP, &v3_parms.u.ofdm.code_rate_HP);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_CODE_RATE_LP, &v3_parms.u.ofdm.code_rate_LP);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_MODULATION, &v3_parms.u.ofdm.constellation);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_TRANSMISSION_MODE, &v3_parms.u.ofdm.transmission_mode);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_GUARD_INTERVAL, &v3_parms.u.ofdm.guard_interval);
> + dvb_fe_retrieve_parm(&tmp_parms, DTV_HIERARCHY, &v3_parms.u.ofdm.hierarchy_information);
> break;
> default:
> return -EINVAL;
> }
> - if (ioctl(parms->fd, FE_SET_FRONTEND, &v3_parms) == -1) {
> + if (ioctl(tmp_parms.fd, FE_SET_FRONTEND, &v3_parms) == -1) {
> dvb_perror("FE_SET_FRONTEND");
> - if (parms->verbose)
> - dvb_fe_prt_parms(parms);
> + if (tmp_parms.verbose)
> + dvb_fe_prt_parms(&tmp_parms);
> return -1;
> }
> -ret:
> - /* For satellite, need to recover from LNBf IF frequency */
> - if (dvb_fe_is_satellite(parms->current_sys))
> - dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
>
> return 0;
> }
> diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
> index f84b5a4..3cbcf03 100644
> --- a/lib/libdvbv5/dvb-sat.c
> +++ b/lib/libdvbv5/dvb-sat.c
> @@ -394,17 +394,6 @@ ret:
> return rc;
> }
>
> -int dvb_sat_get_parms(struct dvb_v5_fe_parms *parms)
> -{
> - uint32_t freq = 0;
> -
> - dvb_fe_retrieve_parm(parms, DTV_FREQUENCY, &freq);
> - freq = abs(freq + parms->freq_offset);
> - dvb_fe_store_parm(parms, DTV_FREQUENCY, freq);
> -
> - return 0;
> -}
> -
> const char *dvbsat_polarization_name[5] = {
> "OFF",
> "H",
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file
2013-06-18 14:19 ` [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file Guy Martin
@ 2013-07-02 18:31 ` André Roth
0 siblings, 0 replies; 14+ messages in thread
From: André Roth @ 2013-07-02 18:31 UTC (permalink / raw)
To: linux-media
Acked-by: André Roth <neolynx@gmail.com>
On Tue, 18 Jun 2013 16:19:09 +0200
Guy Martin <gmsoft@tuxicoman.be> wrote:
> Parsing the LNB needs to be done for proper tuning.
>
> Signed-off-by: Guy Martin <gmsoft@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];
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-07-02 18:31 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18 14:19 [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools Guy Martin
2013-06-18 14:19 ` [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters Guy Martin
2013-07-02 18:28 ` André Roth
2013-06-18 14:19 ` [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION Guy Martin
2013-07-02 18:29 ` André Roth
2013-06-18 14:19 ` [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite() Guy Martin
2013-07-02 18:29 ` André Roth
2013-06-18 14:19 ` [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend Guy Martin
2013-07-02 18:30 ` André Roth
2013-06-18 14:19 ` [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning Guy Martin
2013-07-02 18:31 ` André Roth
2013-06-18 14:19 ` [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file Guy Martin
2013-07-02 18:31 ` André Roth
2013-07-02 18:04 ` [PATCH v2 0/6] v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools André Roth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.