minisatip/minisatip5: add -P (power), improve LNB standby logic

This commit is contained in:
Jaroslav Kysela 2016-02-23 21:05:47 +01:00
parent df0117dbbf
commit 55abb24cbc
2 changed files with 304 additions and 167 deletions

View File

@ -1,5 +1,5 @@
diff --git a/adapter.c b/adapter.c
index 285faea..97cb45d 100755
index 285faea..0b59730 100755
--- a/adapter.c
+++ b/adapter.c
@@ -29,10 +29,15 @@
@ -49,7 +49,7 @@ index 285faea..97cb45d 100755
}
for (na; na < MAX_ADAPTERS; na++)
a[na].pa = a[na].fn = -1;
@@ -122,9 +143,18 @@ init_hw ()
@@ -122,9 +143,23 @@ init_hw ()
find_adapters ();
LOG ("trying to open [%d] adapter %d and frontend %d", i, a[i].pa,
a[i].fn);
@ -57,10 +57,16 @@ index 285faea..97cb45d 100755
+ sprintf (buf, "/dev/axe/frontend-%d", a[i].pa);
+#else
sprintf (buf, "/dev/dvb/adapter%d/frontend%d", a[i].pa, a[i].fn);
- a[i].fe = open (buf, O_RDWR | O_NONBLOCK);
+ if (a[i].fe2 > 0)
+ a[i].fe = a[i].fe2;
+ else
+#endif
a[i].fe = open (buf, O_RDWR | O_NONBLOCK);
+ a[i].fe = a[i].fe2 = open (buf, O_RDWR | O_NONBLOCK);
+
+#ifdef AXE
+ a[i].fe2 = a[i].fe;
+ a[i].axe_feused = 0;
+ sprintf (buf, "/dev/axe/demuxts-%d", a[i].pa);
+#else
sprintf (buf, "/dev/dvb/adapter%d/dvr%d", a[i].pa, a[i].fn);
@ -68,7 +74,7 @@ index 285faea..97cb45d 100755
a[i].dvr = open (buf, O_RDONLY | O_NONBLOCK);
if (a[i].fe < 0 || a[i].dvr < 0)
{
@@ -139,22 +169,24 @@ init_hw ()
@@ -139,22 +174,24 @@ init_hw ()
a[i].enabled = 1;
if (!a[i].buf)
@ -96,7 +102,7 @@ index 285faea..97cb45d 100755
init_dvb_parameters (&a[i].tp);
mark_pids_deleted (i, -1, NULL);
update_pids (i);
@@ -165,8 +197,8 @@ init_hw ()
@@ -165,8 +202,8 @@ init_hw ()
a[i].sock =
sockets_add (a[i].dvr, NULL, i, TYPE_DVR, (socket_action) read_dmx,
(socket_action) close_adapter_for_socket, (socket_action ) adapter_timeout);
@ -107,34 +113,57 @@ index 285faea..97cb45d 100755
sockets_timeout (a[i].sock, 60000);
LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys);
@@ -194,6 +226,26 @@ close_adapter (int na)
@@ -179,7 +216,6 @@ init_hw ()
return num_adapters;
}
-
void
close_adapter (int na)
{
@@ -194,8 +230,41 @@ close_adapter (int na)
mark_pids_deleted (na, -1, NULL);
update_pids (na);
// if(a[na].dmx>0)close(a[na].dmx);
+#ifdef AXE
+ if (a[na].fe > 0) {
+ int i;
+ axe_fe_reset(a[na].fe);
+ for (i = 0; i < 4; i++)
+ if (i != na && a[i].sid_cnt > 0) break;
+ if (i >= 4) {
+ LOG("AXE standby");
+ for (i = 0; i < 4; i++) {
+ axe_fe_standby(a[i].fe, -1);
+ axe_set_tuner_led(i + 1, 0);
+ ioctl(a[i].fe, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF);
+ a[i].tp.old_diseqc = a[i].tp.old_pol = a[i].tp.old_hiband = -1;
+ int i, j;
+ a[na].fe = 0;
+ if (a[na].fe2 > 0)
+ axe_fe_reset(a[na].fe2);
+ for (i = j = 0; i < 4; i++) {
+ a[i].axe_used &= ~(1 << na);
+ if (a[i].axe_used || a[i].sid_cnt > 0) j++;
+ }
+ if (j > 0 && opts.axe_power > 1)
+ goto nostandby;
+ for (i = 0; i < 4; i++) {
+ if (a[i].axe_used != 0 || a[i].sid_cnt > 0) {
+ LOG("AXE standby: adapter %d busy (cnt=%d/used=%04x/fe=%d), keeping",
+ i, a[i].sid_cnt, a[i].axe_used, a[i].fe);
+ continue;
+ }
+ } else {
+ LOG("AXE standby: adapter %d busy (%d), keeping", i, a[i].sid_cnt);
+ if (a[i].fe2 <= 0 || a[i].axe_feused == 0)
+ continue;
+ LOG("AXE standby: adapter %d", i);
+ axe_fe_standby(a[i].fe2, -1);
+ axe_set_tuner_led(i + 1, 0);
+ ioctl(a[i].fe2, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF);
+ close(a[i].fe2);
+ a[i].fe2 = a[i].axe_feused = 0;
+ a[i].tp.old_diseqc = a[i].tp.old_pol = a[i].tp.old_hiband = -1;
+ }
+ }
+nostandby:
+ axe_set_tuner_led(na + 1, 0);
+#endif
+#else
if (a[na].fe > 0)
close (a[na].fe);
+#endif
if (a[na].sock >= 0)
@@ -366,8 +418,8 @@ close_adapter_for_stream (int sid, int aid)
sockets_del (a[na].sock);
a[na].fe = 0;
@@ -366,8 +435,8 @@ close_adapter_for_stream (int sid, int aid)
// delete the attached PIDs as well
mark_pids_deleted (aid, sid, NULL);
update_pids (aid);
@ -145,7 +174,7 @@ index 285faea..97cb45d 100755
}
@@ -410,7 +462,11 @@ update_pids (int aid)
@@ -410,7 +479,11 @@ update_pids (int aid)
int tune (int aid, int sid)
{
adapter *ad = get_adapter(aid);
@ -158,7 +187,7 @@ index 285faea..97cb45d 100755
if(!ad) return -400;
ad->last_sort = getTick ();
@@ -419,7 +475,13 @@ int tune (int aid, int sid)
@@ -419,7 +492,13 @@ int tune (int aid, int sid)
ad->tp.switch_type = ad->switch_type;
ad->tp.uslot = ad->uslot;
ad->tp.ufreq = ad->ufreq;
@ -173,7 +202,7 @@ index 285faea..97cb45d 100755
rv = tune_it_s2 (ad->fe, &ad->tp);
a[aid].status = 0;
a[aid].status_cnt = 0;
@@ -428,6 +490,12 @@ int tune (int aid, int sid)
@@ -428,6 +507,12 @@ int tune (int aid, int sid)
close_streams_for_adapter (aid, sid);
update_pids (aid);
}
@ -186,7 +215,7 @@ index 285faea..97cb45d 100755
}
else
LOG ("not tuning for SID %d (do_tune=%d, master_sid=%d)", sid,
@@ -684,7 +752,11 @@ describe_adapter (int sid, int aid)
@@ -684,7 +769,11 @@ describe_adapter (int sid, int aid)
memset (dad, 0, sizeof (dad));
x = 0;
// do just max 3 signal check 1s after tune
@ -198,7 +227,7 @@ index 285faea..97cb45d 100755
{
int new_gs = 1;
ts = getTick ();
@@ -701,11 +773,20 @@ describe_adapter (int sid, int aid)
@@ -701,11 +790,20 @@ describe_adapter (int sid, int aid)
if (ad->max_snr <= ad->snr) ad->max_snr = (ad->snr>0)?ad->snr:1;
LOG ("get_signal%s took %d ms for adapter %d handle %d (status: %d, ber: %d, strength:%d, snr: %d, max_strength: %d, max_snr: %d %d)",
new_gs?"":"_new", getTick () - ts, aid, ad->fe, ad->status, ad->ber, ad->strength, ad->snr, ad->max_strength, ad->max_snr, opts.force_scan);
@ -219,7 +248,7 @@ index 285faea..97cb45d 100755
}
if(use_ad)
{
@@ -715,14 +796,14 @@ describe_adapter (int sid, int aid)
@@ -715,14 +813,14 @@ describe_adapter (int sid, int aid)
}
if (t->sys == SYS_DVBS || t->sys == SYS_DVBS2)
sprintf (dad, "ver=1.0;src=%d;tuner=%d,%d,%d,%d,%d,%s,%s,%s,%s,%s,%d,%s;pids=",
@ -237,7 +266,7 @@ index 285faea..97cb45d 100755
t->c2tft, t->ds, t->plp, t->inversion);
for (i = 0; i < MAX_PIDS; i++)
if (use_ad && ad->pids[i].flags == 1)
@@ -825,7 +906,7 @@ void enable_adapters(char *o)
@@ -825,7 +923,7 @@ void enable_adapters(char *o)
void set_unicable_adapters(char *o, int type)
{
@ -246,7 +275,7 @@ index 285faea..97cb45d 100755
char buf[100], *arg[20], *sep1, *sep2;
strncpy(buf, o, sizeof(buf));
@@ -839,17 +920,67 @@ void set_unicable_adapters(char *o, int type)
@@ -839,17 +937,67 @@ void set_unicable_adapters(char *o, int type)
sep2 = strchr(arg[i], '-');
if( !sep1 || !sep2)
continue;
@ -315,7 +344,7 @@ index 285faea..97cb45d 100755
int delsys_match(adapter *ad, int del_sys)
{
@@ -866,3 +997,71 @@ int delsys_match(adapter *ad, int del_sys)
@@ -866,3 +1014,71 @@ int delsys_match(adapter *ad, int del_sys)
return 0;
}
@ -388,18 +417,29 @@ index 285faea..97cb45d 100755
+}
+#endif
diff --git a/adapter.h b/adapter.h
index 629bd9c..2b435fb 100755
index 629bd9c..45024a4 100755
--- a/adapter.h
+++ b/adapter.h
@@ -45,6 +45,7 @@ typedef struct struct_adapter
@@ -24,7 +24,7 @@ typedef struct struct_adapter
{
int enabled;
int force_disable;
- int fe, dvr;
+ int fe, fe2, dvr;
int pa, fn;
// physical adapter, physical frontend number
fe_delivery_system_t sys[10];
@@ -45,6 +45,9 @@ typedef struct struct_adapter
int switch_type;
int uslot; // unicable/jess slot
int ufreq; // unicable/jess frequency
+ int slave;
+ int axe_used;
+ int axe_feused;
} adapter;
int init_hw ();
@@ -65,7 +66,8 @@ void dump_pids (int aid);
@@ -65,7 +68,8 @@ void dump_pids (int aid);
void sort_pids (int aid);
void enable_adapters(char *o);
void set_unicable_adapters(char *o, int type);
@ -565,7 +605,7 @@ index 0000000..cfc1927
+
+#endif
diff --git a/dvb.c b/dvb.c
index 5701bd2..d143387 100755
index 5701bd2..6179588 100755
--- a/dvb.c
+++ b/dvb.c
@@ -41,6 +41,10 @@
@ -579,7 +619,7 @@ index 5701bd2..d143387 100755
extern struct struct_opts opts;
@@ -215,6 +219,29 @@ msleep (uint32_t msec)
@@ -215,6 +219,31 @@ msleep (uint32_t msec)
;
}
@ -588,6 +628,8 @@ index 5701bd2..d143387 100755
+{
+ int i;
+ adapter *a;
+ if (opts.axe_power < 2)
+ return;
+ for (i = 0; i < 4; i++) {
+ a = get_adapter(i);
+ if (a == NULL || a->force_disable)
@ -609,7 +651,7 @@ index 5701bd2..d143387 100755
int send_diseqc(int fd, int pos, int pol, int hiband)
{
struct dvb_diseqc_master_cmd cmd = {
@@ -229,6 +256,9 @@ int send_diseqc(int fd, int pos, int pol, int hiband)
@@ -229,6 +258,9 @@ int send_diseqc(int fd, int pos, int pol, int hiband)
if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno));
@ -619,7 +661,7 @@ index 5701bd2..d143387 100755
if (ioctl(fd, FE_SET_VOLTAGE, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) == -1)
LOG("send_diseqc: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
@@ -252,8 +282,12 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
@@ -252,8 +284,12 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
struct dvb_diseqc_master_cmd cmd = {
{0xe0, 0x11, 0x5a, 0x00, 0x00}, 5
};
@ -633,7 +675,7 @@ index 5701bd2..d143387 100755
t = (freq + ufreq + 2) / 4 - 350;
cmd.msg[3] = ((t & 0x0300) >> 8) |
@@ -262,12 +296,15 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
@@ -262,12 +298,15 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
LOGL(3, "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], cmd.msg[2], cmd.msg[3], cmd.msg[4]);
@ -650,7 +692,7 @@ index 5701bd2..d143387 100755
LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
msleep(15);
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
@@ -286,6 +323,7 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
@@ -286,6 +325,7 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
};
// int t = (freq / 1000) - 100;
int t = freq - 100;
@ -658,7 +700,7 @@ index 5701bd2..d143387 100755
cmd.msg[1] = slot << 3;
cmd.msg[1] |= ((t << 8) & 0x07);
@@ -295,12 +333,15 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
@@ -295,12 +335,15 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
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], cmd.msg[2], cmd.msg[3], cmd.msg[4]);
@ -675,7 +717,7 @@ index 5701bd2..d143387 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 +361,7 @@ int setup_switch (int frontend_fd, transponder *tp)
@@ -320,7 +363,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;
@ -684,7 +726,7 @@ index 5701bd2..d143387 100755
if (freq < SLOF)
{
freq = (freq - LOF1);
@@ -330,12 +371,108 @@ int setup_switch (int frontend_fd, transponder *tp)
@@ -330,12 +373,111 @@ int setup_switch (int frontend_fd, transponder *tp)
hiband = 1;
}
@ -692,17 +734,18 @@ index 5701bd2..d143387 100755
+ adapter *ad, *ad2, *adm;
+ int input = 0, aid;
+
+ for (aid = 0; aid < 4; aid++) {
+ ad = get_adapter(aid);
+ LOGL(3, "axe adapter %i fe fd %d", aid, ad->fe);
+ if (ad && ad->fe == frontend_fd)
+ break;
+ }
+ if (aid >= 4) {
+ LOG("axe_fe: unknown adapter for fd %d", frontend_fd);
+ return 0;
+ }
+ ad->axe_feused = 1;
+ if (tp->switch_type != SWITCH_UNICABLE && tp->switch_type != SWITCH_JESS) {
+ for (aid = 0; aid < 4; aid++) {
+ ad = get_adapter(aid);
+ LOGL(3, "axe adapter %i fe fd %d", aid, ad->fe);
+ if (ad && ad->fe == frontend_fd)
+ break;
+ }
+ if (aid >= 4) {
+ LOG("axe_fe: unknown adapter for fd %d", frontend_fd);
+ return 0;
+ }
+ input = aid;
+ if (ad && !opts.quattro) {
+ adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa);
@ -724,20 +767,17 @@ index 5701bd2..d143387 100755
+ adm->tp.old_diseqc != diseqc))
+ return 0;
+ }
+ adm->axe_used |= (1 << aid);
+ adm->axe_feused = 1;
+ if (ad->slave) {
+ input = ad->slave - 1;
+ adm = get_adapter(input);
+ if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input);
+ return 0;
+ }
+ if(adm->tp.old_pol != pol ||
+ adm->tp.old_hiband != hiband ||
+ adm->tp.old_diseqc != diseqc) {
+ send_diseqc(adm->fe, diseqc, pol, hiband);
+ adm->tp.old_pol = pol;
+ adm->tp.old_hiband = hiband;
+ adm->tp.old_diseqc = diseqc;
+ adm->tp.old_pol = tp->old_pol = pol;
+ adm->tp.old_hiband = tp->old_hiband = hiband;
+ adm->tp.old_diseqc = tp->old_diseqc = diseqc;
+ }
+ goto axe;
+ }
@ -763,6 +803,9 @@ index 5701bd2..d143387 100755
+ adm->tp.old_hiband = hiband;
+ adm->tp.old_diseqc = 0;
+ }
+ adm->axe_used |= (1 << aid);
+ adm->axe_feused = 1;
+ goto axe;
+ }
+ } else {
+ input = opts.axe_unicinp[input & 3];
@ -771,6 +814,8 @@ index 5701bd2..d143387 100755
+ LOGL(3, "axe setup: unable to find adapter %d", input);
+ return 0;
+ }
+ ad->axe_used |= (1 << aid);
+ ad->axe_feused = 1;
+ }
+#endif
+
@ -793,7 +838,7 @@ index 5701bd2..d143387 100755
}else
{
if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc)
@@ -343,6 +480,16 @@ int setup_switch (int frontend_fd, transponder *tp)
@@ -343,6 +485,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);
}
@ -810,7 +855,7 @@ index 5701bd2..d143387 100755
tp->old_pol = pol;
tp->old_hiband = hiband;
@@ -383,8 +530,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -383,8 +535,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},
@ -821,7 +866,7 @@ index 5701bd2..d143387 100755
{.cmd = DTV_TUNE},
};
static struct dtv_properties dvbs2_cmdseq =
@@ -462,11 +611,15 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -462,11 +616,15 @@ tune_it_s2 (int fd_frontend, transponder * tp)
tp->mtype = QPSK;
bpol = getTick();
if_freq = setup_switch (fd_frontend, tp);
@ -837,7 +882,7 @@ index 5701bd2..d143387 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 +628,12 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -475,7 +633,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],
@ -851,7 +896,7 @@ index 5701bd2..d143387 100755
break;
@@ -560,6 +718,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -560,6 +723,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
char buf[100];
int fd;
@ -872,7 +917,7 @@ index 5701bd2..d143387 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 +757,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -585,6 +762,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
}
LOG ("setting filter on PID %d for fd %d", i_pid, fd);
@ -880,7 +925,7 @@ index 5701bd2..d143387 100755
return fd;
}
@@ -592,6 +765,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -592,6 +770,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
int del_filters (int fd, int pid)
{
@ -898,7 +943,7 @@ index 5701bd2..d143387 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 +783,7 @@ int del_filters (int fd, int pid)
@@ -599,6 +788,7 @@ int del_filters (int fd, int pid)
else
LOG ("clearing filters on PID %d FD %d", pid, fd);
close (fd);
@ -906,7 +951,7 @@ index 5701bd2..d143387 100755
return 0;
}
@@ -606,6 +791,15 @@ int del_filters (int fd, int pid)
@@ -606,6 +796,15 @@ int del_filters (int fd, int pid)
fe_delivery_system_t
dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
{
@ -922,7 +967,7 @@ index 5701bd2..d143387 100755
int i, res, rv = 0;
struct dvb_frontend_info fe_info;
@@ -703,6 +897,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
@@ -703,6 +902,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;
@ -931,7 +976,7 @@ index 5701bd2..d143387 100755
}
diff --git a/minisatip.c b/minisatip.c
index d4076ba..fcf5a5c 100755
index d4076ba..9486fae 100755
--- a/minisatip.c
+++ b/minisatip.c
@@ -36,6 +36,7 @@
@ -942,7 +987,7 @@ index d4076ba..fcf5a5c 100755
#include "socketworks.h"
#include "stream.h"
#include "adapter.h"
@@ -62,10 +63,17 @@ usage ()
@@ -62,10 +63,18 @@ usage ()
-c X: bandwidth capping for the output to the network (default: unlimited)\n\
-b X: set the DVR buffer to X KB (default: %dKB)\n\
-l increases the verbosity (you can use multiple -l), logging to stdout in foreground mode or in /tmp/log when a daemon\n\
@ -957,10 +1002,11 @@ index d4076ba..fcf5a5c 100755
+ -Z X: enable loband (0) or hiband (1) only for quattro LNB\n\
+ -X X[,Y]: AXE unicable/jess input (0-3) for all tuners\n\
+ -M X: skip initial MPEG-TS packets for AXE demuxer (default 35)\n\
+ -P X: power to all inputs (0 = only active inputs, 1 = all inputs)\n\
",
DVR_BUFFER / 1024);
exit (1);
@@ -97,11 +105,12 @@ set_options (int argc, char *argv[])
@@ -97,11 +106,12 @@ set_options (int argc, char *argv[])
opts.device_id = 0;
opts.bootid = 0;
opts.force_scan = 0;
@ -971,11 +1017,11 @@ index d4076ba..fcf5a5c 100755
memset(opts.playlist, sizeof(opts.playlist), 0);
- while ((opt = getopt (argc, argv, "flr:a:t:d:w:p:shc:b:m:p:e:x:u:j:")) != -1)
+ while ((opt = getopt (argc, argv, "flr:a:t:d:w:p:shc:b:m:p:e:x:u:j:gL:QZ:X:S:")) != -1)
+ while ((opt = getopt (argc, argv, "flr:a:t:d:w:p:shc:b:m:p:e:x:u:j:gL:QZ:X:S:P:")) != -1)
{
// printf("options %d %c %s\n",opt,opt,optarg);
switch (opt)
@@ -143,6 +152,12 @@ set_options (int argc, char *argv[])
@@ -143,6 +153,12 @@ set_options (int argc, char *argv[])
break;
}
@ -988,7 +1034,7 @@ index d4076ba..fcf5a5c 100755
case HELP_OPT:
{
usage ();
@@ -164,6 +179,10 @@ set_options (int argc, char *argv[])
@@ -164,6 +180,10 @@ set_options (int argc, char *argv[])
case DVRBUFFER_OPT:
{
opts.dvr = atoi (optarg) * 1024;
@ -999,7 +1045,7 @@ index d4076ba..fcf5a5c 100755
break;
}
@@ -209,6 +228,39 @@ set_options (int argc, char *argv[])
@@ -209,6 +229,45 @@ set_options (int argc, char *argv[])
break;
}
@ -1021,6 +1067,12 @@ index d4076ba..fcf5a5c 100755
+ break;
+ }
+
+ case AXE_POWER:
+ {
+ opts.axe_power = atoi(optarg) + 1;
+ break;
+ }
+
+ case AXE_UNICINP_OPT:
+ {
+ set_unicable_input(optarg);
@ -1039,7 +1091,7 @@ index d4076ba..fcf5a5c 100755
}
}
@@ -483,6 +535,11 @@ http_response (sockets *s, int rc, char *ah, char *desc, int cseq, int lr)
@@ -483,6 +542,11 @@ http_response (sockets *s, int rc, char *ah, char *desc, int cseq, int lr)
#define RBUF 4000
@ -1051,7 +1103,7 @@ index d4076ba..fcf5a5c 100755
int
read_rtsp (sockets * s)
{
@@ -507,8 +564,7 @@ read_rtsp (sockets * s)
@@ -507,8 +571,7 @@ read_rtsp (sockets * s)
}
}
@ -1061,7 +1113,7 @@ index d4076ba..fcf5a5c 100755
{
if( s->rlen > RBUF - 10 )
{
@@ -524,6 +580,9 @@ read_rtsp (sockets * s)
@@ -524,6 +587,9 @@ read_rtsp (sockets * s)
return 0;
}
@ -1071,7 +1123,7 @@ index d4076ba..fcf5a5c 100755
rlen = s->rlen;
s->rlen = 0;
@@ -726,8 +785,7 @@ read_http (sockets * s)
@@ -726,8 +792,7 @@ read_http (sockets * s)
"%s"
"</device></root>";
@ -1081,7 +1133,7 @@ index d4076ba..fcf5a5c 100755
{
if( s->rlen > RBUF - 10 )
{
@@ -749,6 +807,9 @@ read_http (sockets * s)
@@ -749,6 +814,9 @@ read_http (sockets * s)
return 0;
}
@ -1091,7 +1143,7 @@ index d4076ba..fcf5a5c 100755
rlen = s->rlen;
s->rlen = 0;
@@ -781,6 +842,15 @@ read_http (sockets * s)
@@ -781,6 +849,15 @@ read_http (sockets * s)
return 0;
}
@ -1107,7 +1159,7 @@ index d4076ba..fcf5a5c 100755
if (strncmp (arg[1], "/icons/", 7) == 0)
{
char *ctype = NULL;
@@ -904,6 +974,9 @@ ssdp_reply (sockets * s)
@@ -904,6 +981,9 @@ ssdp_reply (sockets * s)
return 0;
}
@ -1117,7 +1169,7 @@ index d4076ba..fcf5a5c 100755
// not my uuid
LOG("Received SSDP packet from %s:%d -> handle %d", inet_ntoa(s->sa.sin_addr), ntohs(s->sa.sin_port), s->sock);
LOGL(3, "%s", s->buf);
@@ -987,7 +1060,13 @@ main (int argc, char *argv[])
@@ -987,7 +1067,13 @@ main (int argc, char *argv[])
set_options (argc, argv);
if (opts.daemon)
becomeDaemon ();
@ -1131,7 +1183,7 @@ index d4076ba..fcf5a5c 100755
readBootID();
if ((ssdp = udp_bind (NULL, 1900)) < 1)
FAIL ("SSDP: Could not bind on udp port 1900");
@@ -1021,7 +1100,9 @@ main (int argc, char *argv[])
@@ -1021,7 +1107,9 @@ main (int argc, char *argv[])
select_and_execute ();
unlink(PID_FILE);
free_all ();
@ -1142,7 +1194,7 @@ index d4076ba..fcf5a5c 100755
}
@@ -1247,12 +1328,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
@@ -1247,12 +1335,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
idx = 1;
else if ( idx < 0)
idx = 0;
@ -1162,7 +1214,7 @@ index d4076ba..fcf5a5c 100755
both = 0;
va_start(arg, fmt);
len += vsnprintf(output[idx] + len, sizeof(output[0]) - len, fmt, arg);
@@ -1271,9 +1356,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
@@ -1271,9 +1363,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
}
if(both){
@ -1175,7 +1227,7 @@ index d4076ba..fcf5a5c 100755
fflush(stdout);
}
diff --git a/minisatip.h b/minisatip.h
index 821e756..485be5d 100755
index 821e756..2794f49 100755
--- a/minisatip.h
+++ b/minisatip.h
@@ -9,7 +9,7 @@
@ -1187,7 +1239,7 @@ index 821e756..485be5d 100755
void set_options (int argc, char *argv[]);
@@ -30,6 +30,12 @@ void set_options (int argc, char *argv[]);
@@ -30,6 +30,13 @@ void set_options (int argc, char *argv[]);
#define ENABLE_ADAPTERS_OPT 'e'
#define UNICABLE_OPT 'u'
#define JESS_OPT 'j'
@ -1197,10 +1249,11 @@ index 821e756..485be5d 100755
+#define QUATTRO_HIBAND_OPT 'Z'
+#define AXE_UNICINP_OPT 'X'
+#define AXE_SKIP_PKT 'M'
+#define AXE_POWER 'P'
#define PID_FILE "/var/run/minisatip.pid"
struct struct_opts
@@ -39,6 +45,7 @@ struct struct_opts
@@ -39,6 +46,7 @@ struct struct_opts
char *disc_host; //discover host
char mac[13];
unsigned int log,
@ -1208,7 +1261,7 @@ index 821e756..485be5d 100755
start_rtp,
http_port;
int timeout_sec;
@@ -50,6 +57,10 @@ struct struct_opts
@@ -50,6 +58,11 @@ struct struct_opts
int dvr;
int force_scan;
int file_line;
@ -1216,11 +1269,12 @@ index 821e756..485be5d 100755
+ int quattro_hiband;
+ int axe_unicinp[4];
+ int axe_skippkt;
+ int axe_power;
char *last_log;
char playlist[200];
};
diff --git a/socketworks.c b/socketworks.c
index b4891f1..995d84b 100755
index b4891f1..1a275b7 100755
--- a/socketworks.c
+++ b/socketworks.c
@@ -299,6 +299,7 @@ socket_action a, socket_action c, socket_action t)
@ -1262,7 +1316,7 @@ index b4891f1..995d84b 100755
+ }
+ if (rlen == 0 || (rlen < 0 || errno == -EAGAIN))
+ rlen = 1;
+ if (ss->skiplen > 0) {
+ if (ss->skiplen > 0 && ss->rlen > 0) {
+ LOG("AXE skip: before rlen %d skiplen %d", ss->rlen, ss->skiplen);
+ if (ss->skiplen >= ss->rlen) {
+ ss->skiplen -= ss->rlen;

View File

@ -447,7 +447,7 @@ index 033490a..d5ae166 100644
{ "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..10b9b93 100644
index e693479..0a0c87e 100644
--- a/adapter.h
+++ b/adapter.h
@@ -6,7 +6,11 @@
@ -462,7 +462,16 @@ index e693479..10b9b93 100644
#ifdef NO_BACKTRACE
#define MAX_STREAMS_PER_PID 8
#else
@@ -83,12 +87,11 @@ typedef struct struct_adapter
@@ -63,7 +67,7 @@ typedef struct struct_adapter
char enabled;
SMutex mutex;
char type; // available on the system
- int fe, dvr;
+ int fe, fe2, dvr;
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;
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
@ -473,6 +482,8 @@ index e693479..10b9b93 100644
- int only13v; // unicable - use 13V voltage only
- int committed_no, uncommitted_no; // diseqc info
+ int slave;
+ int axe_used;
+ int axe_feused;
+ diseqc diseqc_param;
+ int old_diseqc;
+ int old_hiband;
@ -480,7 +491,7 @@ index e693479..10b9b93 100644
int id;
int pat_processed, transponder_id, pat_ver;
char name[5];
@@ -109,8 +112,9 @@ extern int a_count;
@@ -109,8 +114,9 @@ extern int a_count;
int init_hw(int dev);
int init_all_hw();
int getAdaptersCount();
@ -491,7 +502,7 @@ index e693479..10b9b93 100644
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 +132,10 @@ void sort_pids(int aid);
@@ -128,7 +134,10 @@ void sort_pids(int aid);
void enable_adapters(char *o);
void set_unicable_adapters(char *o, int type);
void set_diseqc_adapters(char *o);
@ -658,7 +669,7 @@ index 0000000..d8b06bc
+
+#endif
diff --git a/dvb.c b/dvb.c
index 259b93d..3d6ef66 100644
index 259b93d..fcad626 100644
--- a/dvb.c
+++ b/dvb.c
@@ -42,6 +42,11 @@
@ -681,22 +692,24 @@ index 259b93d..3d6ef66 100644
}
void copy_dvb_parameters(transponder * s, transponder * d)
@@ -330,13 +334,25 @@ int dvb_open_device(adapter *ad)
@@ -330,50 +334,99 @@ 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);
+#ifdef AXE
+ sprintf(buf, "/dev/axe/frontend-%d", ad->pa);
+ if (ad->fe2 > 0)
+ ad->fe = ad->fe2;
+ else
+ ad->fe = ad->fe2 = open(buf, O_RDWR | O_NONBLOCK);
+ sprintf(buf, "/dev/axe/demuxts-%d", ad->pa);
+ ad->dvr = open(buf, O_RDONLY | O_NONBLOCK);
+#else
sprintf(buf, "/dev/dvb/adapter%d/frontend%d", ad->pa, ad->fn);
+#endif
ad->fe = open(buf, O_RDWR | O_NONBLOCK);
+#ifdef AXE
+ sprintf(buf, "/dev/axe/demuxts-%d", ad->pa);
+#else
sprintf(buf, "/dev/dvb/adapter%d/dvr%d", ad->pa, ad->fn);
+#endif
ad->dvr = open(buf, O_RDONLY | O_NONBLOCK);
+#endif
if (ad->fe < 0 || ad->dvr < 0)
{
+#ifdef AXE
@ -707,7 +720,13 @@ index 259b93d..3d6ef66 100644
LOGL(0, "Could not open %s in RW mode (fe: %d, dvr: %d)", buf, ad->fe,
ad->dvr);
if (ad->fe >= 0)
@@ -349,31 +365,41 @@ int dvb_open_device(adapter *ad)
close(ad->fe);
if (ad->dvr >= 0)
close(ad->dvr);
- ad->fe = ad->dvr = -1;
+ ad->fe = ad->fe2 = ad->dvr = -1;
return 1;
}
ad->type = ADAPTER_DVB;
LOG("opened DVB adapter %d fe:%d dvr:%d", ad->id, ad->fe, ad->dvr);
@ -747,14 +766,49 @@ index 259b93d..3d6ef66 100644
-int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
- int uncommitted_no)
+int send_diseqc(int fd, int pos, int pos_change, int pol, int hiband, diseqc *d)
+#ifdef AXE
+void axe_wakeup(int voltage)
{
+ int i;
+ adapter *a;
+ if (opts.axe_power < 2)
+ return;
+ for (i = 0; i < 4; i++) {
+ a = get_adapter(i);
+ if (a == NULL || is_adapter_disabled(i))
+ continue;
+ if (a->old_pol >= 0)
+ return;
+ }
+ LOG("AXE wakeup");
+ for (i = 0; i < 4; i++) {
+ a = get_adapter(i);
+ if (a == NULL || is_adapter_disabled(i))
+ continue;
+ if (ioctl(a->fe, FE_SET_VOLTAGE, voltage) == -1)
+ LOG("axe_wakeup: FE_SET_VOLTAGE failed fd %d: %s", a->fe, strerror(errno));
+ }
+}
+#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 */
@@ -412,77 +438,83 @@ int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
@@ -405,6 +458,9 @@ int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no,
LOGL(3, "send_diseqc fd %d, pos = %d (c %d u %d), pol = %d, hiband = %d",
fd, pos, posc, posu, pol, hiband);
+#ifdef AXE
+ axe_wakeup(pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13);
+#endif
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));
@ -829,6 +883,9 @@ index 259b93d..3d6ef66 100644
- 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],
cmd.msg[2], cmd.msg[3], cmd.msg[4]);
+#ifdef AXE
+ axe_wakeup(SEC_VOLTAGE_13);
+#endif
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));
@ -863,7 +920,7 @@ index 259b93d..3d6ef66 100644
{
struct dvb_diseqc_master_cmd cmd =
{
@@ -490,44 +522,45 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot,
@@ -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;
@ -887,6 +944,9 @@ index 259b93d..3d6ef66 100644
+ 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);
+#endif
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));
@ -919,7 +979,7 @@ index 259b93d..3d6ef66 100644
{
int hiband = 0;
int diseqc = (tp->diseqc > 0) ? tp->diseqc - 1 : 0;
@@ -550,35 +583,137 @@ int setup_switch(int frontend_fd, transponder *tp)
@@ -550,35 +619,140 @@ int setup_switch(int frontend_fd, transponder *tp)
hiband = 1;
}
@ -928,6 +988,7 @@ index 259b93d..3d6ef66 100644
+ adapter *ad2, *adm;
+ int input = 0, aid;
+
+ ad->axe_feused = 1;
+ if (tp->diseqc_param.switch_type != SWITCH_UNICABLE &&
+ tp->diseqc_param.switch_type != SWITCH_JESS) {
+ input = ad->id;
@ -951,13 +1012,10 @@ index 259b93d..3d6ef66 100644
+ adm->old_diseqc != diseqc))
+ return 0;
+ }
+ adm->axe_used |= (1 << aid);
+ adm->axe_feused = 1;
+ if (ad->slave) {
+ input = ad->slave - 1;
+ adm = get_adapter(input);
+ if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input);
+ return 0;
+ }
+ if(adm->old_pol != pol ||
+ adm->old_hiband != hiband ||
+ adm->old_diseqc != diseqc) {
@ -991,6 +1049,9 @@ index 259b93d..3d6ef66 100644
+ adm->old_hiband = hiband;
+ adm->old_diseqc = diseqc = 0;
+ }
+ adm->axe_used |= (1 << aid);
+ adm->axe_feused = 1;
+ goto axe;
+ }
+ } else {
+ input = opts.axe_unicinp[ad->id & 3];
@ -999,6 +1060,8 @@ index 259b93d..3d6ef66 100644
+ LOGL(3, "axe setup: unable to find adapter %d", input);
+ return 0;
+ }
+ ad->axe_used |= (1 << aid);
+ ad->axe_feused = 1;
+ }
+#endif
+
@ -1073,7 +1136,7 @@ index 259b93d..3d6ef66 100644
return freq;
}
@@ -611,6 +746,14 @@ int dvb_tune(int aid, transponder * tp)
@@ -611,6 +785,14 @@ int dvb_tune(int aid, transponder * tp)
memset(p_cmd, 0, sizeof(p_cmd));
bclear = getTick();
@ -1088,7 +1151,7 @@ index 259b93d..3d6ef66 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 +767,16 @@ int dvb_tune(int aid, transponder * tp)
@@ -624,14 +806,16 @@ int dvb_tune(int aid, transponder * tp)
case SYS_DVBS2:
bpol = getTick();
@ -1106,7 +1169,7 @@ index 259b93d..3d6ef66 100644
#if DVBAPIVERSION >= 0x0502
ADD_PROP(DTV_STREAM_ID, tp->plp)
#endif
@@ -640,7 +785,12 @@ int dvb_tune(int aid, transponder * tp)
@@ -640,7 +824,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],
@ -1120,7 +1183,7 @@ index 259b93d..3d6ef66 100644
break;
case SYS_DVBT:
@@ -741,29 +891,46 @@ int dvb_tune(int aid, transponder * tp)
@@ -741,29 +930,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));
@ -1172,7 +1235,7 @@ index 259b93d..3d6ef66 100644
return -1;
}
@@ -789,10 +956,22 @@ int dvb_set_pid(adapter *a, uint16_t i_pid)
@@ -789,10 +995,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;
@ -1195,7 +1258,7 @@ index 259b93d..3d6ef66 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 +980,20 @@ int dvb_del_filters(int fd, int pid)
@@ -801,10 +1019,20 @@ int dvb_del_filters(int fd, int pid)
LOG("clearing filter on PID %d FD %d", pid, fd);
close(fd);
return 0;
@ -1216,7 +1279,7 @@ index 259b93d..3d6ef66 100644
int i, res, rv = 0;
struct dvb_frontend_info fe_info;
@@ -893,6 +1082,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys)
@@ -893,6 +1121,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;
@ -1224,7 +1287,7 @@ index 259b93d..3d6ef66 100644
}
@@ -1005,6 +1195,7 @@ void dvb_get_signal(adapter *ad)
@@ -1005,6 +1234,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;
@ -1232,7 +1295,7 @@ index 259b93d..3d6ef66 100644
if (ad->snr > 4096)
new_gs = 0;
if (new_gs)
@@ -1017,6 +1208,14 @@ void dvb_get_signal(adapter *ad)
@@ -1017,6 +1247,14 @@ void dvb_get_signal(adapter *ad)
ad->strength = ad->strength >> 8;
ad->snr = ad->snr >> 8;
}
@ -1247,7 +1310,7 @@ index 259b93d..3d6ef66 100644
}
void dvb_commit(adapter *a)
@@ -1024,6 +1223,33 @@ void dvb_commit(adapter *a)
@@ -1024,6 +1262,47 @@ void dvb_commit(adapter *a)
return;
}
@ -1255,24 +1318,38 @@ index 259b93d..3d6ef66 100644
+{
+#ifdef AXE
+ adapter *c;
+ int aid, fe = a2->fe;
+ if (fe <= 0)
+ int aid, busy;
+ if (a2->fe <= 0)
+ return;
+ axe_fe_reset(fe);
+ for (aid = 0; aid < 4; aid++)
+ if (aid != a2->id && a[aid]->sid_cnt > 0) break;
+ if (aid >= 4) {
+ LOG("AXE standby");
+ for (aid = 0; aid < 4; aid++) {
+ c = a[aid];
+ axe_fe_standby(c->fe, -1);
+ axe_set_tuner_led(aid + 1, 0);
+ ioctl(c->fe, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF);
+ c->old_diseqc = c->old_pol = c->old_hiband = -1;
+ }
+ } else {
+ LOG("AXE standby: adapter %d busy (%d), keeping", aid, a[aid]->sid_cnt);
+ a2->fe = -1;
+ if (a2->fe2 > 0)
+ axe_fe_reset(a2->fe2);
+ for (aid = busy = 0; aid < 4; aid++) {
+ c = a[aid];
+ c->axe_used &= ~(1 << aid);
+ if (c->axe_used || c->sid_cnt > 0) busy++;
+ }
+ if (busy > 0 && opts.axe_power > 1)
+ goto nostandby;
+ for (aid = 0; aid < 4; aid++) {
+ c = a[aid];
+ if (c->axe_used != 0 || c->sid_cnt > 0) {
+ LOG("AXE standby: adapter %d busy (cnt=%d/used=%04x/fe=%d), keeping",
+ aid, c->sid_cnt, c->axe_used, c->fe);
+ continue;
+ }
+ if (c->fe2 < 0 || c->axe_feused == 0)
+ continue;
+ LOG("AXE standby: adapter %d", aid);
+ axe_fe_standby(c->fe2, -1);
+ axe_set_tuner_led(aid + 1, 0);
+ ioctl(c->fe2, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF);
+ close(c->fe2);
+ c->fe2 = -1;
+ c->axe_feused = 0;
+ c->old_diseqc = c->old_pol = c->old_hiband = -1;
+ }
+nostandby:
+ axe_set_tuner_led(a2->id + 1, 0);
+#endif
+ return 0;
@ -1281,7 +1358,7 @@ index 259b93d..3d6ef66 100644
void find_dvb_adapter(adapter **a)
{
int na = 0;
@@ -1032,9 +1258,21 @@ void find_dvb_adapter(adapter **a)
@@ -1032,9 +1311,21 @@ void find_dvb_adapter(adapter **a)
int i = 0, j = 0;
adapter *ad;
@ -1303,7 +1380,7 @@ index 259b93d..3d6ef66 100644
sprintf(buf, "/dev/dvb/adapter%d/frontend%d", i, j);
fd = open(buf, O_RDONLY | O_NONBLOCK);
if (fd < 0)
@@ -1042,7 +1280,8 @@ void find_dvb_adapter(adapter **a)
@@ -1042,7 +1333,8 @@ void find_dvb_adapter(adapter **a)
sprintf(buf, "/dev/dvb/adapter%d/ca%d", i, j);
fd = open(buf, O_RDONLY | O_NONBLOCK);
}
@ -1313,7 +1390,7 @@ index 259b93d..3d6ef66 100644
if (fd >= 0)
{
// if (is_adapter_disabled(na))
@@ -1051,7 +1290,7 @@ void find_dvb_adapter(adapter **a)
@@ -1051,7 +1343,7 @@ void find_dvb_adapter(adapter **a)
// continue;
// }
if (!a[na])
@ -1322,7 +1399,7 @@ index 259b93d..3d6ef66 100644
ad = a[na];
ad->pa = i;
@@ -1064,7 +1303,7 @@ void find_dvb_adapter(adapter **a)
@@ -1064,7 +1356,7 @@ void find_dvb_adapter(adapter **a)
ad->tune = (Tune) dvb_tune;
ad->delsys = (Dvb_delsys) dvb_delsys;
ad->post_init = NULL;
@ -1331,7 +1408,7 @@ index 259b93d..3d6ef66 100644
ad->get_signal = (Device_signal) dvb_get_signal;
ad->type = ADAPTER_DVB;
close(fd);
@@ -1073,6 +1312,14 @@ void find_dvb_adapter(adapter **a)
@@ -1073,6 +1365,14 @@ void find_dvb_adapter(adapter **a)
if (na == MAX_ADAPTERS)
return;
}
@ -1549,7 +1626,7 @@ index c4c91c0..5ec0d29 100644
for(var j=0;j<max_streams;j++)
if(st_enabled[j]==1 && st_adapter[j]==i)
diff --git a/minisatip.c b/minisatip.c
index d6b26d3..7eb4ded 100644
index d6b26d3..119a3ed 100644
--- a/minisatip.c
+++ b/minisatip.c
@@ -66,6 +66,7 @@ static const struct option long_options[] =
@ -1582,7 +1659,7 @@ index d6b26d3..7eb4ded 100644
#define SLAVE_OPT 'S'
#define DELSYS_OPT 'Y'
#define DVBAPI_OPT 'o'
@@ -117,12 +126,21 @@ static const struct option long_options[] =
@@ -117,12 +126,22 @@ static const struct option long_options[] =
#define DOCUMENTROOT_OPT 'R'
#define XML_OPT 'X'
#define THREADS_OPT 'T'
@ -1591,6 +1668,7 @@ index d6b26d3..7eb4ded 100644
+#define QUATTRO_HIBAND_OPT 'Z'
+#define AXE_UNICINP_OPT 'U'
+#define AXE_SKIP_PKT 'M'
+#define AXE_POWER 'P'
+
void print_version(int use_log)
@ -1606,7 +1684,7 @@ index d6b26d3..7eb4ded 100644
if (!use_log)
puts(buf);
else
@@ -133,10 +151,19 @@ void usage()
@@ -133,10 +152,19 @@ void usage()
{
print_version(0);
printf(
@ -1630,7 +1708,7 @@ index d6b26d3..7eb4ded 100644
Help\n\
-------\n\
\n\
@@ -150,10 +177,16 @@ Help\n\
@@ -150,10 +178,16 @@ Help\n\
* -c X: bandwidth capping for the output to the network [default: unlimited]\n\
* eg: -c 2048 (does not allow minisatip to send more than 2048KB/s to all remote servers)\n\
\n\
@ -1651,7 +1729,7 @@ index d6b26d3..7eb4ded 100644
\n\
* -D --device-id DVC_ID: specify the device id (in case there are multiple SAT>IP servers in the network)\n \
* eg: -D 4 \n\
@@ -179,13 +212,23 @@ Help\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\
@ -1675,7 +1753,7 @@ index d6b26d3..7eb4ded 100644
* -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 +238,9 @@ Help\n\
@@ -195,6 +239,9 @@ Help\n\
\n\
* -R --document-root directory: document root for the minisatip web page and images\n\
\n\
@ -1685,7 +1763,7 @@ index d6b26d3..7eb4ded 100644
* -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 +250,9 @@ Help\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\
@ -1695,7 +1773,7 @@ index d6b26d3..7eb4ded 100644
* -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 +286,28 @@ Help\n\
@@ -237,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\
@ -1707,6 +1785,8 @@ index d6b26d3..7eb4ded 100644
+\t* The format is: M1:S1[,M2:S2] - master:slave\n\
+ * eg: 0:1,0:2,0:3 \n\
+\n\
+* -P --power num: power to all inputs (0 = only active inputs, 1 = all inputs)\n\
+\n\
+* -Q --quattro quattro LNB config (H/H,H/V,L/H,L/V)\n\
+\n\
+* -Z --quattro-hiband hiband\n\
@ -1725,7 +1805,7 @@ index d6b26d3..7eb4ded 100644
app_name,
ADAPTER_BUFFER,
DVR_BUFFER, opts.no_threads ? "DISABLED" : "ENABLED");
@@ -277,17 +347,24 @@ void set_options(int argc, char *argv[])
@@ -277,17 +350,24 @@ void set_options(int argc, char *argv[])
opts.satip_setup_pids = 0;
opts.output_buffer = 512 * 1024;
opts.satip_servers[0] = 0;
@ -1748,11 +1828,11 @@ index d6b26d3..7eb4ded 100644
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:L:QZ:U:M:",
+ "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 +436,12 @@ void set_options(int argc, char *argv[])
@@ -359,9 +439,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;
@ -1766,7 +1846,7 @@ index d6b26d3..7eb4ded 100644
break;
}
@@ -410,6 +490,12 @@ void set_options(int argc, char *argv[])
@@ -410,6 +493,12 @@ void set_options(int argc, char *argv[])
break;
}
@ -1779,7 +1859,7 @@ index d6b26d3..7eb4ded 100644
case SLAVE_OPT:
{
set_slave_adapters(optarg);
@@ -508,6 +594,33 @@ void set_options(int argc, char *argv[])
@@ -508,6 +597,35 @@ void set_options(int argc, char *argv[])
LOGL(0, "Not a valid path for the xml file")
;
break;
@ -1800,20 +1880,22 @@ index d6b26d3..7eb4ded 100644
+ set_unicable_input(optarg);
+ break;
+
+ case AXE_POWER:
+ opts.axe_power = atoi(optarg) + 1;
+ break;
+
+ case AXE_SKIP_PKT:
+ {
+ opts.axe_skippkt = atoi(optarg);
+ if (opts.axe_skippkt < 0)
+ opts.axe_skippkt = 0;
+ if (opts.axe_skippkt > 200)
+ opts.axe_skippkt = 200;
+ break;
+ }
+#endif
}
}
@@ -676,7 +789,6 @@ int read_rtsp(sockets * s)
@@ -676,7 +794,6 @@ int read_rtsp(sockets * s)
if (transport)
{
int s_timeout;
@ -1821,7 +1903,7 @@ index d6b26d3..7eb4ded 100644
if (sid->timeout == 1)
sid->timeout = opts.timeout_sec;
@@ -1003,6 +1115,9 @@ int ssdp_reply(sockets * s)
@@ -1003,6 +1120,9 @@ int ssdp_reply(sockets * s)
return 0;
}
@ -1831,7 +1913,7 @@ index d6b26d3..7eb4ded 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 +1253,11 @@ int main(int argc, char *argv[])
@@ -1138,7 +1258,11 @@ int main(int argc, char *argv[])
if (!opts.no_threads)
set_socket_thread(sock_signal, start_new_thread("signal"));
@ -1846,7 +1928,7 @@ index d6b26d3..7eb4ded 100644
diff --git a/minisatip.h b/minisatip.h
old mode 100644
new mode 100755
index 403af34..cbdc23c
index 403af34..f250422
--- a/minisatip.h
+++ b/minisatip.h
@@ -10,13 +10,15 @@
@ -1866,7 +1948,7 @@ index 403af34..cbdc23c
#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,10 @@ struct struct_opts
@@ -48,6 +50,11 @@ struct struct_opts
int force_scan;
int clean_psi;
int file_line;
@ -1874,10 +1956,11 @@ index 403af34..cbdc23c
+ int quattro_hiband;
+ int axe_unicinp[4];
+ int axe_skippkt;
+ int axe_power;
char *last_log;
int dvbapi_port;
char *dvbapi_host;
@@ -62,6 +68,15 @@ struct struct_opts
@@ -62,6 +69,15 @@ struct struct_opts
char *xml_path;
char no_threads;
int th_priority;