linuxdvb: a bit more work on satconf
I now have initial code for tuning a satconf (LNB only).
This commit is contained in:
parent
ca74acd8c3
commit
f621b9265e
3 changed files with 59 additions and 12 deletions
|
@ -29,9 +29,6 @@
|
|||
#include <assert.h>
|
||||
#include <linux/dvb/dmx.h>
|
||||
|
||||
static int
|
||||
linuxdvb_frontend_tune
|
||||
( linuxdvb_frontend_t *lfe, linuxdvb_mux_t *lm );
|
||||
static void
|
||||
linuxdvb_frontend_monitor ( void *aux );
|
||||
static void *
|
||||
|
@ -348,7 +345,7 @@ linuxdvb_frontend_start_mux
|
|||
|
||||
/* Tune */
|
||||
tvhtrace("linuxdvb", "%s - tuning", buf1);
|
||||
r = linuxdvb_frontend_tune(lfe, (linuxdvb_mux_t*)mmi->mmi_mux);
|
||||
r = linuxdvb_frontend_tune(lfe, (linuxdvb_mux_t*)mmi->mmi_mux, -1);
|
||||
|
||||
/* Failed */
|
||||
if (r != 0) {
|
||||
|
@ -667,17 +664,17 @@ linuxdvb_frontend_input_thread ( void *aux )
|
|||
* Tuning
|
||||
* *************************************************************************/
|
||||
|
||||
static int
|
||||
int
|
||||
linuxdvb_frontend_tune
|
||||
( linuxdvb_frontend_t *lfe, linuxdvb_mux_t *lm )
|
||||
( linuxdvb_frontend_t *lfe, linuxdvb_mux_t *lm, uint32_t freq )
|
||||
{
|
||||
int r;
|
||||
struct dvb_frontend_event ev;
|
||||
dvb_mux_conf_t *dmc = &lm->lm_tuning;
|
||||
struct dvb_frontend_parameters *p = &dmc->dmc_fe_params;
|
||||
|
||||
/* S2 tuning */
|
||||
#if DVB_API_VERSION >= 5
|
||||
dvb_mux_conf_t *dmc = &lm->lm_tuning;
|
||||
struct dvb_frontend_parameters *p = &dmc->dmc_fe_params;
|
||||
struct dtv_property cmds[20];
|
||||
struct dtv_properties cmdseq = { .num = 0, .props = cmds };
|
||||
|
||||
|
@ -691,13 +688,16 @@ linuxdvb_frontend_tune
|
|||
};
|
||||
if ((ioctl(lfe->lfe_fe_fd, FE_SET_PROPERTY, &clear_cmdseq)) != 0)
|
||||
return -1;
|
||||
|
||||
if (freq == (uint32_t)-1)
|
||||
freq = p->frequency;
|
||||
|
||||
/* Tune */
|
||||
#define S2CMD(c, d)\
|
||||
cmds[cmdseq.num].cmd = c;\
|
||||
cmds[cmdseq.num++].u.data = d
|
||||
S2CMD(DTV_DELIVERY_SYSTEM, lm->lm_tuning.dmc_fe_delsys);
|
||||
S2CMD(DTV_FREQUENCY, p->frequency);
|
||||
S2CMD(DTV_FREQUENCY, freq);
|
||||
S2CMD(DTV_INVERSION, p->inversion);
|
||||
|
||||
/* DVB-T */
|
||||
|
@ -731,6 +731,11 @@ linuxdvb_frontend_tune
|
|||
/* Tune */
|
||||
S2CMD(DTV_TUNE, 0);
|
||||
#undef S2CMD
|
||||
#else
|
||||
dvb_mux_conf_t dmc = lm->lm_tuning;
|
||||
struct dvb_frontend_parameters *p = &dmc.dmc_fe_params;
|
||||
if (freq != (uint32_t)-1)
|
||||
p->frequency = freq;
|
||||
#endif
|
||||
|
||||
/* discard stale events */
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef struct linuxdvb_frontend linuxdvb_frontend_t;
|
|||
typedef struct linuxdvb_network linuxdvb_network_t;
|
||||
typedef struct linuxdvb_mux linuxdvb_mux_t;
|
||||
typedef struct linuxdvb_satconf linuxdvb_satconf_t;
|
||||
typedef struct linuxdvb_lnb linuxdvb_lnb_t;
|
||||
|
||||
typedef LIST_HEAD(,linuxdvb_hardware) linuxdvb_hardware_list_t;
|
||||
|
||||
|
@ -170,6 +171,13 @@ linuxdvb_frontend_added
|
|||
void linuxdvb_frontend_add_network
|
||||
( linuxdvb_frontend_t *lfe, linuxdvb_network_t *net );
|
||||
|
||||
int linuxdvb_frontend_tune
|
||||
( linuxdvb_frontend_t *lfe, linuxdvb_mux_t *lm, uint32_t freq );
|
||||
|
||||
/*
|
||||
* Network
|
||||
*/
|
||||
|
||||
struct linuxdvb_network
|
||||
{
|
||||
mpegts_network_t;
|
||||
|
@ -211,6 +219,15 @@ mpegts_service_t *linuxdvb_service_create0
|
|||
(linuxdvb_mux_t *lm, uint16_t sid, uint16_t pmt_pid,
|
||||
const char *uuid, htsmsg_t *conf);
|
||||
|
||||
/*
|
||||
* LNB
|
||||
*/
|
||||
struct linuxdvb_lnb
|
||||
{
|
||||
uint32_t (*lnb_frequency)(linuxdvb_lnb_t*, linuxdvb_mux_t*);
|
||||
int (*lnb_tune)(linuxdvb_lnb_t*, linuxdvb_mux_t *lm, int fd);
|
||||
};
|
||||
|
||||
/*
|
||||
* Satconf
|
||||
*/
|
||||
|
@ -220,6 +237,7 @@ struct linuxdvb_satconf
|
|||
|
||||
/* Links */
|
||||
mpegts_input_t *ls_frontend;
|
||||
linuxdvb_lnb_t *ls_lnb;
|
||||
};
|
||||
|
||||
linuxdvb_satconf_t *linuxdvb_satconf_create0(const char *uuid, htsmsg_t *conf);
|
||||
|
|
|
@ -214,9 +214,33 @@ static int
|
|||
linuxdvb_satconf_start_mux
|
||||
( mpegts_input_t *mi, mpegts_mux_instance_t *mmi )
|
||||
{
|
||||
linuxdvb_satconf_t *ls = (linuxdvb_satconf_t*)mi;
|
||||
mi = ls->ls_frontend;
|
||||
// TODO: need more here!
|
||||
int r;
|
||||
uint32_t f;
|
||||
linuxdvb_satconf_t *ls = (linuxdvb_satconf_t*)mi;
|
||||
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)(mi = ls->ls_frontend);
|
||||
linuxdvb_mux_t *lm = (linuxdvb_mux_t*)mmi;
|
||||
|
||||
/* Test run */
|
||||
// Note: basically this ensures the tuning params are acceptable
|
||||
// for the FE, so that if they're not we don't have to wait
|
||||
// for things like rotors and switches
|
||||
if (!ls->ls_lnb)
|
||||
return SM_CODE_TUNING_FAILED;
|
||||
f = ls->ls_lnb->lnb_frequency(ls->ls_lnb, lm);
|
||||
if (f < 0)
|
||||
return SM_CODE_TUNING_FAILED;
|
||||
r = linuxdvb_frontend_tune(lfe, lm, f);
|
||||
if (r) return r;
|
||||
|
||||
/* Switch */
|
||||
|
||||
/* Rotor */
|
||||
|
||||
/* LNB */
|
||||
if (ls->ls_lnb->lnb_tune(ls->ls_lnb, lm, lfe->lfe_fe_fd))
|
||||
return SM_CODE_TUNING_FAILED;
|
||||
|
||||
/* Tune */
|
||||
return mi->mi_start_mux(mi, mmi);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue