* Add support for DiSEqC 1.1 / 2.1, configured on per-adapter basis.

Ticket #99
This commit is contained in:
Andreas Öman 2009-09-08 19:42:40 +00:00
parent 0b0ad567f0
commit 2c0ef0f264
8 changed files with 115 additions and 31 deletions

3
debian/changelog vendored
View file

@ -17,6 +17,9 @@ hts-tvheadend (2.6) hts; urgency=low
* Default character encoding in DVB is ISO6937, not Latin-1. Ticket #96
* Add support for DiSEqC 1.1 / 2.1, configured on per-adapter basis.
Ticket #99
hts-tvheadend (2.5) hts; urgency=low
* If a previosly detected DVB adapter was not present during startup,

View file

@ -6,7 +6,7 @@
#include "diseqc.h"
struct diseqc_cmd switch_cmds[] = {
struct diseqc_cmd switch_commited_cmds[] = {
{ { { 0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x38, 0xf2, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x38, 0xf1, 0x00, 0x00 }, 4 }, 0 },
@ -25,6 +25,25 @@ struct diseqc_cmd switch_cmds[] = {
{ { { 0xe0, 0x10, 0x38, 0xff, 0x00, 0x00 }, 4 }, 0 }
};
struct diseqc_cmd switch_uncommited_cmds[] = {
{ { { 0xe0, 0x10, 0x39, 0xf0, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf1, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf2, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf3, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf4, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf5, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf6, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf7, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf8, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xf9, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xfa, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xfb, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xfc, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xfd, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xfe, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x39, 0xff, 0x00, 0x00 }, 4 }, 0 }
};
/*--------------------------------------------------------------------------*/
@ -68,16 +87,22 @@ int diseqc_send_msg (int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd,
}
int diseqc_setup(int frontend_fd, int switch_pos, int voltage_18, int hiband)
int
diseqc_setup(int frontend_fd, int switch_pos, int voltage_18, int hiband,
int diseqc_ver)
{
struct diseqc_cmd *cmd[2] = { NULL, NULL };
int i = 4 * switch_pos + 2 * hiband + (voltage_18 ? 1 : 0);
if(i < 0 || i >= (int) (sizeof(switch_cmds)/sizeof(struct diseqc_cmd)))
return -1;
cmd[0] = &switch_cmds[i];
if (diseqc_ver == 1) {
if(switch_pos < 0 || switch_pos >= (int) (sizeof(switch_uncommited_cmds)/sizeof(struct diseqc_cmd)))
return -1;
cmd[0] = &switch_uncommited_cmds[switch_pos];
} else {
if(i < 0 || i >= (int) (sizeof(switch_commited_cmds)/sizeof(struct diseqc_cmd)))
return -1;
cmd[0] = &switch_commited_cmds[i];
}
return diseqc_send_msg (frontend_fd,
i % 2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13,

View file

@ -18,7 +18,8 @@ extern int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd,
/**
* set up the switch to position/voltage/tone
*/
int diseqc_setup(int frontend_fd, int switch_pos, int voltage_18, int hiband);
int diseqc_setup(int frontend_fd, int switch_pos, int voltage_18, int hiband,
int diseqc_ver);
#endif

View file

@ -165,7 +165,7 @@ typedef struct th_dvb_adapter {
uint32_t tda_autodiscovery;
uint32_t tda_idlescan;
uint32_t tda_logging;
uint32_t tda_diseqc_version;
char *tda_displayname;
int tda_fe_fd;
@ -215,6 +215,8 @@ void dvb_adapter_set_idlescan(th_dvb_adapter_t *tda, int on);
void dvb_adapter_set_logging(th_dvb_adapter_t *tda, int on);
void dvb_adapter_set_diseqc_version(th_dvb_adapter_t *tda, unsigned int v);
void dvb_adapter_clone(th_dvb_adapter_t *dst, th_dvb_adapter_t *src);
void dvb_adapter_clean(th_dvb_adapter_t *tda);

View file

@ -79,6 +79,7 @@ tda_save(th_dvb_adapter_t *tda)
htsmsg_add_u32(m, "autodiscovery", tda->tda_autodiscovery);
htsmsg_add_u32(m, "idlescan", tda->tda_idlescan);
htsmsg_add_u32(m, "logging", tda->tda_logging);
htsmsg_add_u32(m, "diseqc_version", tda->tda_diseqc_version);
hts_settings_save(m, "dvbadapters/%s", tda->tda_identifier);
htsmsg_destroy(m);
}
@ -164,6 +165,29 @@ dvb_adapter_set_logging(th_dvb_adapter_t *tda, int on)
}
/**
*
*/
void
dvb_adapter_set_diseqc_version(th_dvb_adapter_t *tda, unsigned int v)
{
if(v > 1)
v = 1;
if(tda->tda_diseqc_version == v)
return;
lock_assert(&global_lock);
tvhlog(LOG_NOTICE, "dvb", "Adapter \"%s\" DiSEqC version set to: %s",
tda->tda_displayname, v ? "1.1 / 2.1" : "1.0 / 2.0" );
tda->tda_diseqc_version = v;
tda_save(tda);
}
/**
*
*/
@ -294,6 +318,7 @@ dvb_adapter_init(void)
htsmsg_get_u32(c, "autodiscovery", &tda->tda_autodiscovery);
htsmsg_get_u32(c, "idlescan", &tda->tda_idlescan);
htsmsg_get_u32(c, "logging", &tda->tda_logging);
htsmsg_get_u32(c, "diseqc_version", &tda->tda_diseqc_version);
}
htsmsg_destroy(l);
}

View file

@ -340,7 +340,7 @@ dvb_fe_tune(th_dvb_mux_instance_t *tdmi, const char *reason)
port,
pol == POLARISATION_HORIZONTAL ||
pol == POLARISATION_CIRCULAR_LEFT,
hiband);
hiband, tda->tda_diseqc_version);
usleep(50000);

