v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
cover v4l-utils: Fix satellite support in dvbv5-{scan,zap} tools
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(-)
Signature · 1 line
1.8.1.5
PATCH 1/5 libdvbv5: Remove buggy parsing of extra DTV_foo properties
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 +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
PATCH 2/5 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 -1
@@ -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;
lib/libdvbv5/dvb-file.c +9 -10
@@ -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",
Signature · 1 line
1.8.1.5
PATCH 3/5 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 -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
PATCH 4/5 libdvbv5: Apply polarization parameters to the frontend
In reply to Guy MartinApply 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.
lib/include/dvb-fe.h +1 -1
@@ -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;int high_band;unsigned diseqc_wait;unsigned freq_offset;
lib/libdvbv5/dvb-sat.c +25 -35
96 lines not on this page · raw message
lib/libdvbv5/dvb-v5-std.c +0 -9
@@ -125,9 +125,6 @@ const unsigned int sys_dvbs_props[] = {DTV_INVERSION ,DTV_SYMBOL_RATE ,DTV_INNER_FEC , -/*DTV_VOLTAGE,*/ -/*DTV_TONE,*/ -DTV_POLARIZATION , 0 };
@@ -136,12 +133,9 @@ const unsigned int sys_dvbs2_props[] = {DTV_INVERSION ,DTV_SYMBOL_RATE ,DTV_INNER_FEC , -/*DTV_VOLTAGE,*/ -/*DTV_TONE,*/ DTV_MODULATION ,DTV_PILOT ,DTV_ROLLOFF , -DTV_POLARIZATION , 0 };
@@ -150,8 +144,6 @@ const unsigned int sys_turbo_props[] = {DTV_INVERSION ,DTV_SYMBOL_RATE ,DTV_INNER_FEC , -DTV_VOLTAGE , -DTV_TONE ,DTV_MODULATION , 0 };
@@ -161,7 +153,6 @@ const unsigned int sys_isdbs_props[] = {DTV_INVERSION ,DTV_SYMBOL_RATE ,DTV_INNER_FEC , -DTV_VOLTAGE ,DTV_ISDBS_TS_ID_LEGACY , 0 };
Signature · 1 line
1.8.1.5
PATCH 5/5 dvbv5-zap: Copy satellite parameters before tuning dvbv5-scan: Likewise
In reply to Guy MartinCopy satellite parameters to the frontend params. Since an LNB can be specified in the channel/tuning file, set it correctly as well.
utils/dvb/dvbv5-scan.c +14 -0
@@ -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.
utils/dvb/dvbv5-zap.c +14 -0
@@ -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);
Signature · 1 line
1.8.1.5