Skip to contentSkip to conversation

Add support for LNBfs with more than 2 LO

PATCH New Mauro Carvalho Chehab 1 participant 4 messages Dec 14, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover Add support for LNBfs with more than 2 LO

When dvb-sat was written, it assumed that the LNBf entries would have only 2 local oscilators, as this is what other tools did.

However, there are some widely LNBf models used in Brazil more local oscilators, meant to be used on multipoint arrangements.

Add support for them.

Please notice that this change breaks the libdvbv5 API. Not sure how to handle this incompatibility. That's basically why I'm not commiting it directly.

Suggestions?

Mauro Carvalho Chehab (3):
dvb-sat: embeed most stuff internally at struct LNBf
dvb-sat: change the LNBf logic to make it more generic
dvb-sat: add support for several BrasilSat LNBf models

 lib/include/libdvbv5/dvb-sat.h |  39 ++---
 lib/libdvbv5/dvb-fe.c          |   5 +-
 lib/libdvbv5/dvb-sat.c         | 340 +++++++++++++++++++++++++++--------------
 3 files changed, 244 insertions(+), 140 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/3 dvb-sat: embeed most stuff internally at struct LNBf

We'll need to change the way dvb-sat.c handle LNBfs, in order to be able to support more advanced LNBf with 4 oscilators.

So, let's first use an obscure most stuff for userspace. Please notice that, unfortunately, this will break the API.

---
 lib/include/libdvbv5/dvb-sat.h | 25 -----------
 lib/libdvbv5/dvb-sat.c         | 94 +++++++++++++++++++++++++++++-------------
 2 files changed, 66 insertions(+), 53 deletions(-)
lib/include/libdvbv5/dvb-sat.h +0 -25
index 3f796435fa77..7f83369fce39 100644
@@ -36,32 +36,12 @@
  */
 
 /**
- * @struct dvbsat_freqrange
- * @brief Defines a frequency range used by Satellite
- * @ingroup satellite
- *
- * @param low	low frequency, in kHz
- * @param high	high frequency, in kHz
- */
-struct dvbsat_freqrange {
-	unsigned low, high;
-};
-
-/**
  * @struct dvb_sat_lnb
  * @brief Stores the information of a LNBf
  * @ingroup satellite
  *
  * @param name		long name of the LNBf type
  * @param alias		short name for the LNBf type
- * @param lowfreq	Low frequency Intermediate Frequency of the LNBf, in kHz
- * @param highfreq	High frequency Intermediate frequency of the LNBf,
- *			in kHz
- * @param rangeswitch	For LNBf that has multiple frequency ranges controlled
- *			by a voltage change, specify the start frequency where
- *			the second range will be applied.
- * @param freqrange	Contains the range(s) of frequencies supported by a
- *			given LNBf.
  *
  * The LNBf (low-noise block downconverter) is a type of amplifier that is
  * installed inside the parabolic dishes. It converts the antenna signal to
@@ -73,11 +53,6 @@ struct dvbsat_freqrange {
 struct dvb_sat_lnb {
 	const char *name;
 	const char *alias;
-	unsigned lowfreq, highfreq;
-
-	unsigned rangeswitch;
-
-	struct dvbsat_freqrange freqrange[2];
 };
 
 struct dvb_v5_fe_parms;
lib/libdvbv5/dvb-sat.c +66 -28

185 lines not on this page · raw message

Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/3 dvb-sat: change the LNBf logic to make it more generic

There are some new LNBf models with more than two frequency ranges. Change the logic there to allow adding those new LNBf types.

---
 lib/include/libdvbv5/dvb-sat.h |  14 +++
 lib/libdvbv5/dvb-fe.c          |   5 +-
 lib/libdvbv5/dvb-sat.c         | 213 +++++++++++++++++++++++------------------
 3 files changed, 137 insertions(+), 95 deletions(-)
lib/include/libdvbv5/dvb-sat.h +14 -0
index 7f83369fce39..424c4f454c03 100644
@@ -132,6 +132,20 @@ const char *dvb_sat_get_lnb_name(int index);
  */
 int dvb_sat_set_parms(struct dvb_v5_fe_parms *parms);
 
