aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-28 09:21:56 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-28 15:46:06 -0200
commita710e1bb7c6803a9347d3899b9129d887221985f (patch)
tree4b7f118cf621d083d1efce278df0fffd596d6a57
parent5ea1bd38229f7fe370173b906e8dc9c2ab83ea10 (diff)
dvb-sat: fix logic that sets the satellite number
The logic that sets DiSEqC logic is broken: it doesn't work for satellite #0, as the check logic there is wrong. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--lib/libdvbv5/dvb-sat.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index edfcc6dd..5d06dfa3 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -488,6 +488,10 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
int mini_b = 0;
struct diseqc_cmd cmd;
+ /* Negative numbers means to not use a DiSEqC switch */
+ if (parms->p.sat_number < 0)
+ return 0;
+
if (!lnb->freqrange[0].rangeswitch) {
/*
* Bandstacking switches don't use 2 bands nor use
@@ -511,31 +515,29 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
if (rc)
return rc;
- if (parms->p.sat_number > 0) {
- rc = dvb_fe_sec_tone(&parms->p, SEC_TONE_OFF);
- if (rc)
- return rc;
-
- usleep(15 * 1000);
+ rc = dvb_fe_sec_tone(&parms->p, 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->p.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->p, mini_b);
- if (rc)
- return rc;
- usleep(15 * 1000);
+ if (rc) {
+ dvb_logerr(_("sending diseq failed"));
+ return rc;
}
+ usleep((15 + parms->p.diseqc_wait) * 1000);
+
+ rc = dvb_fe_diseqc_burst(&parms->p, mini_b);
+ if (rc)
+ return rc;
+ usleep(15 * 1000);
rc = dvb_fe_sec_tone(&parms->p, tone_on ? SEC_TONE_ON : SEC_TONE_OFF);

Privacy Policy