All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] not use a DiSEqC switch
@ 2017-11-24  8:52 Maksym Veremeyenko
  2017-11-27 19:26 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Maksym Veremeyenko @ 2017-11-24  8:52 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hi,

there is a code in function *dvbsat_diseqc_set_input*:

[...]
	/* Negative numbers means to not use a DiSEqC switch */
	if (parms->p.sat_number < 0)
		return 0;
[...]

if it mean /there is no DiSEqC switch/ then LNB's *polarity* and *band* 
settings still should be applied - attached patch fixes that behavior.

if it mean /current DVB is a slave/ i.e. it is connected to LOOP OUT of 
another DVB, so no need to configure anything, then statement above is 
correct and no patches from this email should be applied.

-- 
Maksym Veremeyenko



[-- Attachment #2: 0003-Fix-setting-band-and-polarity-if-sat_number-is-negat.patch --]
[-- Type: text/plain, Size: 1413 bytes --]

From 57ac346433720c0c9b8ce30a32bdfa1df075fede Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <verem@m1.tv>
Date: Fri, 24 Nov 2017 08:59:41 +0100
Subject: [PATCH 3/4] Fix setting band and polarity if sat_number is negative

---
 lib/libdvbv5/dvb-sat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index a01db72e..8b2fcf7d 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -523,10 +523,6 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 	struct diseqc_cmd cmd;
 	const struct dvb_sat_lnb_priv *lnb = (void *)parms->p.lnb;
 
-	/* Negative numbers means to not use a DiSEqC switch */
-	if (parms->p.sat_number < 0)
-		return 0;
-
 	dvb_fe_retrieve_parm(&parms->p, DTV_POLARIZATION, &pol);
 	pol_v = (pol == POLARIZATION_V) || (pol == POLARIZATION_R);
 
@@ -558,6 +554,9 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 
 	usleep(15 * 1000);
 
+	/* Negative numbers means to not use a DiSEqC switch */
+	if (parms->p.sat_number >= 0)
+	{
 	if (!t)
 		rc = dvbsat_diseqc_write_to_port_group(parms, &cmd, high_band,
 							pol_v, sat_number);
@@ -578,6 +577,7 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 			return rc;
 	}
 	usleep(15 * 1000);
+	}
 
 	rc = dvb_fe_sec_tone(&parms->p, tone_on ? SEC_TONE_ON : SEC_TONE_OFF);
 
-- 
2.13.6


[-- Attachment #3: 0004-Fix-indention-from-last-commit.patch --]
[-- Type: text/plain, Size: 1855 bytes --]

From c700e3db0c855a2675b340e1ee1646678b19bcc6 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <verem@m1.tv>
Date: Fri, 24 Nov 2017 09:02:26 +0100
Subject: [PATCH 4/4] Fix indention from last commit

---
 lib/libdvbv5/dvb-sat.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index 8b2fcf7d..8383cdf7 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -557,26 +557,26 @@ static int dvbsat_diseqc_set_input(struct dvb_v5_fe_parms_priv *parms,
 	/* Negative numbers means to not use a DiSEqC switch */
 	if (parms->p.sat_number >= 0)
 	{
-	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);
-
-	if (rc) {
-		dvb_logerr(_("sending diseq failed"));
-		return rc;
-	}
-	usleep((15 + parms->p.diseqc_wait) * 1000);
-
-	/* miniDiSEqC/Toneburst commands are defined only for up to 2 sattelites */
-	if (parms->p.sat_number < 2) {
-		rc = dvb_fe_diseqc_burst(&parms->p, parms->p.sat_number);
-		if (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);
+
+		if (rc) {
+			dvb_logerr(_("sending diseq failed"));
 			return rc;
-	}
-	usleep(15 * 1000);
+		}
+		usleep((15 + parms->p.diseqc_wait) * 1000);
+
+		/* miniDiSEqC/Toneburst commands are defined only for up to 2 sattelites */
+		if (parms->p.sat_number < 2) {
+			rc = dvb_fe_diseqc_burst(&parms->p, parms->p.sat_number);
+			if (rc)
+				return rc;
+		}
+		usleep(15 * 1000);
 	}
 
 	rc = dvb_fe_sec_tone(&parms->p, tone_on ? SEC_TONE_ON : SEC_TONE_OFF);
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH/RFC] not use a DiSEqC switch
  2017-11-24  8:52 [PATCH/RFC] not use a DiSEqC switch Maksym Veremeyenko
