EN50494: configuration storage
- add save configuration - set default values - raise variable length to 16bit (needed by configuration save)
This commit is contained in:
parent
4a4d7f166e
commit
1673b4a2cd
3 changed files with 39 additions and 26 deletions
|
@ -18,11 +18,11 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Open things:
|
||||
* - make linuxdvb_en50494_tune thread safe
|
||||
* avoiding self-raised collisions
|
||||
* - collision dectection
|
||||
* when a diseqc-command wasn't executed succesful, retry.
|
||||
* delay time is easly random, but in standard is special (complicated) way described (cap 8).
|
||||
* - TODO: make linuxdvb_en50494_tune thread safe
|
||||
* avoid self-raised collisions
|
||||
* - TODO: collision dectection
|
||||
* when a en50494-command wasn't executed succesful, retry.
|
||||
* delay time is easly random, but in standard is special (complicated) way described (cap. 8).
|
||||
*/
|
||||
|
||||
#include "tvheadend.h"
|
||||
|
@ -122,27 +122,27 @@ const idclass_t linuxdvb_en50494_class =
|
|||
.ic_get_title = linuxdvb_en50494_class_get_title,
|
||||
.ic_properties = (const property_t[]) {
|
||||
{
|
||||
.type = PT_INT,
|
||||
.type = PT_U16,
|
||||
.id = "position",
|
||||
.name = "Position",
|
||||
.off = offsetof(linuxdvb_en50494_t, le_position),
|
||||
.list = linuxdvb_en50494_class_position_list
|
||||
},
|
||||
{
|
||||
.type = PT_INT,
|
||||
.type = PT_U16,
|
||||
.id = "frequency",
|
||||
.name = "Frequency",
|
||||
.off = offsetof(linuxdvb_en50494_t, le_frequency),
|
||||
},
|
||||
{
|
||||
.type = PT_INT,
|
||||
.type = PT_U16,
|
||||
.id = "id",
|
||||
.name = "ID",
|
||||
.off = offsetof(linuxdvb_en50494_t, le_id),
|
||||
.list = linuxdvb_en50494_class_id_list
|
||||
},
|
||||
{
|
||||
.type = PT_INT,
|
||||
.type = PT_U16,
|
||||
.id = "pin",
|
||||
.name = "Pin",
|
||||
.off = offsetof(linuxdvb_en50494_t, le_pin),
|
||||
|
@ -183,7 +183,7 @@ linuxdvb_en50494_tune
|
|||
/* 2 data fields (16bit) */
|
||||
uint8_t data1, data2;
|
||||
data1 = le->le_id << 5; /* 3bit user-band */
|
||||
data1 |= le->le_position << 4; /* 1bit position (satelitte A(0)/B(0)) */
|
||||
data1 |= le->le_position << 4; /* 1bit position (satelitte A(0)/B(1)) */
|
||||
data1 |= pol << 3; /* 1bit polarisation v(0)/h(1) */
|
||||
data1 |= band << 2; /* 1bit band lower(0)/upper(1) */
|
||||
data1 |= t >> 8; /* 2bit transponder value bit 1-2 */
|
||||
|
@ -246,10 +246,15 @@ linuxdvb_en50494_list ( void *o )
|
|||
|
||||
linuxdvb_diseqc_t *
|
||||
linuxdvb_en50494_create0
|
||||
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls)
|
||||
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls, int port )
|
||||
{
|
||||
linuxdvb_diseqc_t *ld;
|
||||
// linuxdvb_en50494_t *le;
|
||||
linuxdvb_en50494_t *le;
|
||||
|
||||
if (port > 1) {
|
||||
tvhlog(LOG_ERR, LINUXDVB_EN50494_NAME, "only 2 ports/positions are posible. given %i", port);
|
||||
port = 0;
|
||||
}
|
||||
|
||||
ld = linuxdvb_diseqc_create0(
|
||||
calloc(1, sizeof(linuxdvb_en50494_t)),
|
||||
|
@ -258,10 +263,15 @@ linuxdvb_en50494_create0
|
|||
conf,
|
||||
LINUXDVB_EN50494_NAME,
|
||||
ls);
|
||||
// le = (linuxdvb_en50494_t*)ld;
|
||||
le = (linuxdvb_en50494_t*)ld;
|
||||
if (ld) {
|
||||
ld->ld_tune = linuxdvb_en50494_tune;
|
||||
/* May not needed: ld->ld_grace = linuxdvb_en50494_grace; */
|
||||
|
||||
le->le_position = port;
|
||||
le->le_id = 0;
|
||||
le->le_frequency = 0;
|
||||
le->le_pin = LINUXDVB_EN50494_NOPIN;
|
||||
}
|
||||
|
||||
return (linuxdvb_diseqc_t*)ld;
|
||||
|
|
|
@ -226,9 +226,9 @@ struct linuxdvb_en50494
|
|||
linuxdvb_diseqc_t;
|
||||
|
||||
/* en50494 configuration*/
|
||||
uint8_t le_position; /* satelitte A(0) or B(1) */
|
||||
uint16_t le_position; /* satelitte A(0) or B(1) */
|
||||
uint16_t le_frequency; /* user band frequency in MHz */
|
||||
uint8_t le_id; /* user band id 0-7 */
|
||||
uint16_t le_id; /* user band id 0-7 */
|
||||
uint16_t le_pin; /* 0-255 or LINUXDVB_EN50494_NOPIN */
|
||||
|
||||
/* runtime */
|
||||
|
@ -346,7 +346,7 @@ linuxdvb_diseqc_t *linuxdvb_switch_create0
|
|||
linuxdvb_diseqc_t *linuxdvb_rotor_create0
|
||||
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls );
|
||||
linuxdvb_diseqc_t *linuxdvb_en50494_create0
|
||||
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls );
|
||||
( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls, int port );
|
||||
|
||||
void linuxdvb_lnb_destroy ( linuxdvb_lnb_t *lnb );
|
||||
void linuxdvb_switch_destroy ( linuxdvb_diseqc_t *ld );
|
||||
|
|
|
@ -422,7 +422,7 @@ linuxdvb_satconf_type_list ( void *p )
|
|||
void
|
||||
linuxdvb_satconf_destroy ( linuxdvb_satconf_t *ls )
|
||||
{
|
||||
// TODO
|
||||
// TODO: satconf_destroy
|
||||
}
|
||||
|
||||
linuxdvb_satconf_t *
|
||||
|
@ -474,7 +474,7 @@ linuxdvb_satconf_create
|
|||
/* create multi port elements (2/4port & en50494) */
|
||||
if (lst->ports > 1) {
|
||||
if( !lse->ls_en50494 && !strcmp("en50494",lst->type))
|
||||
lse->ls_en50494 = linuxdvb_en50494_create0("en50494", NULL, lse);
|
||||
lse->ls_en50494 = linuxdvb_en50494_create0("en50494", NULL, lse, i);
|
||||
if( !lse->ls_switch && (!strcmp("2port",lst->type) || !strcmp("4port",lst->type)))
|
||||
lse->ls_switch = linuxdvb_switch_create0("Generic", NULL, lse, i, -1);
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ linuxdvb_satconf_create
|
|||
/* create multi port elements (2/4port & en50494) */
|
||||
if (lst->ports > 1) {
|
||||
if( !strcmp("en50494",lst->type))
|
||||
lse->ls_en50494 = linuxdvb_en50494_create0("en50494", NULL, lse);
|
||||
lse->ls_en50494 = linuxdvb_en50494_create0("en50494", NULL, lse, i);
|
||||
if( !strcmp("2port",lst->type) || !strcmp("4port",lst->type))
|
||||
lse->ls_switch = linuxdvb_switch_create0("Generic", NULL, lse, i, -1);
|
||||
}
|
||||
|
@ -522,6 +522,11 @@ linuxdvb_satconf_save ( linuxdvb_satconf_t *ls, htsmsg_t *m )
|
|||
idnode_save(&lse->ls_rotor->ld_id, c);
|
||||
htsmsg_add_msg(e, "rotor_conf", c);
|
||||
}
|
||||
if (lse->ls_en50494) {
|
||||
c = htsmsg_create_map();
|
||||
idnode_save(&lse->ls_en50494->ld_id, c);
|
||||
htsmsg_add_msg(e, "en50494_conf", c);
|
||||
}
|
||||
htsmsg_add_msg(l, NULL, e);
|
||||
}
|
||||
htsmsg_add_msg(m, "elements", l);
|
||||
|
@ -619,7 +624,7 @@ linuxdvb_satconf_ele_class_en50494type_set ( void *o, const void *p )
|
|||
const char *str = p;
|
||||
if (ls->ls_en50494)
|
||||
linuxdvb_en50494_destroy(ls->ls_en50494);
|
||||
ls->ls_en50494 = linuxdvb_en50494_create0(str, NULL, ls);
|
||||
ls->ls_en50494 = linuxdvb_en50494_create0(str, NULL, ls, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -876,12 +881,10 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
|
|||
usleep(20000); // Allow LNB to settle before tuning
|
||||
|
||||
/* Frontend */
|
||||
// TODO: get en50494 tuning frequency, not channel frequency
|
||||
if (lse->ls_en50494) {
|
||||
f = ((linuxdvb_en50494_t*)lse->ls_en50494)->le_tune_freq;
|
||||
} else {
|
||||
f = lse->ls_lnb->lnb_freq(lse->ls_lnb, lm);
|
||||
}
|
||||
/* use en50494 tuning frequency, if needed (not channel frequency) */
|
||||
f = lse->ls_en50494
|
||||
? ((linuxdvb_en50494_t*)lse->ls_en50494)->le_tune_freq
|
||||
: lse->ls_lnb->lnb_freq(lse->ls_lnb, lm);
|
||||
return linuxdvb_frontend_tune1(lfe, mmi, f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue