static int
linuxdvb_en50494_tune
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *sc, int fd )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *sc,
+ linuxdvb_frontend_t *lfe )
{
int ret = 0;
- int i;
+ int i, fd = lfe->lfe_fe_fd;
linuxdvb_en50494_t *le = (linuxdvb_en50494_t*) ld;
linuxdvb_lnb_t *lnb = sc->lse_lnb;
.list = linuxdvb_satconf_type_list,
.def.s = "simple"
},
+ {
+ .type = PT_U32,
+ .id = "max_rotor_move",
+ .name = "Max Rotor Movement (seconds)",
+ .off = offsetof(linuxdvb_frontend_t, lfe_max_rotor_move),
+ .opts = PO_ADVANCED,
+ .def.u32 = 120
+ },
{
.id = "networks",
.type = PT_NONE,
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
int r = 5;
if (lfe->lfe_satconf)
- r = linuxdvb_satconf_get_grace(lfe->lfe_satconf, mm);
+ r = linuxdvb_satconf_get_grace(lfe, mm);
return r;
}
lfe->lfe_type = type;
strncpy(lfe->lfe_name, name, sizeof(lfe->lfe_name));
lfe->lfe_name[sizeof(lfe->lfe_name)-1] = '\0';
+ lfe->lfe_max_rotor_move = 120;
lfe = (linuxdvb_frontend_t*)mpegts_input_create0((mpegts_input_t*)lfe, idc, uuid, conf);
if (!lfe) return NULL;
static int
linuxdvb_lnb_standard_tune
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls,
+ linuxdvb_frontend_t *lfe )
{
/* en50494 does not use the voltage tune. this is happend in the switch */
if (ls->lse_en50494)
return 0;
int pol = linuxdvb_lnb_standard_pol((linuxdvb_lnb_t*)ld, lm);
- return linuxdvb_diseqc_set_volt(fd, pol);
+ return linuxdvb_diseqc_set_volt(lfe->lfe_fe_fd, pol);
}
/*
static int
linuxdvb_lnb_bandstack_tune
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls,
+ linuxdvb_frontend_t *lfe )
{
int pol = linuxdvb_lnb_bandstack_pol((linuxdvb_lnb_t*)ld, lm);
- return linuxdvb_diseqc_set_volt(fd, pol);
+ return linuxdvb_diseqc_set_volt(lfe->lfe_fe_fd, pol);
}
/* **************************************************************************
* Configuration
*/
int lfe_powersave;
+ uint32_t lfe_max_rotor_move;
/*
* Satconf (DVB-S only)
idnode_t ld_id;
const char *ld_type;
linuxdvb_satconf_ele_t *ld_satconf;
- int (*ld_grace) (linuxdvb_diseqc_t *ld, dvb_mux_t *lm);
+ int (*ld_grace) (linuxdvb_diseqc_t *ld, dvb_mux_t *lm,
+ linuxdvb_frontend_t *lfe);
int (*ld_tune) (linuxdvb_diseqc_t *ld, dvb_mux_t *lm,
- linuxdvb_satconf_ele_t *ls, int fd);
+ linuxdvb_satconf_ele_t *ls, linuxdvb_frontend_t *lfe);
};
struct linuxdvb_lnb
( linuxdvb_satconf_t *ls, mpegts_mux_t *mm );
int linuxdvb_satconf_get_grace
- ( linuxdvb_satconf_t *ls, mpegts_mux_t *mm );
+ ( linuxdvb_frontend_t *lfe, mpegts_mux_t *mm );
void linuxdvb_satconf_post_stop_mux( linuxdvb_satconf_t *ls );
static int
linuxdvb_rotor_grace
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_frontend_t *lfe )
{
linuxdvb_rotor_t *lr = (linuxdvb_rotor_t*)ld;
linuxdvb_satconf_t *ls = ld->ld_satconf->lse_parent;
int newpos, curpos, delta;
if (!ls->ls_orbital_dir || lr->lr_rate == 0)
- return 120;
+ return lfe->lfe_max_rotor_move;
if (idnode_is_instance(&lr->ld_id, &linuxdvb_rotor_gotox_class))
newpos = lr->lr_position; /* GotoX */
/* GotoX */
static int
linuxdvb_rotor_gotox_tune
- ( linuxdvb_rotor_t *lr, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
+ ( linuxdvb_rotor_t *lr, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls,
+ linuxdvb_frontend_t *lfe )
{
int i;
return 0;
for (i = 0; i <= ls->lse_parent->ls_diseqc_repeats; i++) {
- if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6B, 1, (int)lr->lr_position)) {
+ if (linuxdvb_diseqc_send(lfe->lfe_fe_fd, 0xE0, 0x31, 0x6B, 1, (int)lr->lr_position)) {
tvherror("diseqc", "failed to set GOTOX pos %d", lr->lr_position);
return -1;
}
tvhdebug("diseqc", "rotor GOTOX pos %d sent", lr->lr_position);
- return linuxdvb_rotor_grace((linuxdvb_diseqc_t*)lr,lm);
+ return linuxdvb_rotor_grace((linuxdvb_diseqc_t*)lr, lm, lfe);
}
/* USALS */
static int
linuxdvb_rotor_usals_tune
- ( linuxdvb_rotor_t *lr, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
+ ( linuxdvb_rotor_t *lr, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls,
+ linuxdvb_frontend_t *lfe )
{
/*
* Code originally written in PR #238 by Jason Millard jsm174
motor_angle, (motor_angle > 0.0) ? "counter-" : "");
for (i = 0; i <= ls->lse_parent->ls_diseqc_repeats; i++) {
- if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6E, 2, angle_1, angle_2)) {
+ if (linuxdvb_diseqc_send(lfe->lfe_fe_fd, 0xE0, 0x31, 0x6E, 2, angle_1, angle_2)) {
tvherror("diseqc", "failed to send USALS command");
return -1;
}
usleep(25000);
}
- return linuxdvb_rotor_grace((linuxdvb_diseqc_t*)lr,lm);
+ return linuxdvb_rotor_grace((linuxdvb_diseqc_t*)lr, lm, lfe);
#undef TO_RAD
#undef TO_DEG
static int
linuxdvb_rotor_tune
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls,
+ linuxdvb_frontend_t *lfe )
{
linuxdvb_rotor_t *lr = (linuxdvb_rotor_t*)ld;
/* Force to 18v (quicker movement) */
- if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18)) {
+ if (ioctl(lfe->lfe_fe_fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18)) {
tvherror("diseqc", "failed to set 18v for rotor movement");
return -1;
}
/* GotoX */
if (idnode_is_instance(&lr->ld_id, &linuxdvb_rotor_gotox_class))
- return linuxdvb_rotor_gotox_tune(lr, lm, ls, fd);
+ return linuxdvb_rotor_gotox_tune(lr, lm, ls, lfe);
/* USALS */
- return linuxdvb_rotor_usals_tune(lr, lm, ls, fd);
+ return linuxdvb_rotor_usals_tune(lr, lm, ls, lfe);
}
/* **************************************************************************
int
linuxdvb_satconf_get_grace
- ( linuxdvb_satconf_t *ls, mpegts_mux_t *mm )
+ ( linuxdvb_frontend_t *lfe, mpegts_mux_t *mm )
{
+ linuxdvb_satconf_t *ls = lfe->lfe_satconf;
linuxdvb_satconf_ele_t *lse = linuxdvb_satconf_find_ele(ls, mm);
int i, r = 10;
linuxdvb_diseqc_t *lds[] = {
/* Add diseqc delay */
for (i = 0; i < 3; i++) {
if (lds[i] && lds[i]->ld_grace)
- r += lds[i]->ld_grace(lds[i], (dvb_mux_t*)mm);
+ r += lds[i]->ld_grace(lds[i], (dvb_mux_t*)mm, lfe);
}
return r;
/* Diseqc */
for (i = ls->ls_diseqc_idx; i < ARRAY_SIZE(lds); i++) {
if (!lds[i]) continue;
- r = lds[i]->ld_tune(lds[i], lm, lse, lfe->lfe_fe_fd);
+ r = lds[i]->ld_tune(lds[i], lm, lse, lfe);
/* Error */
if (r < 0) return r;
static int
linuxdvb_switch_tune
- ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *sc, int fd )
+ ( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *sc,
+ linuxdvb_frontend_t *lfe )
{
- int i, com, r1 = 0, r2 = 0;
+ int i, com, r1 = 0, r2 = 0, fd = lfe->lfe_fe_fd;
int pol, band;
linuxdvb_switch_t *ls = (linuxdvb_switch_t*)ld;