#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 },
{ { { 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 }
+};
+
/*--------------------------------------------------------------------------*/
}
-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,
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);
}
}
+/**
+ *
+ */
+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);
+}
+
+
+
/**
*
*/
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);
}
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")) {
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")) {
var confreader = new Ext.data.JsonReader({
root: 'dvbadapters'
- }, ['name', 'automux', 'idlescan', 'logging']);
+ }, ['name', 'automux', 'idlescan', 'logging', 'diseqcversion']);
function saveConfForm () {
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',
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
url:'dvb/adapter/' + adapterId,
params:{'op':'load'},
success:function(form, action) {
+ console.log(form);
+ console.log(action);
confform.enable();
}
});