+/**
+ * @brief return the real satellite frequency
+ * @ingroup satellite
+ *
+ * @param parms	struct dvb_v5_fe_parms pointer.
+ *
+ * This function is called internally by the library to get the satellite
+ * frequency, considering the LO frequency.
+ *
+ * @return frequency.
+ */
+int dvb_sat_real_freq(struct dvb_v5_fe_parms *p, int freq);
+
+
 #ifdef __cplusplus
 }
 #endif
lib/libdvbv5/dvb-fe.c +2 -3
index b0b8f5956d32..1e29c9f0186f 100644
@@ -705,9 +705,8 @@ int __dvb_fe_get_parms(struct dvb_v5_fe_parms *p)
 
 		/* copy back params from temporary fe_prop */
 		for (i = 0; i < n; i++) {
-			if (dvb_fe_is_satellite(p->current_sys)
-			    && fe_prop[i].cmd == DTV_FREQUENCY)
-				fe_prop[i].u.data += parms->freq_offset;
+			if (fe_prop[i].cmd == DTV_FREQUENCY)
+				fe_prop[i].u.data = dvb_sat_real_freq(p, fe_prop[i].u.data);
 			dvb_fe_store_parm(&parms->p, fe_prop[i].cmd, fe_prop[i].u.data);
 		}
 
lib/libdvbv5/dvb-sat.c +121 -92

350 lines not on this page · raw message

Signature · 1 line
2.9.3
#3 lore raw

PATCH 3/3 dvb-sat: add support for several BrasilSat LNBf models

There are some LNBf manufactured by BrasilSat that are widely used in Brazil. Add support for them, based on what's described on this document:
http://www.brasilsat.com.br/arquivo/DataSheet1.pdf

I tested myself the custom GVT model.

---
 lib/libdvbv5/dvb-sat.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
lib/libdvbv5/dvb-sat.c +49 -0
index bde0cfa3accb..7eb02284e3c4 100644
@@ -143,6 +143,55 @@ static const struct dvb_sat_lnb_priv lnb[] = {
 		.freqrange = {
 			{ 11710, 12751, 10678, 0 }
 		}
+	}, {
+		.desc = {
+			.name = N_("BrasilSat Stacked"),
+			.alias = "STACKED-BRASILSAT",
+		},
+		.freqrange = {
+			{ 10700, 11700, 9710, 0, POLARIZATION_H },
+			{ 10700, 11700, 9750, 0, POLARIZATION_H },
+		},
+	}, {
+		.desc = {
+			.name = N_("BrasilSat Oi"),
+			.alias = "OI-BRASILSAT",
+		},
+		.freqrange = {
+			{ 10950, 11200, 10000, 11700 },
+			{ 11800, 12200, 10445, 0 },
+		}
+	}, {
+		.desc = {
+			.name = N_("BrasilSat Amazonas 1/2 - 3 Oscilators"),
+			.alias = "AMAZONAS",
+		},
+		.freqrange = {
+			{ 11037, 11450, 9670, 0, POLARIZATION_V },
+			{ 11770, 12070, 9922, 0, POLARIZATION_H },
+			{ 10950, 11280, 10000, 0, POLARIZATION_H },
+		},
+	}, {
+		.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 },
+		},
+	}, {
+		.desc = {
+			.name = N_("BrasilSat custom GVT"),
+			.alias = "GVT-BRASILSAT",
+		},
+		.freqrange = {
+			{ 11010.5, 11067.5, 12860, 0, POLARIZATION_V },
+			{ 11704.0, 11941.0, 13435, 0, POLARIZATION_V },
+			{ 10962.5, 11199.5, 13112, 0, POLARIZATION_H },
+			{ 11704.0, 12188.0, 13138, 0, POLARIZATION_H },
+		},
 	},
 };
 
Signature · 1 line
2.9.3