From 501fad1fc21af336f86a5bed58531d1fc5622b07 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 16 Feb 2014 17:36:47 +0900 Subject: [PATCH] dvb-fe: Add support for setting the LNA before tuning Sometimes, we need to control the Low Noise Amplifier (LNA) at the antena, in order to get a signal. This is dependent on the way the tuner is connected to the antena, and if the antena has support for it. Add a logic at the code to set it. By default, LNA will be in auto mode, with is the DVB core's default. Enabling or disabling it is just a matter of changing parms->lna. Signed-off-by: Mauro Carvalho Chehab --- lib/include/dvb-fe.h | 1 + lib/libdvbv5/dvb-fe.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h index 4accd5e..40dbe1a 100644 --- a/lib/include/dvb-fe.h +++ b/lib/include/dvb-fe.h @@ -97,6 +97,7 @@ struct dvb_v5_fe_parms { struct dtv_property dvb_prop[DTV_MAX_COMMAND]; int legacy_fe; struct dvb_v5_stats stats; + int lna; /* Satellite specific stuff, specified by the library client */ const struct dvb_sat_lnb *lnb; diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 41731e1..36da95d 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -82,6 +82,7 @@ struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int frontend, unsigned verbose parms->sat_number = -1; parms->abort = 0; parms->logfunc = logfunc; + parms->lna = LNA_AUTO; if (ioctl(fd, FE_GET_INFO, &parms->info) == -1) { dvb_perror("FE_GET_INFO"); @@ -633,6 +634,9 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms) memset(&prop, 0, sizeof(prop)); prop.props = tmp_parms.dvb_prop; prop.num = tmp_parms.n_props; + prop.props[prop.num].cmd = DTV_LNA; + prop.props[prop.num].u.data = parms->lna; + prop.num++; prop.props[prop.num].cmd = DTV_TUNE; prop.num++; @@ -643,6 +647,9 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms) dvb_fe_prt_parms(parms); return -1; } + if (parms->lna != LNA_AUTO && parms->verbose) + dvb_logdbg("LNA is %s", parms->lna ? "ON" : "OFF"); + return 0; } /* DVBv3 call */ -- 2.7.4