View file

@ -990,6 +990,10 @@ extjs_dvbadapter(http_connection_t *hc, const char *remain, void *opaque)
htsmsg_add_u32(r, "automux", tda->tda_autodiscovery);
htsmsg_add_u32(r, "idlescan", tda->tda_idlescan);
htsmsg_add_u32(r, "logging", tda->tda_logging);
htsmsg_add_str(r, "diseqcversion",
((const char *[]){"DiSEqC 1.0 / 2.0",
"DiSEqC 1.1 / 2.1"})
[tda->tda_diseqc_version % 2]);
out = json_single_record(r, "dvbadapters");
} else if(!strcmp(op, "save")) {
@ -1006,6 +1010,13 @@ extjs_dvbadapter(http_connection_t *hc, const char *remain, void *opaque)
s = http_arg_get(&hc->hc_req_args, "logging");
dvb_adapter_set_logging(tda, !!s);
if((s = http_arg_get(&hc->hc_req_args, "diseqcversion")) != NULL) {
if(!strcmp(s, "DiSEqC 1.0 / 2.0"))
dvb_adapter_set_diseqc_version(tda, 0);
else if(!strcmp(s, "DiSEqC 1.1 / 2.1"))
dvb_adapter_set_diseqc_version(tda, 1);
}
out = htsmsg_create_map();
htsmsg_add_u32(out, "success", 1);
} else if(!strcmp(op, "addnetwork")) {

View file

@ -998,7 +998,7 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
var confreader = new Ext.data.JsonReader({
root: 'dvbadapters'
}, ['name', 'automux', 'idlescan', 'logging']);
}, ['name', 'automux', 'idlescan', 'logging', 'diseqcversion']);
function saveConfForm () {
@ -1008,6 +1008,39 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
waitMsg:'Saving Data...'
});
}
var items = [
{
fieldLabel: 'Adapter name',
name: 'name',
width: 250
},
new Ext.form.Checkbox({
fieldLabel: 'Autodetect muxes',
name: 'automux'
}),
new Ext.form.Checkbox({
fieldLabel: 'Idle scanning',
name: 'idlescan'
}),
new Ext.form.Checkbox({
fieldLabel: 'Detailed logging',
name: 'logging'
})
];
if(satConfStore) {
v = new Ext.form.ComboBox({
name: 'diseqcversion',
fieldLabel: 'DiSEqC version',
editable: false,
allowBlank: false,
mode: 'remote',
triggerAction: 'all',
store: ['DiSEqC 1.0 / 2.0', 'DiSEqC 1.1 / 2.1']
});
items.push(v);
}
var confform = new Ext.FormPanel({
title:'Adapter configuration',
@ -1022,25 +1055,7 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
waitMsgTarget: true,
reader: confreader,
defaultType: 'textfield',
items: [
{
fieldLabel: 'Adapter name',
name: 'name',
width: 250
},
new Ext.form.Checkbox({
fieldLabel: 'Autodetect muxes',
name: 'automux'
}),
new Ext.form.Checkbox({
fieldLabel: 'Idle scanning',
name: 'idlescan'
}),
new Ext.form.Checkbox({
fieldLabel: 'Detailed logging',
name: 'logging'
})
],
items: items,
buttons: [{
text: 'Save',
handler: saveConfForm
@ -1051,6 +1066,8 @@ tvheadend.dvb_adapter_general = function(adapterData, satConfStore) {
url:'dvb/adapter/' + adapterId,
params:{'op':'load'},
success:function(form, action) {
console.log(form);
console.log(action);
confform.enable();
}
});