v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
v2 cover v4l-utils: v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
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(-)
Signature · 1 line
1.8.1.5
PATCH v2 1/6 libdvbv5: Remove buggy parsing of extra DTV_foo parameters
The parsing of those extra parameters is buggy and completely useless since they are parsed individually later on in the code.
--- lib/libdvbv5/dvb-file.c | 25 ------------------------- 1 file changed, 25 deletions(-)
lib/libdvbv5/dvb-file.c +0 -25
@@ -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" )) {
Signature · 1 line
1.8.1.5
Re: [PATCH v2 1/6] libdvbv5: Remove buggy parsing of extra DTV_foo parameters
Quoted 44 lines · On Tue, 18 Jun 2013 16:19:04 +0200 Guy Martin <[email protected]> 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 <[email protected]>--- lib/libdvbv5/dvb-file.c | 25 ------------------------- 1 file changed, 25 deletions(-)lib/libdvbv5/dvb-file.c +0
-25@@ -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" )) {
PATCH v2 2/6 libdvbv5: Add parsing of POLARIZATION
In reply to Guy MartinThis patch add parsing support for the POLARIZATION parameter for the DVBv5 file format.
--- lib/include/dvb-file.h | 1 - lib/libdvbv5/dvb-file.c | 65 ++++++++++++++++++++++--------------------------- 2 files changed, 29 insertions(+), 37 deletions(-)
lib/include/dvb-file.h +0 -1
@@ -35,7 +35,6 @@ struct dvb_entry {char *location; -// enum dvbsat_polarization pol; int sat_number;unsigned freq_bpf;unsigned diseqc_wait;
lib/libdvbv5/dvb-file.c +29 -36
98 lines not on this page · raw message
Signature · 1 line
1.8.1.5
Re: [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION
Quoted 127 lines · On Tue, 18 Jun 2013 16:19:05 +0200 Guy Martin <[email protected]> wrote:
This patch add parsing support for the POLARIZATION parameter for the DVBv5 file format.
Signed-off-by Guy Martin <[email protected]>--- lib/include/dvb-file.h | 1 - lib/libdvbv5/dvb-file.c | 65 ++++++++++++++++++++++--------------------------- 2 files changed, 29 insertions(+), 37 deletions(-)lib/include/dvb-file.h +0
-1@@ -35,7 +35,6 @@ struct dvb_entry {char *location; -// enum dvbsat_polarization pol; int sat_number;unsigned freq_bpf;unsigned diseqc_wait;lib/libdvbv5/dvb-file.c +29
-36@@ -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,
PATCH v2 3/6 libdvbv5: Export dvb_fe_is_satellite()
In reply to Guy MartinThis patch makes the function dvb_fe_is_satellite() availble from libdvbv5. This function is simple but yet very handful to have around.
--- lib/include/dvb-fe.h | 1 + lib/libdvbv5/dvb-fe.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-)
lib/include/dvb-fe.h +1 -0
@@ -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 }
lib/libdvbv5/dvb-fe.c +7 -7
@@ -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 ;
Signature · 1 line
1.8.1.5
Re: [PATCH 3/6] libdvbv5: Export dvb_fe_is_satellite()
Quoted 81 lines · On Tue, 18 Jun 2013 16:19:06 +0200 Guy Martin <[email protected]> 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 <[email protected]>--- lib/include/dvb-fe.h | 1 + lib/libdvbv5/dvb-fe.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-)lib/include/dvb-fe.h +1
-0@@ -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 }lib/libdvbv5/dvb-fe.c +7
-7@@ -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 ;
PATCH v2 4/6 libdvbv5: Fix satellite handling and apply polarization parameter to the frontend
In reply to Guy MartinApply polarization parameters even if a satellite number is not provided. This allow proper setup of the tone and voltage.
--- 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(-)
lib/include/dvb-fe.h +0 -1
@@ -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;
lib/libdvbv5/dvb-sat.c +24 -33
93 lines not on this page · raw message
lib/libdvbv5/dvb-v5-std.c +2 -7
@@ -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 };
Signature · 1 line
1.8.1.5
Re: [PATCH 4/6] libdvbv5: Fix satellite handling and apply polarization parameter to the frontend
Quoted 167 lines · On Tue, 18 Jun 2013 16:19:07 +0200 Guy Martin <[email protected]> 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 <[email protected]>--- 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(-)lib/include/dvb-fe.h +0
-1@@ -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;lib/libdvbv5/dvb-sat.c +24
-33@@ -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);lib/libdvbv5/dvb-v5-std.c +2
-7@@ -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 };
PATCH v2 5/6 libdvbv5: Use a temporary copy of the dvb parameters when tuning
In reply to Guy MartinThis 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.
--- 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(-)
lib/include/dvb-sat.h +0 -1
@@ -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 }
lib/libdvbv5/dvb-fe.c +31 -40
123 lines not on this page · raw message
lib/libdvbv5/dvb-sat.c +0 -11
@@ -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" ,
Signature · 1 line
1.8.1.5
Re: [PATCH 5/6] libdvbv5: Use a temporary copy of the dvb parameters when tuning
Quoted 177 lines · On Tue, 18 Jun 2013 16:19:08 +0200 Guy Martin <[email protected]> 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 theDTV_FREQUENCYis 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 <[email protected]>--- 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(-)lib/include/dvb-sat.h +0
-1@@ -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 }lib/libdvbv5/dvb-fe.c +31
-40@@ -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 ; }lib/libdvbv5/dvb-sat.c +0
-11@@ -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" ,
PATCH v2 6/6 dvbv5-zap: Parse the LNB from the channel file
In reply to Guy MartinParsing the LNB needs to be done for proper tuning.
--- utils/dvb/dvbv5-zap.c | 9 +++++++++ 1 file changed, 9 insertions(+)
utils/dvb/dvbv5-zap.c +9 -0
@@ -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];
Signature · 1 line
1.8.1.5
Re: [PATCH 6/6] dvbv5-zap: Parse the LNB from the channel file
Quoted 27 lines · On Tue, 18 Jun 2013 16:19:09 +0200 Guy Martin <[email protected]> wrote:
Parsing the LNB needs to be done for proper tuning.
Signed-off-by Guy Martin <[email protected]>--- utils/dvb/dvbv5-zap.c | 9 +++++++++ 1 file changed, 9 insertions(+)utils/dvb/dvbv5-zap.c +9
-0@@ -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];
Quoted 27 lines · On Tue, 18 Jun 2013 16:19:03 +0200 Guy Martin <[email protected]> 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 theDTV_POLARIZATIONproperty.Guy
Guy Martin (6):
libdvbv5: Remove buggy parsing of extraDTV_fooparameters
libdvbv5: Add parsing of POLARIZATION
libdvbv5: Exportdvb_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 filelib/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(-)