diff --git a/Makefile b/Makefile
index 96afda7d..b0c09a97 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ KMODULES = drivers/usb/serial/cp210x.ko \
drivers/usb/serial/oti6858.ko
MINISATIP_COMMIT=54df9348e7bd7e6075f54f1b93ec4ad36429abe0
-MINISATIP5_COMMIT=6569cb0c1cc790aec9c254fc99de38be5de6d549
+MINISATIP5_COMMIT=c1a31b3a677fa4af3cbb10f9c95d07c040e787ed
BUSYBOX=busybox-1.24.1
@@ -608,6 +608,7 @@ apps/$(PYTHON3)/compiled.stamp: apps/$(PYTHON3)/patch.stamp
rm -rf $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/python3*/idlelib
rm -rf $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/python3*/distutils
rm -rf $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/python3*/ensurepip
+ rm -rf $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/python3*/curses
find $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/ -name "*.opt-[12].pyc" -exec rm {} \;
find $(CURDIR)/apps/$(PYTHON3)/dest/usr/lib/ -name "test_*" -exec rm {} \;
touch apps/$(PYTHON3)/compiled.stamp
diff --git a/patches/minisatip-axe.patch b/patches/minisatip-axe.patch
index 8ac89c75..7ad8ac88 100644
--- a/patches/minisatip-axe.patch
+++ b/patches/minisatip-axe.patch
@@ -605,7 +605,7 @@ index 0000000..cfc1927
+
+#endif
diff --git a/dvb.c b/dvb.c
-index 5701bd2..6179588 100755
+index 5701bd2..79cac82 100755
--- a/dvb.c
+++ b/dvb.c
@@ -41,6 +41,10 @@
@@ -717,7 +717,31 @@ index 5701bd2..6179588 100755
LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
msleep(15);
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
-@@ -320,7 +363,7 @@ int setup_switch (int frontend_fd, transponder *tp)
+@@ -312,6 +355,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
+ return ufreq * 1000;
+ }
+
++#ifdef AXE
++static inline int extra_quattro(int input, int diseqc, int *equattro)
++{
++ if (diseqc <= 0)
++ *equattro = 0;
++ /* lowband allowed - control the hiband inputs independently for positions src=2+ */
++ else if (opts.quattro_hiband == 1 && input < 2)
++ *equattro = diseqc - 1;
++ /* hiband allowed - control the lowband inputs independently for positions src=2+ */
++ else if (opts.quattro_hiband == 2 && input >= 2 && input < 4)
++ *equattro = diseqc - 1;
++ else
++ *equattro = 0;
++ return *equattro;
++}
++#endif
++
+ int setup_switch (int frontend_fd, transponder *tp)
+ {
+ int i;
+@@ -320,7 +380,7 @@ int setup_switch (int frontend_fd, transponder *tp)
int diseqc = (tp->diseqc > 0)? tp->diseqc - 1: 0;
int freq = tp->freq;
int pol = (tp->pol - 1) & 1;
@@ -726,13 +750,13 @@ index 5701bd2..6179588 100755
if (freq < SLOF)
{
freq = (freq - LOF1);
-@@ -330,12 +373,111 @@ int setup_switch (int frontend_fd, transponder *tp)
+@@ -330,12 +390,113 @@ int setup_switch (int frontend_fd, transponder *tp)
hiband = 1;
}
+#ifdef AXE
+ adapter *ad, *ad2, *adm;
-+ int input = 0, aid;
++ int input = 0, aid, equattro = 0;
+
+ for (aid = 0; aid < 4; aid++) {
+ ad = get_adapter(aid);
@@ -747,7 +771,9 @@ index 5701bd2..6179588 100755
+ ad->axe_feused = 1;
+ if (tp->switch_type != SWITCH_UNICABLE && tp->switch_type != SWITCH_JESS) {
+ input = aid;
-+ if (ad && !opts.quattro) {
++ if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) {
++ if (equattro > 0)
++ diseqc = equattro - 1;
+ adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa);
+ if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input);
@@ -767,7 +793,7 @@ index 5701bd2..6179588 100755
+ adm->tp.old_diseqc != diseqc))
+ return 0;
+ }
-+ adm->axe_used |= (1 << aid);
++ adm->axe_used |= (1 << input);
+ adm->axe_feused = 1;
+ if (ad->slave) {
+ input = ad->slave - 1;
@@ -808,7 +834,7 @@ index 5701bd2..6179588 100755
+ goto axe;
+ }
+ } else {
-+ input = opts.axe_unicinp[input & 3];
++ input = opts.axe_unicinp[aid];
+ ad = get_adapter(input);
+ if (ad == NULL) {
+ LOGL(3, "axe setup: unable to find adapter %d", input);
@@ -838,7 +864,7 @@ index 5701bd2..6179588 100755
}else
{
if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc)
-@@ -343,6 +485,16 @@ int setup_switch (int frontend_fd, transponder *tp)
+@@ -343,6 +504,16 @@ int setup_switch (int frontend_fd, transponder *tp)
else
LOGL(3, "Skip sending diseqc commands since the switch position doesn't need to be changed: pol %d, hiband %d, switch position %d", pol, hiband, diseqc);
}
@@ -855,7 +881,7 @@ index 5701bd2..6179588 100755
tp->old_pol = pol;
tp->old_hiband = hiband;
-@@ -383,8 +535,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
+@@ -383,8 +554,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
{.cmd = DTV_INVERSION,.u.data = 0},
{.cmd = DTV_SYMBOL_RATE,.u.data = 0},
{.cmd = DTV_INNER_FEC,.u.data = 0},
@@ -866,7 +892,7 @@ index 5701bd2..6179588 100755
{.cmd = DTV_TUNE},
};
static struct dtv_properties dvbs2_cmdseq =
-@@ -462,11 +616,15 @@ tune_it_s2 (int fd_frontend, transponder * tp)
+@@ -462,11 +635,15 @@ tune_it_s2 (int fd_frontend, transponder * tp)
tp->mtype = QPSK;
bpol = getTick();
if_freq = setup_switch (fd_frontend, tp);
@@ -882,7 +908,7 @@ index 5701bd2..6179588 100755
p->props[INVERSION].u.data = tp->inversion;
p->props[SYMBOL_RATE].u.data = tp->sr;
p->props[FEC_INNER].u.data = tp->fec;
-@@ -475,7 +633,12 @@ tune_it_s2 (int fd_frontend, transponder * tp)
+@@ -475,7 +652,12 @@ tune_it_s2 (int fd_frontend, transponder * tp)
LOG("tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%d, ts pol=%d",
tp->freq, p->props[FREQUENCY].u.data, get_pol(tp->pol), tp->pol, p->props[SYMBOL_RATE].u.data, fe_fec[p->props[FEC_INNER].u.data],
fe_delsys[p->props[DELSYS].u.data], fe_modulation[p->props[MODULATION].u.data],
@@ -896,7 +922,7 @@ index 5701bd2..6179588 100755
break;
-@@ -560,6 +723,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
+@@ -560,6 +742,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
char buf[100];
int fd;
@@ -917,7 +943,7 @@ index 5701bd2..6179588 100755
if ( i_pid > 8192 )
LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad);
-@@ -585,6 +762,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
+@@ -585,6 +781,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
}
LOG ("setting filter on PID %d for fd %d", i_pid, fd);
@@ -925,7 +951,7 @@ index 5701bd2..6179588 100755
return fd;
}
-@@ -592,6 +770,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
+@@ -592,6 +789,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
int del_filters (int fd, int pid)
{
@@ -943,7 +969,7 @@ index 5701bd2..6179588 100755
if (fd < 0)
LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid);
if (ioctl (fd, DMX_STOP) < 0)
-@@ -599,6 +788,7 @@ int del_filters (int fd, int pid)
+@@ -599,6 +807,7 @@ int del_filters (int fd, int pid)
else
LOG ("clearing filters on PID %d FD %d", pid, fd);
close (fd);
@@ -951,7 +977,7 @@ index 5701bd2..6179588 100755
return 0;
}
-@@ -606,6 +796,15 @@ int del_filters (int fd, int pid)
+@@ -606,6 +815,15 @@ int del_filters (int fd, int pid)
fe_delivery_system_t
dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
{
@@ -967,7 +993,7 @@ index 5701bd2..6179588 100755
int i, res, rv = 0;
struct dvb_frontend_info fe_info;
-@@ -703,6 +902,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
+@@ -703,6 +921,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
LOG ("returning default from dvb_delsys => %s (count %d)", fe_delsys[rv] , nsys);
return (fe_delivery_system_t) rv;
diff --git a/patches/minisatip5-axe.patch b/patches/minisatip5-axe.patch
index b74f84e5..375983f8 100644
--- a/patches/minisatip5-axe.patch
+++ b/patches/minisatip5-axe.patch
@@ -1,157 +1,8 @@
diff --git a/adapter.c b/adapter.c
-index 033490a..d5ae166 100644
+index 839c078..a95564d 100644
--- a/adapter.c
+++ b/adapter.c
-@@ -49,6 +49,31 @@ extern struct struct_opts opts;
- int tuner_s2, tuner_t, tuner_c, tuner_t2, tuner_c2;
- void find_dvb_adapter(adapter **a);
-
-+adapter *adapter_alloc()
-+{
-+ adapter *ad = malloc1(sizeof(adapter));
-+
-+ /* diseqc setup */
-+ ad->diseqc_param.fast = opts.diseqc_fast;
-+ ad->diseqc_param.committed_no = opts.diseqc_committed_no;
-+ ad->diseqc_param.uncommitted_no = opts.diseqc_uncommitted_no;
-+
-+ /* diseqc default timing */
-+ ad->diseqc_param.before_cmd = opts.diseqc_before_cmd;
-+ ad->diseqc_param.after_cmd = opts.diseqc_after_cmd;
-+ ad->diseqc_param.after_repeated_cmd = opts.diseqc_after_repeated_cmd;
-+ ad->diseqc_param.after_switch = opts.diseqc_after_switch;
-+ ad->diseqc_param.after_burst = opts.diseqc_after_burst;
-+ ad->diseqc_param.after_tone = opts.diseqc_after_tone;
-+
-+ /* diseqc state control */
-+ ad->old_diseqc = -1;
-+ ad->old_hiband = -1;
-+ ad->old_pol = -1;
-+
-+ return ad;
-+}
-+
- void find_adapters()
- {
- static int init_find_adapter;
-@@ -294,6 +319,9 @@ void close_adapter(int na)
- ad->dvr = 0;
- ad->strength = 0;
- ad->snr = 0;
-+ ad->old_diseqc = -1;
-+ ad->old_hiband = -1;
-+ ad->old_pol = -1;
- mutex_unlock(&ad->mutex);
- mutex_destroy(&ad->mutex);
- // if(a[na]->buf)free1(a[na]->buf);a[na]->buf=NULL;
-@@ -381,19 +409,39 @@ void dump_pids(int aid)
- }
- }
-
--#define return_adapter(i) { \
-- if(!init_hw(i)) \
-- return i; \
-+int adapter_match(adapter *ad, int freq, int pol, int msys, int src, int diseqc)
-+{
-+ if (!ad->tp.freq == freq)
-+ return 0;
-+ if (msys == SYS_DVBS2 || msys == SYS_DVBS)
-+ {
-+ if (ad->tp.pol == pol && ad->tp.diseqc == diseqc)
-+ return 1;
-+ return 0;
-+ }
-+ return 1;
- }
-
--int get_free_adapter(int freq, int pol, int msys, int src)
-+int get_free_adapter(int freq, int pol, int msys, int src, int diseqc)
- {
- int i;
- adapter *ad;
- // init_all_hw();
-
-- i = (src > 0) ? src - 1 : 0;
-- ad = get_adapter(i);
-+ if (src > 0) {
-+ i = src - 1;
-+ ad = a[i];
-+ if (!delsys_match(ad, msys))
-+ ad = NULL;
-+ if (ad && !ad->enabled)
-+ {
-+ if (init_hw(i))
-+ goto noadapter;
-+ ad = get_adapter(i);
-+ }
-+ } else {
-+ ad = get_adapter(i = 0);
-+ }
- if (ad)
- LOG("get free adapter %d - a[%d] => e:%d m:%d sid_cnt:%d f:%d pol=%d",
- src - 1, i, ad->enabled, ad->master_sid, ad->sid_cnt,
-@@ -404,13 +452,14 @@ int get_free_adapter(int freq, int pol, int msys, int src)
-
- if (src > 0)
- {
-- if (ad)
-+ if (ad && delsys_match(ad, msys))
- {
-- if (ad->sid_cnt == 0 && delsys_match(ad, msys))
-+ if (ad->sid_cnt == 0)
- return i;
-- if (ad->tp.freq == freq && delsys_match(ad, msys))
-+ if (adapter_match(ad, freq, pol, msys, src, diseqc))
- return i;
- }
-+ goto noadapter;
- }
- for (i = 0; i < MAX_ADAPTERS; i++)
- {
-@@ -419,21 +468,17 @@ int get_free_adapter(int freq, int pol, int msys, int src)
- && delsys_match(ad, msys))
- return i;
- if (!ad && delsys_match(a[i], msys)) // device is not initialized
-- return_adapter(i);
-+ {
-+ if(!init_hw(i))
-+ return i;
-+ }
- }
-
- for (i = 0; i < MAX_ADAPTERS; i++)
-- if ((ad = get_adapter_nw(i)) && a[i]->tp.freq == freq
-- && delsys_match(ad, msys))
-- {
-- if ((msys == SYS_DVBS2 || msys == SYS_DVBS))
-- {
-- if (ad->tp.pol == pol)
-- return i;
-- }
-- else
-+ if ((ad = get_adapter_nw(i)) && delsys_match(ad, msys))
-+ if (adapter_match(ad, freq, pol, msys, src, diseqc))
- return i;
-- }
-+noadapter:
- LOG("no adapter found for f:%d pol:%d msys:%d", freq, pol, msys);
- dump_adapters();
- return -1;
-@@ -557,19 +602,13 @@ int tune(int aid, int sid)
- ad->last_sort = getTick();
- if (sid == ad->master_sid && ad->do_tune)
- {
-- ad->tp.switch_type = ad->switch_type;
-- ad->tp.uslot = ad->uslot;
-- ad->tp.ufreq = ad->ufreq;
-- ad->tp.pin = ad->pin;
-- ad->tp.only13v = ad->only13v;
--
-- ad->tp.committed_no = ad->committed_no;
-- ad->tp.uncommitted_no = ad->uncommitted_no;
-+ ad->tp.diseqc_param = ad->diseqc_param;
-
- rv = ad->tune(ad->id, &ad->tp);
+@@ -612,6 +612,7 @@ int tune(int aid, int sid)
ad->status = -1;
ad->status_cnt = 0;
set_socket_pos(ad->sock, 0); // flush the existing buffer
@@ -159,172 +10,7 @@ index 033490a..d5ae166 100644
ad->rlen = 0;
if (ad->sid_cnt > 1) // the master changed the frequency
{
-@@ -1067,7 +1106,7 @@ void set_unicable_adapters(char *o, int type)
- continue;
-
- if (!a[a_id])
-- a[a_id] = malloc(sizeof(adapter));
-+ a[a_id] = adapter_alloc();
- ad = a[a_id];
-
- sep1 = strchr(arg[i], ':');
-@@ -1084,11 +1123,11 @@ void set_unicable_adapters(char *o, int type)
- sep3 = strchr(sep2 + 1, '-');
- pin = map_intd(sep3, NULL, 0);
-
-- ad->uslot = slot;
-- ad->ufreq = freq;
-- ad->switch_type = type;
-- ad->pin = pin;
-- ad->only13v = o13v;
-+ ad->diseqc_param.uslot = slot;
-+ ad->diseqc_param.ufreq = freq;
-+ ad->diseqc_param.switch_type = type;
-+ ad->diseqc_param.pin = pin;
-+ ad->diseqc_param.only13v = o13v;
- LOGL(0, "Setting %s adapter %d slot %d freq %d",
- type == SWITCH_UNICABLE ? "unicable" : "jess", a_id, slot, freq);
- }
-@@ -1096,35 +1135,115 @@ void set_unicable_adapters(char *o, int type)
-
- void set_diseqc_adapters(char *o)
- {
-- int i, la, a_id, committed_no, uncommitted_no;
-+ int i, la, a_id, fast, committed_no, uncommitted_no;
- char buf[100], *arg[20], *sep1, *sep2;
- adapter *ad;
- strncpy(buf, o, sizeof(buf));
- la = split(arg, buf, sizeof(arg), ',');
- for (i = 0; i < la; i++)
- {
-- a_id = map_intd(arg[i], NULL, -1);
-- if (a_id < 0 || a_id >= MAX_ADAPTERS)
-- continue;
-+ if (arg[i] && arg[i][0] == '*') {
-+ ad = NULL;
-+ a_id = -1;
-+ } else {
-+ a_id = map_intd(arg[i], NULL, -1);
-+ if (a_id < 0 || a_id >= MAX_ADAPTERS)
-+ continue;
-
-- if (!a[a_id])
-- a[a_id] = malloc(sizeof(adapter));
-- ad = a[a_id];
-+ if (!a[a_id])
-+ a[a_id] = adapter_alloc();
-+ ad = a[a_id];
-+ }
-
- sep1 = strchr(arg[i], ':');
- sep2 = strchr(arg[i], '-');
-
- if (!sep1 || !sep2)
- continue;
-+ if ((fast = (sep1[1] == '*')) != 0)
-+ sep1++;
- committed_no = map_intd(sep1 + 1, NULL, -1);
- uncommitted_no = map_intd(sep2 + 1, NULL, -1);
- if (committed_no < 0 || uncommitted_no < 0)
- continue;
-
-- ad->committed_no = committed_no;
-- ad->uncommitted_no = uncommitted_no;
-- LOGL(0, "Setting diseqc adapter %d committed_no %d uncommitted_no %d",
-- a_id, committed_no, uncommitted_no);
-+ if (ad) {
-+ ad->diseqc_param.fast = fast;
-+ ad->diseqc_param.committed_no = committed_no;
-+ ad->diseqc_param.uncommitted_no = uncommitted_no;
-+ } else {
-+ opts.diseqc_fast = fast;
-+ opts.diseqc_committed_no = committed_no;
-+ opts.diseqc_uncommitted_no = uncommitted_no;
-+ }
-+ LOGL(0, "Setting diseqc adapter %d fast %d committed_no %d uncommitted_no %d",
-+ a_id, fast, committed_no, uncommitted_no);
-+ }
-+}
-+
-+void set_diseqc_timing(char *o)
-+{
-+ int i, la, a_id;
-+ int before_cmd, after_cmd, after_repeated_cmd;
-+ int after_switch, after_burst, after_tone;
-+ char buf[2000], *arg[20];
-+ char *sep1, *sep2, *sep3, *sep4, *sep5, *sep6, *sep7;
-+ adapter *ad;
-+ strncpy(buf, o, sizeof(buf));
-+ la = split(arg, buf, sizeof(arg), ',');
-+ for (i = 0; i < la; i++)
-+ {
-+ if (arg[i] && arg[i][0] == '*') {
-+ ad = NULL;
-+ a_id = -1;
-+ } else {
-+ a_id = map_intd(arg[i], NULL, -1);
-+ if (a_id < 0 || a_id >= MAX_ADAPTERS)
-+ continue;
-+
-+ if (!a[a_id])
-+ a[a_id] = adapter_alloc();
-+ ad = a[a_id];
-+ }
-+
-+ sep1 = strchr(arg[i], ':');
-+ sep2 = strchr(arg[i], '-');
-+ sep3 = sep2 ? strchr(sep2 + 1, '-') : NULL;
-+ sep4 = sep3 ? strchr(sep3 + 1, '-') : NULL;
-+ sep5 = sep4 ? strchr(sep4 + 1, '-') : NULL;
-+ sep6 = sep5 ? strchr(sep5 + 1, '-') : NULL;
-+
-+ if (!sep1 || !sep2 || !sep3 || !sep4 || !sep5 || !sep6)
-+ continue;
-+ before_cmd = map_intd(sep1 + 1, NULL, -1);
-+ after_cmd = map_intd(sep2 + 1, NULL, -1);
-+ after_repeated_cmd = map_intd(sep3 + 1, NULL, -1);
-+ after_switch = map_intd(sep4 + 1, NULL, -1);
-+ after_burst = map_intd(sep5 + 1, NULL, -1);
-+ after_tone = map_intd(sep6 + 1, NULL, -1);
-+ if (before_cmd < 0 || after_cmd < 0 || after_repeated_cmd < 0 ||
-+ after_switch < 0 || after_burst < 0 || after_tone < 0)
-+ continue;
-+
-+ if (ad) {
-+ ad->diseqc_param.before_cmd = before_cmd;
-+ ad->diseqc_param.after_cmd = after_cmd;
-+ ad->diseqc_param.after_repeated_cmd = after_repeated_cmd;
-+ ad->diseqc_param.after_switch = after_switch;
-+ ad->diseqc_param.after_burst = after_burst;
-+ ad->diseqc_param.after_tone = after_tone;
-+ } else {
-+ opts.diseqc_before_cmd = before_cmd;
-+ opts.diseqc_after_cmd = after_cmd;
-+ opts.diseqc_after_repeated_cmd = after_repeated_cmd;
-+ opts.diseqc_after_switch = after_switch;
-+ opts.diseqc_after_burst = after_burst;
-+ opts.diseqc_after_tone = after_tone;
-+ }
-+ LOGL(0, "Setting diseqc timing for adapter %d before cmd %d after cmd %d "
-+ "after repeated cmd %d after switch %d after burst %d after tone %d",
-+ a_id, before_cmd, after_cmd, after_repeated_cmd,
-+ after_switch, after_burst, after_tone);
- }
- }
-
-@@ -1152,16 +1271,63 @@ void set_slave_adapters(char *o)
- for (j = a_id; j <= a_id2; j++)
- {
- if (!a[j])
-- a[j] = malloc1(sizeof(adapter));
-+ a[j] = adapter_alloc();
-
- ad = a[j];
-- ad->switch_type = SWITCH_SLAVE;
-+ ad->diseqc_param.switch_type = SWITCH_SLAVE;
-
- LOGL(0, "Setting slave adapter %d", j);
- }
+@@ -1284,6 +1285,53 @@ void set_slave_adapters(char *o)
}
}
@@ -378,76 +64,8 @@ index 033490a..d5ae166 100644
extern char *fe_delsys[];
void set_adapters_delsys(char *o)
{
-@@ -1186,7 +1352,7 @@ void set_adapters_delsys(char *o)
- ds = map_intd(sep + 1, fe_delsys, 0);
-
- if (!a[a_id])
-- a[a_id] = malloc1(sizeof(adapter));
-+ a[a_id] = adapter_alloc();
-
- ad = a[a_id];
- ad->sys[0] = ds;
-@@ -1371,42 +1537,24 @@ char *get_all_delsys(int aid, char *dest, int max_size)
- return dest;
- }
-
--adapter *a_tmp;
--
- _symbols adapters_sym[] =
- {
--{ "ad_enabled", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS,
-- (long int) &a_tmp[0].enabled - (long int) &a_tmp[0] },
--{ "ad_type", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].type
-- - (long int) &a_tmp[0] },
--{ "ad_freq", VAR_AARRAY_INT, a, 1. / 1000,
--MAX_ADAPTERS, (long int) &a_tmp[0].tp.freq - (long int) &a_tmp[0] },
--{ "ad_strength", VAR_AARRAY_UINT16, a, 1,
--MAX_ADAPTERS, (long int) &a_tmp[0].strength - (long int) &a_tmp[0] },
--{ "ad_snr", VAR_AARRAY_UINT16, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].snr
-- - (long int) &a_tmp[0] },
--{ "ad_ber", VAR_AARRAY_UINT16, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].ber
-- - (long int) &a_tmp[0] },
--{ "ad_pol", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].tp.pol
-- - (long int) &a_tmp[0] },
--{ "ad_sr", VAR_AARRAY_INT, a, 1. / 1000, MAX_ADAPTERS,
-- (long int) &a_tmp[0].tp.sr - (long int) &a_tmp[0] },
--{ "ad_bw", VAR_AARRAY_INT, a, 1. / 1000, MAX_ADAPTERS,
-- (long int) &a_tmp[0].tp.bw - (long int) &a_tmp[0] },
--{ "ad_diseqc", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS,
-- (long int) &a_tmp[0].tp.diseqc - (long int) &a_tmp[0] },
--{ "ad_fe", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].fe
-- - (long int) &a_tmp[0] },
--{ "ad_master", VAR_AARRAY_UINT8, a, 1,
--MAX_ADAPTERS, (long int) &a_tmp[0].master_sid - (long int) &a_tmp[0] },
--{ "ad_sidcount", VAR_AARRAY_UINT8, a, 1,
--MAX_ADAPTERS, (long int) &a_tmp[0].sid_cnt - (long int) &a_tmp[0] },
--{ "ad_phyad", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].pa
-- - (long int) &a_tmp[0] },
--{ "ad_phyfd", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].fn
-- - (long int) &a_tmp[0] },
--{ "ad_sys", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, (long int) &a_tmp[0].tp.sys
-- - (long int) &a_tmp[0] },
-+{ "ad_enabled", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS, offsetof(adapter, enabled) },
-+{ "ad_type", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS, offsetof(adapter, type) },
-+{ "ad_freq", VAR_AARRAY_INT, a, 1. / 1000, MAX_ADAPTERS, offsetof(adapter, tp.freq) },
-+{ "ad_strength", VAR_AARRAY_UINT16, a, 1, MAX_ADAPTERS, offsetof(adapter, strength) },
-+{ "ad_snr", VAR_AARRAY_UINT16, a, 1, MAX_ADAPTERS, offsetof(adapter, snr) },
-+{ "ad_ber", VAR_AARRAY_UINT16, a, 1, MAX_ADAPTERS, offsetof(adapter, ber) },
-+{ "ad_pol", VAR_AARRAY_INT8, a, 1, MAX_ADAPTERS, offsetof(adapter, tp.pol) },
-+{ "ad_sr", VAR_AARRAY_INT, a, 1. / 1000, MAX_ADAPTERS, offsetof(adapter, tp.sr) },
-+{ "ad_bw", VAR_AARRAY_INT, a, 1. / 1000, MAX_ADAPTERS, offsetof(adapter, tp.bw) },
-+{ "ad_diseqc", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof(adapter, tp.diseqc) },
-+{ "ad_fe", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof(adapter, fe) },
-+{ "ad_master", VAR_AARRAY_UINT8, a, 1, MAX_ADAPTERS, offsetof(adapter, master_sid) },
-+{ "ad_sidcount", VAR_AARRAY_UINT8, a, 1, MAX_ADAPTERS, offsetof(adapter, sid_cnt) },
-+{ "ad_phyad", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof(adapter, pa) },
-+{ "ad_phyfd", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof(adapter, fn) },
-+{ "ad_sys", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof(adapter, tp.sys) },
- { "ad_allsys", VAR_FUNCTION_STRING, (void *) &get_all_delsys, 0, 0, 0 },
- { "ad_pids", VAR_FUNCTION_STRING, (void *) &get_adapter_pids, 0, 0, 0 },
- { "tuner_s2", VAR_INT, &tuner_s2, 1, 0, 0 },
diff --git a/adapter.h b/adapter.h
-index e693479..0a0c87e 100644
+index d7d9194..317b19c 100644
--- a/adapter.h
+++ b/adapter.h
@@ -6,7 +6,11 @@
@@ -471,42 +89,19 @@ index e693479..0a0c87e 100644
int pa, fn;
// physical adapter, physical frontend number
fe_delivery_system_t sys[MAX_DELSYS];
-@@ -83,12 +87,13 @@ typedef struct struct_adapter
- uint32_t ber;
+@@ -84,6 +88,9 @@ typedef struct struct_adapter
uint16_t strength, snr, max_strength, max_snr;
uint32_t pid_err, dec_err; // detect pids received but not part of any stream, decrypt errors
-- int switch_type;
-- int uslot; // unicable/jess slot
-- int ufreq; // unicable/jess frequency
-- int pin;
-- int only13v; // unicable - use 13V voltage only
-- int committed_no, uncommitted_no; // diseqc info
+ diseqc diseqc_param;
+ int slave;
+ int axe_used;
+ int axe_feused;
-+ diseqc diseqc_param;
-+ int old_diseqc;
-+ int old_hiband;
-+ int old_pol;
- int id;
- int pat_processed, transponder_id, pat_ver;
- char name[5];
-@@ -109,8 +114,9 @@ extern int a_count;
- int init_hw(int dev);
- int init_all_hw();
- int getAdaptersCount();
-+adapter *adapter_alloc();
- void close_adapter(int na);
--int get_free_adapter(int freq, int pol, int msys, int src);
-+int get_free_adapter(int freq, int pol, int msys, int src, int diseqc);
- int set_adapter_for_stream(int i, int a);
- void close_adapter_for_stream(int sid, int aid);
- int set_adapter_parameters(int aid, int sid, transponder * tp);
-@@ -128,7 +134,10 @@ void sort_pids(int aid);
- void enable_adapters(char *o);
- void set_unicable_adapters(char *o, int type);
+ int old_diseqc;
+ int old_hiband;
+ int old_pol;
+@@ -129,6 +136,8 @@ void set_unicable_adapters(char *o, int type);
void set_diseqc_adapters(char *o);
-+void set_diseqc_timing(char *o);
+ void set_diseqc_timing(char *o);
void set_slave_adapters(char *o);
+void set_link_adapters(char *o);
+void set_unicable_input(char *o);
@@ -669,7 +264,7 @@ index 0000000..d8b06bc
+
+#endif
diff --git a/dvb.c b/dvb.c
-index 259b93d..fcad626 100644
+index 7916d2b..7daa5a8 100644
--- a/dvb.c
+++ b/dvb.c
@@ -42,6 +42,11 @@
@@ -684,15 +279,7 @@ index 259b93d..fcad626 100644
char *fe_pilot[] =
{ "on", "off", " ", //auto
NULL };
-@@ -235,7 +240,6 @@ void init_dvb_parameters(transponder * tp)
- tp->mtype = -1;
- tp->plts = PILOT_AUTO;
- tp->fec = FEC_AUTO;
-- tp->old_diseqc = tp->old_pol = tp->old_hiband = -1;
- }
-
- void copy_dvb_parameters(transponder * s, transponder * d)
-@@ -330,50 +334,99 @@ int dvb_open_device(adapter *ad)
+@@ -329,29 +334,45 @@ int dvb_open_device(adapter *ad)
char buf[100];
LOG("trying to open [%d] adapter %d and frontend %d", ad->id, ad->pa,
ad->fn);
@@ -739,36 +326,13 @@ index 259b93d..fcad626 100644
return 0;
}
--void diseqc_cmd(int fd, int times, char *str, struct dvb_diseqc_master_cmd *cmd)
-+void msleep(long ms)
-+{
-+ if (ms > 0)
-+ usleep(ms * 1000);
-+}
-+
-+void diseqc_cmd(int fd, int times, char *str, struct dvb_diseqc_master_cmd *cmd,
-+ diseqc *d)
- {
- int i;
-+ msleep(d->before_cmd);
- for (i = 0; i < times; i++)
- {
-- usleep(15000);
- if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, cmd) == -1)
- LOG(
- "send_diseqc: FE_DISEQC_SEND_MASTER_CMD %s failed for fd %d: %s",
- str, fd, strerror(errno));
-- usleep(54000);
-+ msleep(i > 0 ? d->after_repeated_cmd : d->after_cmd);
- }
+@@ -377,6 +398,31 @@ void diseqc_cmd(int fd, int times, char *str, struct dvb_diseqc_master_cmd *cmd,
}
--int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
-- int uncommitted_no)
+#ifdef AXE
+void axe_wakeup(int voltage)
- {
++{
+ int i;
+ adapter *a;
+ if (opts.axe_power < 2)
@@ -791,14 +355,10 @@ index 259b93d..fcad626 100644
+}
+#endif
+
-+int send_diseqc(int fd, int pos, int pos_change, int pol, int hiband, diseqc *d)
-+{
-+ int committed_no = d->committed_no;
-+ int uncommitted_no = d->uncommitted_no;
- int uncommitted_first = 0;
- int posu, posc;
- /* DiSEqC 1.0 */
-@@ -405,6 +458,9 @@ int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
+ int send_diseqc(int fd, int pos, int pos_change, int pol, int hiband, diseqc *d)
+ {
+ int committed_no = d->committed_no;
+@@ -412,6 +458,9 @@ int send_diseqc(int fd, int pos, int pos_change, int pol, int hiband, diseqc *d)
LOGL(3, "send_diseqc fd %d, pos = %d (c %d u %d), pol = %d, hiband = %d",
fd, pos, posc, posu, pol, hiband);
@@ -808,80 +368,9 @@ index 259b93d..fcad626 100644
if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd,
strerror(errno));
-@@ -412,77 +468,86 @@ int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
- LOG("send_diseqc: FE_SET_VOLTAGE failed for fd %d: %s", fd,
- strerror(errno));
-
-- if (uncommitted_first)
-- diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd);
-+ if (!d->fast || pos_change) {
-
-- diseqc_cmd(fd, committed_no, "committed", &cmd);
-+ if (uncommitted_first)
-+ diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd, d);
-
-- if (!uncommitted_first)
-- diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd);
-+ diseqc_cmd(fd, committed_no, "committed", &cmd, d);
-
-- usleep(15000);
-- if (ioctl(fd, FE_DISEQC_SEND_BURST, (pos & 1) ? SEC_MINI_B : SEC_MINI_A)
-- == -1)
-- LOG("send_diseqc: FE_DISEQC_SEND_BURST failed for fd %d: %s", fd,
-- strerror(errno));
-- usleep(15000);
-+ if (!uncommitted_first)
-+ diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd, d);
-+
-+ msleep(d->after_switch);
-+
-+ if (ioctl(fd, FE_DISEQC_SEND_BURST, (pos & 1) ? SEC_MINI_B : SEC_MINI_A) == -1)
-+ LOG("send_diseqc: FE_DISEQC_SEND_BURST failed for fd %d: %s", fd,
-+ strerror(errno));
-+
-+ }
-+
-+ msleep(d->after_burst);
-
- if (ioctl(fd, FE_SET_TONE, hiband ? SEC_TONE_ON : SEC_TONE_OFF) == -1)
- LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd,
- strerror(errno));
-
-+ msleep(d->after_tone);
-+
- return 0;
- }
-
--int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot,
-- int ufreq, int pin, int o13v)
-+int send_unicable(int fd, int freq, int pos, int pol, int hiband, diseqc *d)
- {
- struct dvb_diseqc_master_cmd cmd =
- {
- { 0xe0, 0x11, 0x5a, 0x00, 0x00 }, 5 };
- int t;
-
-- t = (freq + ufreq + 2) / 4 - 350;
-+ t = (freq + d->ufreq + 2) / 4 - 350;
-
-- cmd.msg[3] = ((t & 0x0300) >> 8) | (slot << 5) | (pos ? 0x10 : 0)
-+ cmd.msg[3] = ((t & 0x0300) >> 8) | (d->uslot << 5) | (pos ? 0x10 : 0)
- | (hiband ? 4 : 0) | (pol ? 8 : 0);
- cmd.msg[4] = t & 0xff;
-
-- if (pin)
-+ if (d->pin)
- {
- cmd.msg_len = 6;
- cmd.msg[2] = 0x5C;
-- cmd.msg[5] = pin;
-+ cmd.msg[5] = d->pin;
- }
-
- LOGL(3,
+@@ -472,6 +521,9 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, diseqc *d)
"send_unicable fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x",
-- fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1],
-+ fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1],
+ fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1],
cmd.msg[2], cmd.msg[3], cmd.msg[4]);
+#ifdef AXE
+ axe_wakeup(SEC_VOLTAGE_13);
@@ -889,59 +378,8 @@ index 259b93d..fcad626 100644
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
LOG("send_unicable: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s",
fd, strerror(errno));
-- usleep(15000);
-+ msleep(d->before_cmd);
- if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
- LOG("send_unicable: FE_SET_TONE failed for fd %d: %s", fd,
- strerror(errno));
-- if (!o13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
-+ if (!d->only13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
- LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd,
- strerror(errno));
-- usleep(15000);
-+ msleep(d->after_burst);
- if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
- LOG("send_unicable: FE_DISEQC_SEND_MASTER_CMD failed for fd %d: %s", fd,
- strerror(errno));
-- usleep(15000);
-+ msleep(d->after_repeated_cmd);
- if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
- LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd,
- strerror(errno));
-+ msleep(d->after_tone);
-
-- return ufreq * 1000;
-+ return d->ufreq * 1000;
- }
-
--int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot,
-- int ufreq, int pin, int o13v)
-+int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d)
- {
- struct dvb_diseqc_master_cmd cmd =
- {
-@@ -490,44 +555,48 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot,
- // int t = (freq / 1000) - 100;
- int t = freq - 100;
-
-- cmd.msg[1] = slot << 3;
-+ cmd.msg[1] = d->uslot << 3;
- cmd.msg[1] |= ((t << 8) & 0x07);
- cmd.msg[2] = (t & 0xff);
- cmd.msg[3] = ((pos & 0x3f) << 2) | (pol ? 2 : 0) | (hiband ? 1 : 0);
-- if (pin < 256)
-+ if (d->pin < 256)
- {
- cmd.msg_len = 5;
- cmd.msg[0] = 0x71;
-- cmd.msg[4] = pin;
-+ cmd.msg[4] = d->pin;
- }
-
- LOGL(3,
- "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x",
-- fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1],
-+ fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1],
+@@ -519,6 +571,9 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d)
+ fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1],
cmd.msg[2], cmd.msg[3], cmd.msg[4]);
+#ifdef AXE
@@ -950,49 +388,45 @@ index 259b93d..fcad626 100644
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
LOG("send_jess: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd,
strerror(errno));
-- usleep(15000);
-+ msleep(d->before_cmd);
- if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
- LOG("send_jess: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno));
-- if (!o13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
-+ if (!d->only13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
- LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd,
- strerror(errno));
-- usleep(15000);
-+ msleep(d->after_burst);
- if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
- LOG("send_jess: FE_DISEQC_SEND_MASTER_CMD failed for fd %d: %s", fd,
- strerror(errno));
-- usleep(15000);
-+ msleep(d->after_repeated_cmd);
- if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
- LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd,
- strerror(errno));
-+ msleep(d->after_tone);
-
-- return ufreq * 1000;
-+ return d->ufreq * 1000;
+@@ -541,6 +596,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d)
+ return d->ufreq * 1000;
}
--int setup_switch(int frontend_fd, transponder *tp)
-+int setup_switch(int frontend_fd, adapter *ad, transponder *tp)
++#ifdef AXE
++static inline int extra_quattro(int input, int diseqc, int *equattro)
++{
++ if (diseqc <= 0)
++ *equattro = 0;
++ /* lowband allowed - control the hiband inputs independently for positions src=2+ */
++ else if (opts.quattro_hiband == 1 && input < 2)
++ *equattro = diseqc - 1;
++ /* hiband allowed - control the lowband inputs independently for positions src=2+ */
++ else if (opts.quattro_hiband == 2 && input >= 2 && input < 4)
++ *equattro = diseqc - 1;
++ else
++ *equattro = 0;
++ return *equattro;
++}
++#endif
++
+ int setup_switch(int frontend_fd, adapter *ad, transponder *tp)
{
int hiband = 0;
- int diseqc = (tp->diseqc > 0) ? tp->diseqc - 1 : 0;
-@@ -550,35 +619,140 @@ int setup_switch(int frontend_fd, transponder *tp)
+@@ -564,15 +636,112 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp)
hiband = 1;
}
-- if (tp->switch_type == SWITCH_UNICABLE)
+#ifdef AXE
+ adapter *ad2, *adm;
-+ int input = 0, aid;
++ int input = 0, aid, equattro = 0;
+
+ ad->axe_feused = 1;
+ if (tp->diseqc_param.switch_type != SWITCH_UNICABLE &&
+ tp->diseqc_param.switch_type != SWITCH_JESS) {
+ input = ad->id;
-+ if (ad && !opts.quattro) {
++ if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) {
++ if (equattro > 0)
++ diseqc = equattro - 1;
+ adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa);
+ if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input);
@@ -1012,7 +446,7 @@ index 259b93d..fcad626 100644
+ adm->old_diseqc != diseqc))
+ return 0;
+ }
-+ adm->axe_used |= (1 << aid);
++ adm->axe_used |= (1 << input);
+ adm->axe_feused = 1;
+ if (ad->slave) {
+ input = ad->slave - 1;
@@ -1020,7 +454,7 @@ index 259b93d..fcad626 100644
+ adm->old_hiband != hiband ||
+ adm->old_diseqc != diseqc) {
+ send_diseqc(adm->fe, diseqc, adm->old_diseqc != diseqc,
-+ pol, hiband, &tp->diseqc_param);
++ pol, hiband, &tp->diseqc_param);
+ adm->old_pol = pol;
+ adm->old_hiband = hiband;
+ adm->old_diseqc = diseqc;
@@ -1044,17 +478,19 @@ index 259b93d..fcad626 100644
+ return 0;
+ }
+ if(adm->old_pol != pol || adm->old_hiband != hiband) {
-+ send_diseqc(adm->fe, 0, 0, pol, hiband, &tp->diseqc_param);
++ send_diseqc(adm->fe, 0, 0, pol, hiband,
++ &tp->diseqc_param);
+ adm->old_pol = pol;
+ adm->old_hiband = hiband;
+ adm->old_diseqc = diseqc = 0;
+ }
-+ adm->axe_used |= (1 << aid);
++ adm->axe_used |= (1 << input);
+ adm->axe_feused = 1;
+ goto axe;
+ }
+ } else {
-+ input = opts.axe_unicinp[ad->id & 3];
++ aid = ad->id & 3;
++ input = opts.axe_unicinp[aid];
+ ad = get_adapter(input);
+ if (ad == NULL) {
+ LOGL(3, "axe setup: unable to find adapter %d", input);
@@ -1065,60 +501,34 @@ index 259b93d..fcad626 100644
+ }
+#endif
+
-+ if (tp->diseqc_param.switch_type == SWITCH_UNICABLE)
+ if (tp->diseqc_param.switch_type == SWITCH_UNICABLE)
{
-- freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband,
-- tp->uslot, tp->ufreq, tp->pin, tp->only13v);
+#ifdef AXE
+ if (ad)
+ freq = send_unicable(ad->fe, freq / 1000, diseqc,
-+ pol, hiband, &tp->diseqc_param);
++ pol, hiband, &tp->diseqc_param);
+#else
-+ freq = send_unicable(frontend_fd, freq / 1000, diseqc,
-+ pol, hiband, &tp->diseqc_param);
+ freq = send_unicable(frontend_fd, freq / 1000, diseqc,
+ pol, hiband, &tp->diseqc_param);
+#endif
}
-- else if (tp->switch_type == SWITCH_JESS)
-+ else if (tp->diseqc_param.switch_type == SWITCH_JESS)
+ else if (tp->diseqc_param.switch_type == SWITCH_JESS)
{
-- freq = send_jess(frontend_fd, freq / 1000, diseqc, pol, hiband,
-- tp->uslot, tp->ufreq, tp->pin, tp->only13v);
+#ifdef AXE
+ if (ad)
+ freq = send_jess(ad->fe, freq / 1000, diseqc,
-+ pol, hiband, &tp->diseqc_param);
++ pol, hiband, &tp->diseqc_param);
+#else
-+ freq = send_jess(frontend_fd, freq / 1000, diseqc,
-+ pol, hiband, &tp->diseqc_param);
+ freq = send_jess(frontend_fd, freq / 1000, diseqc,
+ pol, hiband, &tp->diseqc_param);
+#endif
}
-- else if (tp->switch_type == SWITCH_SLAVE)
-+ else if (tp->diseqc_param.switch_type == SWITCH_SLAVE)
+ else if (tp->diseqc_param.switch_type == SWITCH_SLAVE)
{
- LOGL(2, "FD %d is a slave adapter", frontend_fd);
- }
- else
- {
-- if (tp->old_pol != pol || tp->old_hiband != hiband
-- || tp->old_diseqc != diseqc)
-- send_diseqc(frontend_fd, diseqc, pol, hiband, tp->committed_no,
-- tp->uncommitted_no);
-+ if (ad->old_pol != pol || ad->old_hiband != hiband
-+ || ad->old_diseqc != diseqc)
-+ send_diseqc(frontend_fd, diseqc, ad->old_diseqc != diseqc,
-+ pol, hiband, &tp->diseqc_param);
- else
-- LOGL(3,
-- "Skip sending diseqc commands since the switch position doesn't need to be changed: pol %d, hiband %d, switch position %d",
-+ LOGL(3, "Skip sending diseqc commands since "
-+ "the switch position doesn't need to be changed: "
-+ "pol %d, hiband %d, switch position %d",
+@@ -591,6 +760,17 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp)
pol, hiband, diseqc);
}
-- tp->old_pol = pol;
-- tp->old_hiband = hiband;
-- tp->old_diseqc = diseqc;
+#ifdef AXE
+axe:
+ LOGL(3, "axe_fe: reset for fd %d adapter %d input %d", frontend_fd, ad ? ad->pa : -1, input);
@@ -1130,13 +540,10 @@ index 259b93d..fcad626 100644
+ return freq;
+#endif
+
-+ ad->old_pol = pol;
-+ ad->old_hiband = hiband;
-+ ad->old_diseqc = diseqc;
-
- return freq;
- }
-@@ -611,6 +785,14 @@ int dvb_tune(int aid, transponder * tp)
+ ad->old_pol = pol;
+ ad->old_hiband = hiband;
+ ad->old_diseqc = diseqc;
+@@ -626,6 +806,14 @@ int dvb_tune(int aid, transponder * tp)
memset(p_cmd, 0, sizeof(p_cmd));
bclear = getTick();
@@ -1151,14 +558,7 @@ index 259b93d..fcad626 100644
if ((ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear)) == -1)
{
LOG("FE_SET_PROPERTY DTV_CLEAR failed for fd %d: %s", fd_frontend,
-@@ -624,14 +806,16 @@ int dvb_tune(int aid, transponder * tp)
- case SYS_DVBS2:
-
- bpol = getTick();
-- freq = setup_switch(fd_frontend, tp);
-+ freq = setup_switch(fd_frontend, ad, tp);
- if (freq < MIN_FRQ_DVBS || freq > MAX_FRQ_DVBS)
- LOG_AND_RETURN(-404, "Frequency %d is not within range ", freq)
+@@ -645,8 +833,10 @@ int dvb_tune(int aid, transponder * tp)
ADD_PROP(DTV_SYMBOL_RATE, tp->sr)
ADD_PROP(DTV_INNER_FEC, tp->fec)
@@ -1169,7 +569,7 @@ index 259b93d..fcad626 100644
#if DVBAPIVERSION >= 0x0502
ADD_PROP(DTV_STREAM_ID, tp->plp)
#endif
-@@ -640,7 +824,12 @@ int dvb_tune(int aid, transponder * tp)
+@@ -655,7 +845,12 @@ int dvb_tune(int aid, transponder * tp)
"tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%d, ts pol=%d",
tp->freq, freq, get_pol(tp->pol), tp->pol, tp->sr,
fe_fec[tp->fec], fe_delsys[tp->sys], fe_modulation[tp->mtype],
@@ -1183,7 +583,7 @@ index 259b93d..fcad626 100644
break;
case SYS_DVBT:
-@@ -741,29 +930,46 @@ int dvb_tune(int aid, transponder * tp)
+@@ -756,29 +951,46 @@ int dvb_tune(int aid, transponder * tp)
if (ioctl(fd_frontend, FE_SET_PROPERTY, &p) == -1)
{
LOG("dvb_tune: set property failed %d %s", errno, strerror(errno));
@@ -1235,7 +635,7 @@ index 259b93d..fcad626 100644
return -1;
}
-@@ -789,10 +995,22 @@ int dvb_set_pid(adapter *a, uint16_t i_pid)
+@@ -804,10 +1016,22 @@ int dvb_set_pid(adapter *a, uint16_t i_pid)
LOG("setting filter on PID %d for fd %d", i_pid, fd);
return fd;
@@ -1258,7 +658,7 @@ index 259b93d..fcad626 100644
if (fd < 0)
LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid);
if (ioctl(fd, DMX_STOP, NULL) < 0)
-@@ -801,10 +1019,20 @@ int dvb_del_filters(int fd, int pid)
+@@ -816,10 +1040,20 @@ int dvb_del_filters(int fd, int pid)
LOG("clearing filter on PID %d FD %d", pid, fd);
close(fd);
return 0;
@@ -1279,7 +679,7 @@ index 259b93d..fcad626 100644
int i, res, rv = 0;
struct dvb_frontend_info fe_info;
-@@ -893,6 +1121,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys)
+@@ -908,6 +1142,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys)
fe_delsys[sys[i]], sys[i]);
return (fe_delivery_system_t) rv;
@@ -1287,7 +687,7 @@ index 259b93d..fcad626 100644
}
-@@ -1005,6 +1234,7 @@ void dvb_get_signal(adapter *ad)
+@@ -1020,6 +1255,7 @@ void dvb_get_signal(adapter *ad)
ad->max_strength = (ad->strength > 0) ? ad->strength : 1;
if (ad->max_snr <= ad->snr)
ad->max_snr = (ad->snr > 0) ? ad->snr : 1;
@@ -1295,7 +695,7 @@ index 259b93d..fcad626 100644
if (ad->snr > 4096)
new_gs = 0;
if (new_gs)
-@@ -1017,6 +1247,14 @@ void dvb_get_signal(adapter *ad)
+@@ -1032,6 +1268,14 @@ void dvb_get_signal(adapter *ad)
ad->strength = ad->strength >> 8;
ad->snr = ad->snr >> 8;
}
@@ -1310,7 +710,7 @@ index 259b93d..fcad626 100644
}
void dvb_commit(adapter *a)
-@@ -1024,6 +1262,47 @@ void dvb_commit(adapter *a)
+@@ -1039,6 +1283,47 @@ void dvb_commit(adapter *a)
return;
}
@@ -1358,7 +758,7 @@ index 259b93d..fcad626 100644
void find_dvb_adapter(adapter **a)
{
int na = 0;
-@@ -1032,9 +1311,21 @@ void find_dvb_adapter(adapter **a)
+@@ -1047,9 +1332,21 @@ void find_dvb_adapter(adapter **a)
int i = 0, j = 0;
adapter *ad;
@@ -1380,7 +780,7 @@ index 259b93d..fcad626 100644
sprintf(buf, "/dev/dvb/adapter%d/frontend%d", i, j);
fd = open(buf, O_RDONLY | O_NONBLOCK);
if (fd < 0)
-@@ -1042,7 +1333,8 @@ void find_dvb_adapter(adapter **a)
+@@ -1057,7 +1354,8 @@ void find_dvb_adapter(adapter **a)
sprintf(buf, "/dev/dvb/adapter%d/ca%d", i, j);
fd = open(buf, O_RDONLY | O_NONBLOCK);
}
@@ -1390,16 +790,7 @@ index 259b93d..fcad626 100644
if (fd >= 0)
{
// if (is_adapter_disabled(na))
-@@ -1051,7 +1343,7 @@ void find_dvb_adapter(adapter **a)
- // continue;
- // }
- if (!a[na])
-- a[na] = malloc1(sizeof(adapter));
-+ a[na] = adapter_alloc();
-
- ad = a[na];
- ad->pa = i;
-@@ -1064,7 +1356,7 @@ void find_dvb_adapter(adapter **a)
+@@ -1079,7 +1377,7 @@ void find_dvb_adapter(adapter **a)
ad->tune = (Tune) dvb_tune;
ad->delsys = (Dvb_delsys) dvb_delsys;
ad->post_init = NULL;
@@ -1408,7 +799,7 @@ index 259b93d..fcad626 100644
ad->get_signal = (Device_signal) dvb_get_signal;
ad->type = ADAPTER_DVB;
close(fd);
-@@ -1073,6 +1365,14 @@ void find_dvb_adapter(adapter **a)
+@@ -1088,6 +1386,14 @@ void find_dvb_adapter(adapter **a)
if (na == MAX_ADAPTERS)
return;
}
@@ -1423,221 +814,11 @@ index 259b93d..fcad626 100644
}
for (; na < MAX_ADAPTERS; na++)
if (a[na])
-diff --git a/dvb.h b/dvb.h
-index 0ab67a7..0f54e8e 100644
---- a/dvb.h
-+++ b/dvb.h
-@@ -165,6 +165,28 @@ typedef enum fe_modulation {
- #define MIN_FRQ_DVBS 950000
- #define MAX_FRQ_DVBS 2150000
-
-+typedef struct diseqc
-+{
-+#define SWITCH_UNICABLE 1
-+#define SWITCH_JESS 2
-+#define SWITCH_SLAVE 3
-+ int switch_type;
-+ /* parameters */
-+ int uslot; // unicable/jess slot
-+ int ufreq; // unicable/jess frequency
-+ int pin;
-+ int only13v; // unicable - use 13V voltage only
-+ int fast; // don't send diseqc without position change
-+ int committed_no, uncommitted_no; // diseqc info
-+ /* timing */
-+ int before_cmd;
-+ int after_cmd;
-+ int after_repeated_cmd;
-+ int after_switch;
-+ int after_burst;
-+ int after_tone;
-+} diseqc;
-+
- typedef struct struct_transponder
- {
- fe_delivery_system_t sys;
-@@ -189,18 +211,8 @@ typedef struct struct_transponder
- int pol;
- int diseqc;
-
--#define SWITCH_UNICABLE 1
--#define SWITCH_JESS 2
--#define SWITCH_SLAVE 3
--
-- int switch_type; // tuner type
-- int uslot; // unicable/jess slot
-- int ufreq; // unicable/jess frequency
-- int pin;
-- int only13v; // use only 13V voltage
-- int committed_no, uncommitted_no; //diseqc informations
-- int old_pol, old_hiband, old_diseqc; // used to cache the diseqc position
--
-+ diseqc diseqc_param;
-+
- // DVB-C2
- int c2tft;
- int ds;
-diff --git a/dvbapi.c b/dvbapi.c
-index e832773..0bccd2e 100644
---- a/dvbapi.c
-+++ b/dvbapi.c
-@@ -991,25 +991,16 @@ void dvbapi_delete_keys_for_adapter(int aid)
- keys_del(i);
- }
-
--SKey *k_tmp;
- _symbols dvbapi_sym[] =
- {
--{ "key_enabled", VAR_AARRAY_INT8, keys, 1, MAX_KEYS,
-- (long int) &k_tmp[0].enabled - (long int) &k_tmp[0] },
--{ "key_hops", VAR_AARRAY_INT8, keys, 1, MAX_KEYS, (long int) &k_tmp[0].hops
-- - (long int) &k_tmp[0] },
--{ "key_ecmtime", VAR_AARRAY_INT, keys, 1, MAX_KEYS, (long int) &k_tmp[0].ecmtime
-- - (long int) &k_tmp[0] },
--{ "key_pmt", VAR_AARRAY_INT, keys, 1, MAX_KEYS, (long int) &k_tmp[0].pmt_pid
-- - (long int) &k_tmp[0] },
--{ "key_cardsystem", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS,
-- (long int) &k_tmp[0].cardsystem - (long int) &k_tmp[0] },
--{ "key_reader", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS,
-- (long int) &k_tmp[0].reader - (long int) &k_tmp[0] },
--{ "key_from", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS, (long int) &k_tmp[0].from
-- - (long int) &k_tmp[0] },
--{ "key_protocol", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS,
-- (long int) &k_tmp[0].protocol - (long int) &k_tmp[0] },
-+{ "key_enabled", VAR_AARRAY_INT8, keys, 1, MAX_KEYS, offsetof(SKey, enabled) },
-+{ "key_hops", VAR_AARRAY_INT8, keys, 1, MAX_KEYS, offsetof(SKey, hops) },
-+{ "key_ecmtime", VAR_AARRAY_INT, keys, 1, MAX_KEYS, offsetof(SKey, ecmtime) },
-+{ "key_pmt", VAR_AARRAY_INT, keys, 1, MAX_KEYS, offsetof(SKey, pmt_pid) },
-+{ "key_cardsystem", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS, offsetof(SKey, cardsystem) },
-+{ "key_reader", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS, offsetof(SKey, reader) },
-+{ "key_from", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS, offsetof(SKey, from) },
-+{ "key_protocol", VAR_AARRAY_PSTRING, keys, 1, MAX_KEYS, offsetof(SKey, protocol) },
-
- { NULL, 0, NULL, 0, 0 } };
-
-diff --git a/html/status.html b/html/status.html
-index c4c91c0..5ec0d29 100644
---- a/html/status.html
-+++ b/html/status.html
-@@ -2,6 +2,33 @@
-
-
-
-+
-
- Minisatip/$version$ on $http_host$
-
-@@ -49,37 +76,37 @@ var max_adapters = 16;
- var max_streams = 64;
- var pol = ["", "(V)", "(H)", "(R)", "(L)"]
- var sys= [ "", "dvbc", "dvbcb", "dvbt", "dss", "dvbs", "dvbs2", "dvbh", "isdbt", "isdbs", "isdbc", "atsc", "atscmh", "dmbth", "cmmb", "dab", "dvbt2", "turbo", "dvbcc", "dvbc2" ]
--var myTable= "Tuner | ";
-- myTable+= "Status | ";
-- myTable+="Frequency | ";
-- myTable+="SR/BW | ";
-- myTable+="Signal | ";
-- myTable+="Streams | ";
-- myTable+="Streams Pids |
";
-+var myTable= "";
-+ myTable+="";
-+ myTable+="";
-+ myTable+="";
-+ myTable+="";
-+ myTable+="";
-+ myTable+="
";
-
- for (var i=0; i" + i + " | ";
-+ myTable+="" + i + " | ";
- var csys = "";
- if(ad_sys[i] == 0)
- csys = ad_allsys[i];
- else
- csys = sys[ad_sys[i]];
- if(ad_enabled[i] == 1)
-- myTable+="" + csys;
-+ myTable+=" | " + csys;
- else
-- myTable+=" | " + ad_allsys[i];
-+ myTable+=" | " + ad_allsys[i];
- if(ad_type[i] == 1){
- myTable+="(" + ad_phyad[i] + "," + ad_phyfd[i] +") | ";
- }else{
- myTable+="(" + ad_satip[i] + ")";
- }
-- myTable+="" + ad_freq[i] + ""+pol[ad_pol[i]]+" | ";
-+ myTable+="" + ad_freq[i] + ""+pol[ad_pol[i]]+" | ";
- if(ad_sys[i] == 0 || ad_sys[i] == 1 || ad_sys[i] == 2 || ad_sys[i] == 5 || ad_sys[i] == 6 || ad_sys[i] == 18 || ad_sys[i] == 19 )
-- myTable+="" + ad_sr[i] + " | ";
-+ myTable+="" + ad_sr[i] + " | ";
- else
-- myTable+="" + ad_bw[i]/1000 + "MHZ | ";
-+ myTable+="" + ad_bw[i]/1000 + "MHZ | ";
-
- var signal = "";
- if(ad_enabled[i] == 0)
-@@ -97,9 +124,9 @@ var myTable= "Tuner<
- if(ad_ber[i] > 0)
- signal += " BER "+ad_ber[i];
- }
-- myTable+=" | " + signal + " | ";
-+ myTable+="" + signal + " | ";
-
-- myTable +="";
-+ myTable +=" | ";
- for(var j=0;j";
- }
-
-- myTable +=" | ";
-+ myTable +=" | ";
-
- for(var j=0;jIP servers in the network)\n \
- * eg: -D 4 \n\
-@@ -179,13 +213,23 @@ Help\n\
- * -m xx: simulate xx as local mac address, generates UUID based on mac\n\
- * eg: -m 001122334455 \n\
- \n\
-+"
-+#ifndef DISABLE_NETCVCLIENT
-+"\
- * -n --netceiver if:count: use network interface (default vlan4) and look for netceivers\n\
- * eg: -n vlan4:2 \n\
- \n\
-+"
-+#endif
-+#ifndef DISABLE_DVBCSA
-+"\
- * -o --dvbapi host:port - specify the hostname and port for the dvbapi server (oscam) \n\
- * eg: -o 192.168.9.9:9000 \n\
- 192.168.9.9 is the host where oscam is running and 9000 is the port configured in dvbapi section in oscam.conf\n\
- \n\
-+"
-+#endif
-+"\
- * -p url: specify playlist url using X_SATIPM3U header \n\
- * eg: -p http://192.168.2.3:8080/playlist\n\
- - this will add X_SATIPM3U tag into the satip description xml\n\
-@@ -195,6 +239,9 @@ Help\n\
- \n\
- * -R --document-root directory: document root for the minisatip web page and images\n\
- \n\
-+"
-+#ifndef DISABLE_SATIPCLIENT
-+"\
- * -s --satip-servers DELSYS:host:port - specify the remote satip host and port with delivery system DELSYS, it is possible to use multiple -s \n\
- * DELSYS - can be one of: dvbs, dvbs2, dvbt, dvbt2, dvbc, dvbc2, isdbt, atsc, dvbcb ( - DVBC_ANNEX_B ) [default: dvbs2]\n\
- host - the server of the satip server\n\
-@@ -204,6 +251,9 @@ Help\n\
- - specifies 1 dvbt satip server with address 192.168.1.3:554\n\
- - specifies 1 dvbc satip server with address 192.168.1.4:554\n\
- \n\
-+"
-+#endif
-+"\
- * -S --slave ADAPTER1,ADAPTER2-ADAPTER4[,..] - specify slave adapters \n\
- * Allows specifying bonded adapters (multiple adapters connected with a splitter to the same LNB)\n\
- Only one adapter needs to be master all others needs to have this parameter specified\n\
-@@ -237,7 +287,30 @@ Help\n\
+@@ -269,7 +287,30 @@ Help\n\
* eg: -y 5544 \n\
- changing this to a port > 1024 removes the requirement for minisatip to run as root\n\
\n\
@@ -1805,7 +908,7 @@ index d6b26d3..119a3ed 100644
app_name,
ADAPTER_BUFFER,
DVR_BUFFER, opts.no_threads ? "DISABLED" : "ENABLED");
-@@ -277,17 +350,24 @@ void set_options(int argc, char *argv[])
+@@ -309,7 +350,7 @@ void set_options(int argc, char *argv[])
opts.satip_setup_pids = 0;
opts.output_buffer = 512 * 1024;
opts.satip_servers[0] = 0;
@@ -1814,12 +917,7 @@ index d6b26d3..119a3ed 100644
opts.xml_path = DESC_XML;
opts.no_threads = 0;
opts.th_priority = -1;
-+ opts.diseqc_before_cmd = 15;
-+ opts.diseqc_after_cmd = 54;
-+ opts.diseqc_after_repeated_cmd = 15;
-+ opts.diseqc_after_switch = 15;
-+ opts.diseqc_after_burst = 15;
-+ opts.diseqc_after_tone = 0;
+@@ -323,10 +364,11 @@ void set_options(int argc, char *argv[])
#ifdef __mips__
opts.no_threads = 1;
#endif
@@ -1827,12 +925,12 @@ index d6b26d3..119a3ed 100644
memset(opts.playlist, 0, sizeof(opts.playlist));
while ((opt = getopt_long(argc, argv,
-- "flr:a:td:w:p:s:n:hc:b:m:p:e:x:u:j:o:gy:i:D:VR:S:TX:Y:",
+- "flr:a:td:w:p:s:n:hc:b:m:p:e:x:u:j:o:gy:i:q:D:VR:S:TX:Y:",
+ "flr:a:td:w:p:s:n:hc:b:m:p:e:x:u:j:o:gy:i:q:D:VR:S:TX:Y:L:QZ:U:M:P:",
long_options, NULL)) != -1)
{
// printf("options %d %c %s\n",opt,opt,optarg);
-@@ -359,9 +439,12 @@ void set_options(int argc, char *argv[])
+@@ -398,9 +440,12 @@ void set_options(int argc, char *argv[])
opts.adapter_buffer = (opts.adapter_buffer / 188) * 188;
if (opts.adapter_buffer < ADAPTER_BUFFER)
opts.adapter_buffer = ADAPTER_BUFFER;
@@ -1846,20 +944,7 @@ index d6b26d3..119a3ed 100644
break;
}
-@@ -410,6 +493,12 @@ void set_options(int argc, char *argv[])
- break;
- }
-
-+ case DISEQC_TIMING_OPT:
-+ {
-+ set_diseqc_timing(optarg);
-+ break;
-+ }
-+
- case SLAVE_OPT:
- {
- set_slave_adapters(optarg);
-@@ -508,6 +597,35 @@ void set_options(int argc, char *argv[])
+@@ -553,6 +598,35 @@ void set_options(int argc, char *argv[])
LOGL(0, "Not a valid path for the xml file")
;
break;
@@ -1895,15 +980,7 @@ index d6b26d3..119a3ed 100644
}
}
-@@ -676,7 +794,6 @@ int read_rtsp(sockets * s)
- if (transport)
- {
- int s_timeout;
--
- if (sid->timeout == 1)
- sid->timeout = opts.timeout_sec;
-
-@@ -1003,6 +1120,9 @@ int ssdp_reply(sockets * s)
+@@ -1048,6 +1122,9 @@ int ssdp_reply(sockets * s)
return 0;
}
@@ -1913,7 +990,7 @@ index d6b26d3..119a3ed 100644
// not my uuid
LOG("Received SSDP packet from %s:%d -> handle %d",
get_socket_rhost(s->id, ra, sizeof(ra)), get_socket_rport(s->id),
-@@ -1138,7 +1258,11 @@ int main(int argc, char *argv[])
+@@ -1183,7 +1260,11 @@ int main(int argc, char *argv[])
if (!opts.no_threads)
set_socket_thread(sock_signal, start_new_thread("signal"));
@@ -1928,27 +1005,19 @@ index d6b26d3..119a3ed 100644
diff --git a/minisatip.h b/minisatip.h
old mode 100644
new mode 100755
-index 403af34..f250422
+index 9c8e2fc..4e2a4fd
--- a/minisatip.h
+++ b/minisatip.h
-@@ -10,13 +10,15 @@
+@@ -10,7 +10,7 @@
- #define VERSION_BUILD "26"
+ #define VERSION_BUILD "27"
#define CC(a,b,c) #a b #c
-#define VERSION CC(0.5.,VERSION_BUILD,)
+#define VERSION CC(0.5.,VERSION_BUILD,-axe101)
void set_options (int argc, char *argv[]);
- extern char pid_file[];
- extern char app_name[], version[];
-
-+#define offsetof(st, m) __builtin_offsetof(st, m)
-+
- #define copy32(a,i,v) { a[i] = ((v)>>24) & 0xFF;\
- a[i+1] = ((v)>>16) & 0xFF;\
- a[i+2] = ((v)>>8) & 0xFF;\
-@@ -48,6 +50,11 @@ struct struct_opts
+@@ -50,6 +50,11 @@ struct struct_opts
int force_scan;
int clean_psi;
int file_line;
@@ -1960,73 +1029,11 @@ index 403af34..f250422
char *last_log;
int dvbapi_port;
char *dvbapi_host;
-@@ -62,6 +69,15 @@ struct struct_opts
- char *xml_path;
- char no_threads;
- int th_priority;
-+ int diseqc_fast;
-+ int diseqc_committed_no;
-+ int diseqc_uncommitted_no;
-+ int diseqc_before_cmd;
-+ int diseqc_after_cmd;
-+ int diseqc_after_repeated_cmd;
-+ int diseqc_after_switch;
-+ int diseqc_after_burst;
-+ int diseqc_after_tone;
- };
-
-
-diff --git a/netceiver.c b/netceiver.c
-index e42023e..51ef642 100644
---- a/netceiver.c
-+++ b/netceiver.c
-@@ -457,7 +457,7 @@ void find_netcv_adapter(adapter **a)
- if (na >= MAX_ADAPTERS)
- break;
- if (!a[na])
-- a[na] = malloc1(sizeof(adapter));
-+ a[na] = adapter_alloc();
- if (!sn[na])
- sn[na] = malloc1(sizeof(SNetceiver));
-
-diff --git a/satipc.c b/satipc.c
-index 4fd5972..af3e8aa 100644
---- a/satipc.c
-+++ b/satipc.c
-@@ -831,13 +831,16 @@ void find_satip_adapter(adapter **a)
- return;
- la = split(arg, opts.satip_servers, 50, ',');
- j = 0;
-+ for (i = 0; i < MAX_ADAPTERS; i++) {
-+
-+ }
- for (i = a_count; i < MAX_ADAPTERS; i++)
- if (j < la)
- {
- if (is_adapter_disabled(i))
- continue;
- if (!a[i])
-- a[i] = malloc1(sizeof(adapter));
-+ a[i] = adapter_alloc();
- if(!satip[i])
- satip[i] = malloc1(sizeof(satipc));
- sip = satip[i];
-@@ -913,8 +916,7 @@ void find_satip_adapter(adapter **a)
- }
-
-
--satipc *sip_tmp;
- _symbols satipc_sym[] ={
--{ "ad_satip", VAR_AARRAY_PSTRING, a, 1, MAX_ADAPTERS, (long int) &sip_tmp[0].sip
-- - (long int) &sip_tmp[0] }
-+{ "ad_satip", VAR_AARRAY_PSTRING, satip, 1, MAX_ADAPTERS, offsetof(satipc, sip) },
-+{ NULL, 0, NULL, 0, 0 }
- };
diff --git a/socketworks.c b/socketworks.c
-index 4c91a40..192182f 100644
+index 14974ec..77f4087 100644
--- a/socketworks.c
+++ b/socketworks.c
-@@ -431,6 +431,7 @@ int sockets_add(int sock, struct sockaddr_in *sa, int sid, int type,
+@@ -432,6 +432,7 @@ int sockets_add(int sock, struct sockaddr_in *sa, int sid, int type,
max_sock = i + 1;
ss->buf = NULL;
ss->lbuf = 0;
@@ -2034,7 +1041,7 @@ index 4c91a40..192182f 100644
ss->close_sec = 0;
ss->id = i;
ss->read = (read_action) sockets_read;
-@@ -624,6 +625,29 @@ void *select_and_execute(void *arg)
+@@ -625,6 +626,29 @@ void *select_and_execute(void *arg)
ss->rlen += rlen;
else
ss->rlen = 0;
@@ -2064,7 +1071,7 @@ index 4c91a40..192182f 100644
//force 0 at the end of the string
if (ss->lbuf >= ss->rlen)
ss->buf[ss->rlen] = 0;
-@@ -935,6 +959,14 @@ void set_socket_pos(int sock, int pos)
+@@ -936,6 +960,14 @@ void set_socket_pos(int sock, int pos)
ss->rlen = pos;
}
@@ -2101,41 +1108,6 @@ index c852e2a..aa4157c
char *get_socket_rhost(int s_id, char *dest, int ld);
int get_socket_rport(int s_id);
void set_sock_lock(int i, SMutex *m);
-diff --git a/stream.c b/stream.c
-index 03fee8a..8a45437 100644
---- a/stream.c
-+++ b/stream.c
-@@ -277,7 +277,7 @@ int start_play(streams * sid, sockets * s)
- "Tune requested with no real parameters, ignoring ...");
- }
- a_id = get_free_adapter(sid->tp.freq, sid->tp.pol, sid->tp.sys,
-- sid->tp.fe);
-+ sid->tp.fe, sid->tp.diseqc);
- LOG("Got adapter %d on socket %d", a_id, s->id);
- if (a_id < 0)
- return -404;
-@@ -1293,17 +1293,12 @@ char* get_stream_pids(int s_id, char *dest, int max_size)
- return dest;
- }
-
--streams *s_tmp;
- _symbols stream_sym[] =
- {
--{ "st_enabled", VAR_AARRAY_INT8, st, 1, MAX_STREAMS,
-- (long int) &s_tmp[0].enabled - (long int) &s_tmp[0] },
--{ "st_play", VAR_AARRAY_INT, st, 1, MAX_STREAMS, (long int) &s_tmp[0].do_play
-- - (long int) &s_tmp[0] },
--{ "st_adapter", VAR_AARRAY_INT, st, 1, MAX_STREAMS, (long int) &s_tmp[0].adapter
-- - (long int) &s_tmp[0] },
--{ "st_useragent", VAR_AARRAY_STRING, st, 1, MAX_STREAMS,
-- (long int) &s_tmp[0].useragent - (long int) &s_tmp[0] },
-+{ "st_enabled", VAR_AARRAY_INT8, st, 1, MAX_STREAMS, offsetof(streams, enabled) },
-+{ "st_play", VAR_AARRAY_INT, st, 1, MAX_STREAMS, offsetof(streams, do_play) },
-+{ "st_adapter", VAR_AARRAY_INT, st, 1, MAX_STREAMS, offsetof(streams, adapter) },
-+{ "st_useragent", VAR_AARRAY_STRING, st, 1, MAX_STREAMS, offsetof(streams, useragent) },
- { "st_rhost", VAR_FUNCTION_STRING, (void *) &get_stream_rhost, 0, 0, 0 },
- { "st_rport", VAR_FUNCTION_INT, (void *) &get_stream_rport, 0, 0, 0 },
- { "st_pids", VAR_FUNCTION_STRING, (void *) &get_stream_pids, 0, 0, 0 },
diff --git a/utils.c b/utils.c
index eaa0317..8cb7c49 100644
--- a/utils.c
|