@ 2017-11-27 19:26 ` Mauro Carvalho Chehab
  2017-12-13 13:25   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2017-11-27 19:26 UTC (permalink / raw)
  To: Maksym Veremeyenko; +Cc: linux-media

Em Fri, 24 Nov 2017 10:52:04 +0200
Maksym Veremeyenko <verem@m1stereo.tv> escreveu:

> Hi,
> 
> there is a code in function *dvbsat_diseqc_set_input*:
> 
> [...]
> 	/* Negative numbers means to not use a DiSEqC switch */
> 	if (parms->p.sat_number < 0)
> 		return 0;
> [...]
> 
> if it mean /there is no DiSEqC switch/ then LNB's *polarity* and *band* 
> settings still should be applied - attached patch fixes that behavior.
> 
> if it mean /current DVB is a slave/ i.e. it is connected to LOOP OUT of 
> another DVB, so no need to configure anything, then statement above is 
> correct and no patches from this email should be applied.

No, it actually means that there's no DiSEqC at all; the LNBf
is a bandstacking one, where different polarities use different
LO, like on those LNBf:

	{
		.desc = {
			.name = N_("Big Dish - Multipoint LNBf"),
			.alias = "C-MULT",
		},
		.freqrange = {
			{ 3700, 4200, 5150, 0, POLARIZATION_R },
			{ 3700, 4200, 5750, 0, POLARIZATION_L }
		},
	}, {

		.desc = {
			.name = N_("BrasilSat Amazonas 1/2 - 2 Oscilators"),
			.alias = "AMAZONAS",
		},
		.freqrange = {
			{ 11037, 11360, 9670, 0, POLARIZATION_V },
			{ 11780, 12150, 10000, 0, POLARIZATION_H },
			{ 10950, 11280, 10000, 0, POLARIZATION_H },
		},
	},


The case where the LNBf accepts DiSEqC commands, but there's no
switch will work just fine, as the switch control data will be
silently ignored.

Ok, removing them could reduce a little bit the tuning time, at
the expense of making harder for the user, as he would need to
select between 4 different DiSEqC situations:

	- no DiSEqC at all;
	- DiSEqC LNbf, no DiSEqC switch;
	- DiSEqC LNbf, DiSEqC switch with 2 ports (miniDiSEqC);
	- DiSEqC LNbf, DiSEqC switch with 4 ports.

The way the code is, if DiSEqC is selected, it will send both
mini-DiSEqC (if satellite number < 2) and DiSEqC commands, so, 
all 3 DiSEqC cases will be covered by just one configuration.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH/RFC] not use a DiSEqC switch
  2017-11-27 19:26 ` Mauro Carvalho Chehab
@ 2017-12-13 13:25   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2017-12-13 13:25 UTC (permalink / raw)
  To: Maksym Veremeyenko; +Cc: linux-media, Rafaël Carré

Em Mon, 27 Nov 2017 17:26:07 -0200
Mauro Carvalho Chehab <mchehab@s-opensource.com> escreveu:

> Em Fri, 24 Nov 2017 10:52:04 +0200
> Maksym Veremeyenko <verem@m1stereo.tv> escreveu:
> 
> > Hi,
> > 
> > there is a code in function *dvbsat_diseqc_set_input*:
> > 
> > [...]
> > 	/* Negative numbers means to not use a DiSEqC switch */
> > 	if (parms->p.sat_number < 0)
> > 		return 0;
> > [...]
> > 
> > if it mean /there is no DiSEqC switch/ then LNB's *polarity* and *band* 
> > settings still should be applied - attached patch fixes that behavior.
> > 
> > if it mean /current DVB is a slave/ i.e. it is connected to LOOP OUT of 
> > another DVB, so no need to configure anything, then statement above is 
> > correct and no patches from this email should be applied.  
> 
> No, it actually means that there's no DiSEqC at all; the LNBf
> is a bandstacking one, where different polarities use different
> LO, like on those LNBf:
> 
> 	{
> 		.desc = {
> 			.name = N_("Big Dish - Multipoint LNBf"),
> 			.alias = "C-MULT",
> 		},
> 		.freqrange = {
> 			{ 3700, 4200, 5150, 0, POLARIZATION_R },
> 			{ 3700, 4200, 5750, 0, POLARIZATION_L }
> 		},
> 	}, {
> 
> 		.desc = {
> 			.name = N_("BrasilSat Amazonas 1/2 - 2 Oscilators"),
> 			.alias = "AMAZONAS",
> 		},
> 		.freqrange = {
> 			{ 11037, 11360, 9670, 0, POLARIZATION_V },
> 			{ 11780, 12150, 10000, 0, POLARIZATION_H },
> 			{ 10950, 11280, 10000, 0, POLARIZATION_H },
> 		},
> 	},
> 
> 
> The case where the LNBf accepts DiSEqC commands, but there's no
> switch will work just fine, as the switch control data will be
> silently ignored.
> 
> Ok, removing them could reduce a little bit the tuning time, at
> the expense of making harder for the user, as he would need to
> select between 4 different DiSEqC situations:
> 
> 	- no DiSEqC at all;
> 	- DiSEqC LNbf, no DiSEqC switch;
> 	- DiSEqC LNbf, DiSEqC switch with 2 ports (miniDiSEqC);
> 	- DiSEqC LNbf, DiSEqC switch with 4 ports.
> 
> The way the code is, if DiSEqC is selected, it will send both
> mini-DiSEqC (if satellite number < 2) and DiSEqC commands, so, 
> all 3 DiSEqC cases will be covered by just one configuration.

After revising this and doing some tests with the help of
Rafaël, it actually mades sense to apply something like that,
but adding an extra check for SCR/Unicable case.

Just added the patches today. Sorry for the noise.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-13 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24  8:52 [PATCH/RFC] not use a DiSEqC switch Maksym Veremeyenko
2017-11-27 19:26 ` Mauro Carvalho Chehab
2017-12-13 13:25   ` Mauro Carvalho Chehab

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.