From 97347962f069bfcc96b59db3b69464bf8f4b15e7 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Feb 2016 18:21:05 +0100 Subject: [PATCH] another minisatip/5 updates --- Makefile | 24 ++- patches/minisatip-axe.patch | 228 +++++++++++++++++++++------- patches/minisatip5-axe.patch | 287 ++++++++++++++++++++++++----------- 3 files changed, 374 insertions(+), 165 deletions(-) diff --git a/Makefile b/Makefile index fdc02071..af267f3c 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=c1a31b3a677fa4af3cbb10f9c95d07c040e787ed +MINISATIP5_COMMIT=ddd4796b2c759292f6db1d1be84bbeb5bd57ed03 BUSYBOX=busybox-1.24.1 @@ -148,18 +148,9 @@ fs.cpio: $(CPIO_SRCS) $(foreach f,$(RPCBIND_SBIN_FILES), -e "apps/$(RPCBIND)/$(f):usr/sbin/$(f)") \ $(foreach f,$(NFSUTILS_SBIN_FILES), -e "apps/$(NFSUTILS)/$(f):usr/sbin/$(notdir $(f))") \ -e "apps/minisatip/minisatip:sbin/minisatip" \ - -e "apps/minisatip/icons/lr.jpg:usr/share/minisatip/icons/lr.jpg" \ - -e "apps/minisatip/icons/lr.png:usr/share/minisatip/icons/lr.png" \ - -e "apps/minisatip/icons/sm.jpg:usr/share/minisatip/icons/sm.jpg" \ - -e "apps/minisatip/icons/sm.png:usr/share/minisatip/icons/sm.png" \ + $(foreach f,$(notdir $(wildcard apps/minisatip/icons/*)), -e "apps/minisatip/icons/$f:usr/share/minisatip/icons/$f") \ -e "apps/minisatip5/minisatip:sbin/minisatip5" \ - -e "apps/minisatip5/html/lr.jpg:usr/share/minisatip/html/lr.jpg" \ - -e "apps/minisatip5/html/lr.png:usr/share/minisatip/html/lr.png" \ - -e "apps/minisatip5/html/sm.jpg:usr/share/minisatip/html/sm.jpg" \ - -e "apps/minisatip5/html/sm.png:usr/share/minisatip/html/sm.png" \ - -e "apps/minisatip5/html/dLAN.xml:usr/share/minisatip/html/dLAN.xml" \ - -e "apps/minisatip5/html/satip.xml:usr/share/minisatip/html/satip.xml" \ - -e "apps/minisatip5/html/status.html:usr/share/minisatip/html/status.html" \ + $(foreach f,$(notdir $(wildcard apps/minisatip5/html/*)), -e "apps/minisatip5/html/$f:usr/share/minisatip/html/$f") \ -e "apps/$(NANO)/src/nano:usr/bin/nano" \ -e "apps/mtd-utils/nandwrite:usr/sbin/nandwrite2" \ -e "apps/oscam-svn/Distribution/oscam-1.20-unstable_svn$(OSCAM_REV)-sh4-linux:sbin/oscamd" @@ -306,7 +297,8 @@ media-clean: # minisatip # -apps/minisatip/axe.h: +apps/minisatip/axe.h: patches/minisatip-axe.patch + rm -rf apps/minisatip $(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip,$(MINISATIP_COMMIT)) cd apps/minisatip; patch -p1 < ../../patches/minisatip-axe.patch @@ -326,7 +318,8 @@ minisatip-clean: # minisatip5 # -apps/minisatip5/axe.h: +apps/minisatip5/axe.h: patches/minisatip5-axe.patch + rm -rf apps/minisatip5 $(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip5,$(MINISATIP5_COMMIT)) cd apps/minisatip5; patch -p1 < ../../patches/minisatip5-axe.patch @@ -671,3 +664,6 @@ clean: kernel-mrproper rm -rf firmware/initramfs rm -rf toolchain/4.5.3-99 rm -rf tools/syscall-dump.o* tools/syscall-dump.s* + +testx: + echo $(foreach f,$(notdir $(wildcard apps/minisatip5/html/*)), "'$f'") diff --git a/patches/minisatip-axe.patch b/patches/minisatip-axe.patch index 7ad8ac88..6dfc03e3 100644 --- a/patches/minisatip-axe.patch +++ b/patches/minisatip-axe.patch @@ -1,5 +1,5 @@ diff --git a/adapter.c b/adapter.c -index 285faea..0b59730 100755 +index 285faea..6168975 100755 --- a/adapter.c +++ b/adapter.c @@ -29,10 +29,15 @@ @@ -49,7 +49,26 @@ index 285faea..0b59730 100755 } for (na; na < MAX_ADAPTERS; na++) a[na].pa = a[na].fn = -1; -@@ -122,9 +143,23 @@ init_hw () +@@ -69,6 +90,7 @@ find_adapters () + // avoid adapter close unless all the adapters can be closed + int adapter_timeout(sockets *s) + { ++#ifndef AXE + int do_close = 1, i, max_close = 0; + int rtime = getTick(); + for (i = 0; i < MAX_ADAPTERS; i++) +@@ -84,6 +106,10 @@ int adapter_timeout(sockets *s) + s->rtime = max_close; + + return do_close; ++#else ++ LOG("Requested adapter %d close", s->sid); ++ return 1; ++#endif + } + + int +@@ -122,9 +148,23 @@ init_hw () find_adapters (); LOG ("trying to open [%d] adapter %d and frontend %d", i, a[i].pa, a[i].fn); @@ -74,7 +93,7 @@ index 285faea..0b59730 100755 a[i].dvr = open (buf, O_RDONLY | O_NONBLOCK); if (a[i].fe < 0 || a[i].dvr < 0) { -@@ -139,22 +174,24 @@ init_hw () +@@ -139,22 +179,24 @@ init_hw () a[i].enabled = 1; if (!a[i].buf) @@ -102,7 +121,7 @@ index 285faea..0b59730 100755 init_dvb_parameters (&a[i].tp); mark_pids_deleted (i, -1, NULL); update_pids (i); -@@ -165,8 +202,8 @@ init_hw () +@@ -165,8 +207,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); @@ -113,7 +132,7 @@ index 285faea..0b59730 100755 sockets_timeout (a[i].sock, 60000); LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys); -@@ -179,7 +216,6 @@ init_hw () +@@ -179,7 +221,6 @@ init_hw () return num_adapters; } @@ -121,7 +140,7 @@ index 285faea..0b59730 100755 void close_adapter (int na) { -@@ -194,8 +230,41 @@ close_adapter (int na) +@@ -194,8 +235,44 @@ close_adapter (int na) mark_pids_deleted (na, -1, NULL); update_pids (na); // if(a[na].dmx>0)close(a[na].dmx); @@ -133,24 +152,27 @@ index 285faea..0b59730 100755 + 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 (a[i].axe_used || a[i].fe > 0) j++; + } + if (j > 0 && opts.axe_power > 1) + goto nostandby; + for (i = 0; i < 4; i++) { ++ if (opts.axe_power < 2 && i != na && j) ++ continue; + 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; + } -+ if (a[i].fe2 <= 0 || a[i].axe_feused == 0) ++ if (a[i].fe2 < 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].fe2 = -1; ++ a[i].axe_feused = 0; + a[i].tp.old_diseqc = a[i].tp.old_pol = a[i].tp.old_hiband = -1; + } + } @@ -163,18 +185,30 @@ index 285faea..0b59730 100755 if (a[na].sock >= 0) sockets_del (a[na].sock); a[na].fe = 0; -@@ -366,8 +435,8 @@ close_adapter_for_stream (int sid, int aid) +@@ -343,6 +420,7 @@ set_adapter_for_stream (int sid, int aid) + if (a[aid].master_sid == -1) + a[aid].master_sid = sid; + a[aid].sid_cnt++; ++ sockets_set_poll(a[aid].sock, 1); + LOG ("set adapter %d for stream %d m:%d s:%d", aid, sid, a[aid].master_sid, a[aid].sid_cnt); + return 0; + } +@@ -366,8 +444,12 @@ close_adapter_for_stream (int sid, int aid) // delete the attached PIDs as well mark_pids_deleted (aid, sid, NULL); update_pids (aid); -// if (a[aid].sid_cnt == 0) -// close_adapter (aid); -+ if (a[aid].sid_cnt == 0) -+ close_adapter (aid); ++ if (a[aid].sid_cnt == 0) { ++#ifdef AXE ++ axe_set_tuner_led(aid + 1, 0); ++#endif ++ sockets_set_poll(a[aid].sock, 0); ++ } } -@@ -410,7 +479,11 @@ update_pids (int aid) +@@ -410,7 +492,11 @@ update_pids (int aid) int tune (int aid, int sid) { adapter *ad = get_adapter(aid); @@ -187,7 +221,7 @@ index 285faea..0b59730 100755 if(!ad) return -400; ad->last_sort = getTick (); -@@ -419,7 +492,13 @@ int tune (int aid, int sid) +@@ -419,7 +505,13 @@ int tune (int aid, int sid) ad->tp.switch_type = ad->switch_type; ad->tp.uslot = ad->uslot; ad->tp.ufreq = ad->ufreq; @@ -202,7 +236,7 @@ index 285faea..0b59730 100755 rv = tune_it_s2 (ad->fe, &ad->tp); a[aid].status = 0; a[aid].status_cnt = 0; -@@ -428,6 +507,12 @@ int tune (int aid, int sid) +@@ -428,6 +520,12 @@ int tune (int aid, int sid) close_streams_for_adapter (aid, sid); update_pids (aid); } @@ -215,7 +249,7 @@ index 285faea..0b59730 100755 } else LOG ("not tuning for SID %d (do_tune=%d, master_sid=%d)", sid, -@@ -684,7 +769,11 @@ describe_adapter (int sid, int aid) +@@ -684,7 +782,11 @@ describe_adapter (int sid, int aid) memset (dad, 0, sizeof (dad)); x = 0; // do just max 3 signal check 1s after tune @@ -227,7 +261,7 @@ index 285faea..0b59730 100755 { int new_gs = 1; ts = getTick (); -@@ -701,11 +790,20 @@ describe_adapter (int sid, int aid) +@@ -701,11 +803,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); @@ -248,7 +282,7 @@ index 285faea..0b59730 100755 } if(use_ad) { -@@ -715,14 +813,14 @@ describe_adapter (int sid, int aid) +@@ -715,14 +826,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=", @@ -266,7 +300,7 @@ index 285faea..0b59730 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 +923,7 @@ void enable_adapters(char *o) +@@ -825,7 +936,7 @@ void enable_adapters(char *o) void set_unicable_adapters(char *o, int type) { @@ -275,7 +309,7 @@ index 285faea..0b59730 100755 char buf[100], *arg[20], *sep1, *sep2; strncpy(buf, o, sizeof(buf)); -@@ -839,17 +937,67 @@ void set_unicable_adapters(char *o, int type) +@@ -839,17 +950,67 @@ void set_unicable_adapters(char *o, int type) sep2 = strchr(arg[i], '-'); if( !sep1 || !sep2) continue; @@ -344,7 +378,7 @@ index 285faea..0b59730 100755 int delsys_match(adapter *ad, int del_sys) { -@@ -866,3 +1014,71 @@ int delsys_match(adapter *ad, int del_sys) +@@ -866,3 +1027,71 @@ int delsys_match(adapter *ad, int del_sys) return 0; } @@ -605,7 +639,9 @@ index 0000000..cfc1927 + +#endif diff --git a/dvb.c b/dvb.c -index 5701bd2..79cac82 100755 +old mode 100755 +new mode 100644 +index 5701bd2..d352f8a --- a/dvb.c +++ b/dvb.c @@ -41,6 +41,10 @@ @@ -619,14 +655,14 @@ index 5701bd2..79cac82 100755 extern struct struct_opts opts; -@@ -215,6 +219,31 @@ msleep (uint32_t msec) +@@ -215,6 +219,46 @@ msleep (uint32_t msec) ; } +#ifdef AXE -+void axe_wakeup(int voltage) ++void axe_wakeup(int fe_fd, int voltage) +{ -+ int i; ++ int i, mask; + adapter *a; + if (opts.axe_power < 2) + return; @@ -638,7 +674,22 @@ index 5701bd2..79cac82 100755 + return; + } + LOG("AXE wakeup"); -+ for (i = 0; i < 4; i++) { ++ for (i = mask = 0; i < 4; i++) { ++ /* lowband enabled */ ++ if (opts.quattro && opts.quattro_hiband == 1 && i < 2) { ++ mask = 3; ++ continue; ++ } ++ /* hiband enabled */ ++ if (opts.quattro && opts.quattro_hiband == 2 && i >= 2) { ++ mask = 3<<2; ++ continue; ++ } ++ mask |= 1<force_disable) + continue; @@ -651,17 +702,17 @@ index 5701bd2..79cac82 100755 int send_diseqc(int fd, int pos, int pol, int hiband) { struct dvb_diseqc_master_cmd cmd = { -@@ -229,6 +258,9 @@ int send_diseqc(int fd, int pos, int pol, int hiband) +@@ -229,6 +273,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)); +#ifdef AXE -+ axe_wakeup(pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13); ++ axe_wakeup(fd, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13); +#endif 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 +284,12 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int +@@ -252,8 +299,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 }; @@ -675,12 +726,12 @@ index 5701bd2..79cac82 100755 t = (freq + ufreq + 2) / 4 - 350; cmd.msg[3] = ((t & 0x0300) >> 8) | -@@ -262,12 +298,15 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int +@@ -262,12 +313,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]); +#ifdef AXE -+ axe_wakeup(SEC_VOLTAGE_13); ++ axe_wakeup(fd, 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)); @@ -692,7 +743,7 @@ index 5701bd2..79cac82 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 +325,7 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre +@@ -286,6 +340,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; @@ -700,12 +751,12 @@ index 5701bd2..79cac82 100755 cmd.msg[1] = slot << 3; cmd.msg[1] |= ((t << 8) & 0x07); -@@ -295,12 +335,15 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre +@@ -295,12 +350,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]); +#ifdef AXE -+ axe_wakeup(SEC_VOLTAGE_13); ++ axe_wakeup(fd, 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)); @@ -717,7 +768,7 @@ index 5701bd2..79cac82 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) -@@ -312,6 +355,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre +@@ -312,6 +370,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre return ufreq * 1000; } @@ -727,11 +778,11 @@ index 5701bd2..79cac82 100755 + 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; ++ else if (opts.quattro && opts.quattro_hiband == 1 && input < 2) ++ *equattro = diseqc; + /* 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 if (opts.quattro && opts.quattro_hiband == 2 && input >= 2 && input < 4) ++ *equattro = diseqc; + else + *equattro = 0; + return *equattro; @@ -741,7 +792,7 @@ index 5701bd2..79cac82 100755 int setup_switch (int frontend_fd, transponder *tp) { int i; -@@ -320,7 +380,7 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -320,7 +395,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; @@ -750,7 +801,7 @@ index 5701bd2..79cac82 100755 if (freq < SLOF) { freq = (freq - LOF1); -@@ -330,12 +390,113 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -330,12 +405,112 @@ int setup_switch (int frontend_fd, transponder *tp) hiband = 1; } @@ -807,8 +858,7 @@ index 5701bd2..79cac82 100755 + } + goto axe; + } -+ } -+ if (ad && opts.quattro) { ++ } else if (ad && opts.quattro) { + if (opts.quattro_hiband == 1 && hiband) { + LOG("axe_fe: hiband is not allowed for quattro config (adapter %d)", input); + return 0; @@ -864,7 +914,7 @@ index 5701bd2..79cac82 100755 }else { if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc) -@@ -343,6 +504,16 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -343,6 +518,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); } @@ -881,7 +931,7 @@ index 5701bd2..79cac82 100755 tp->old_pol = pol; tp->old_hiband = hiband; -@@ -383,8 +554,10 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -383,8 +568,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}, @@ -892,7 +942,7 @@ index 5701bd2..79cac82 100755 {.cmd = DTV_TUNE}, }; static struct dtv_properties dvbs2_cmdseq = -@@ -462,11 +635,15 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -462,11 +649,15 @@ tune_it_s2 (int fd_frontend, transponder * tp) tp->mtype = QPSK; bpol = getTick(); if_freq = setup_switch (fd_frontend, tp); @@ -908,7 +958,7 @@ index 5701bd2..79cac82 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 +652,12 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -475,7 +666,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], @@ -922,7 +972,7 @@ index 5701bd2..79cac82 100755 break; -@@ -560,6 +742,20 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -560,6 +756,20 @@ set_pid (int hw, int ad, uint16_t i_pid) char buf[100]; int fd; @@ -943,7 +993,7 @@ index 5701bd2..79cac82 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 +781,7 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -585,6 +795,7 @@ set_pid (int hw, int ad, uint16_t i_pid) } LOG ("setting filter on PID %d for fd %d", i_pid, fd); @@ -951,7 +1001,7 @@ index 5701bd2..79cac82 100755 return fd; } -@@ -592,6 +789,17 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -592,6 +803,17 @@ set_pid (int hw, int ad, uint16_t i_pid) int del_filters (int fd, int pid) { @@ -969,7 +1019,7 @@ index 5701bd2..79cac82 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 +807,7 @@ int del_filters (int fd, int pid) +@@ -599,6 +821,7 @@ int del_filters (int fd, int pid) else LOG ("clearing filters on PID %d FD %d", pid, fd); close (fd); @@ -977,7 +1027,7 @@ index 5701bd2..79cac82 100755 return 0; } -@@ -606,6 +815,15 @@ int del_filters (int fd, int pid) +@@ -606,6 +829,15 @@ int del_filters (int fd, int pid) fe_delivery_system_t dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) { @@ -993,7 +1043,7 @@ index 5701bd2..79cac82 100755 int i, res, rv = 0; struct dvb_frontend_info fe_info; -@@ -703,6 +921,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) +@@ -703,6 +935,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; @@ -1300,7 +1350,7 @@ index 821e756..2794f49 100755 char playlist[200]; }; diff --git a/socketworks.c b/socketworks.c -index b4891f1..1a275b7 100755 +index b4891f1..4697f03 100755 --- a/socketworks.c +++ b/socketworks.c @@ -299,6 +299,7 @@ socket_action a, socket_action c, socket_action t) @@ -1311,10 +1361,18 @@ index b4891f1..1a275b7 100755 s[i].close_sec = 0; s[i].sock_id = i; pf[i].fd = sock; -@@ -339,6 +340,17 @@ sockets_del (int sock) +@@ -339,6 +340,25 @@ sockets_del (int sock) return 0; } ++void ++sockets_set_poll (int sock, int enable) ++{ ++ if (sock < 0 || sock > MAX_SOCKS) ++ return; ++ pf[sock].events = enable ? (POLLIN | POLLPRI) : 0; ++} ++ +void +sockets_reset (int sock) +{ @@ -1329,7 +1387,23 @@ index b4891f1..1a275b7 100755 int run_loop, it = 0, c_time; int bw, bwtt, bwnotify; -@@ -433,6 +445,29 @@ select_and_execute () +@@ -348,7 +368,6 @@ uint32_t nsecs, reads; + int + select_and_execute () + { +- fd_set io; + struct timeval tv; + socklen_t slen; + int i, +@@ -362,7 +381,6 @@ select_and_execute () + lt = getTick (); + while (run_loop) + { +- FD_ZERO (&io); + i = -1; + // LOG("start select"); + if ((rv = poll (pf, max_sock, 200)) < 0) +@@ -433,6 +451,29 @@ select_and_execute () ss->rtime = c_time; if(rlen>0) ss->rlen += rlen; @@ -1359,8 +1433,34 @@ index b4891f1..1a275b7 100755 //force 0 at the end of the string if(ss->lbuf >= ss->rlen) ss->buf[ss->rlen] = 0; +@@ -510,8 +551,6 @@ select_and_execute () + && ((s[i].close_sec > 0 && lt - s[i].rtime > s[i].close_sec) + || (s[i].close_sec == 1))) + { +- int do_close = 0; +- + // LOG("Timeout idle connection %d index %d",s[i].sock,i); + if (s[i].timeout && s[i].timeout (&s[i])) + sockets_del (i); +@@ -619,12 +658,13 @@ char * + get_current_timestamp_log (void) + { + static char date_str[200]; ++ struct timeval tv; + time_t date; + struct tm *t; +- time (&date); +- t = localtime (&date); ++ if (gettimeofday(&tv, NULL)) return "01/01 00:00:20"; ++ t = localtime (&tv.tv_sec); + if(!t) return "01/01 00:00:20"; +- snprintf (date_str, sizeof (date_str), "%02d/%02d %02d:%02d:%02d.%03d",t->tm_mday, t->tm_mon + 1, t->tm_hour, t->tm_min, t->tm_sec, getTick()); ++ snprintf (date_str, sizeof (date_str), "%02d/%02d %02d:%02d:%02d.%03d",t->tm_mday, t->tm_mon + 1, t->tm_hour, t->tm_min, t->tm_sec, (int)(tv.tv_usec / 1000)); + return date_str; + } + diff --git a/socketworks.h b/socketworks.h -index 57b25b2..0d81319 100755 +index 57b25b2..226c689 100755 --- a/socketworks.h +++ b/socketworks.h @@ -18,6 +18,7 @@ typedef struct struct_sockets @@ -1371,18 +1471,28 @@ index 57b25b2..0d81319 100755 int close_sec; int sock_id; // socket id int err; -@@ -43,6 +44,7 @@ int get_sock_port(int fd); +@@ -43,6 +44,8 @@ int get_sock_port(int fd); int sockets_add (int sock, struct sockaddr_in *sa, int sid, int type, socket_action a, socket_action c, socket_action t); int sockets_del (int sock); ++void sockets_set_poll (int sock, int enable); +void sockets_reset (int sock); int no_action (int s); int select_and_execute (); int get_mac (char *mac); diff --git a/stream.c b/stream.c -index db4a46d..2036841 100755 +index db4a46d..8cdd239 100755 --- a/stream.c +++ b/stream.c +@@ -54,7 +54,7 @@ getTick () + { //ms + struct timespec ts; + +- clock_gettime (CLOCK_REALTIME, &ts); ++ clock_gettime (CLOCK_MONOTONIC, &ts); + theTick = ts.tv_nsec / 1000000; + theTick += ts.tv_sec * 1000; + ntime = ts.tv_sec * 1000000 + ts.tv_nsec; @@ -320,6 +320,7 @@ int decode_transport (sockets * s, char *arg, char *default_rtp, int start_rtp) if(sid->type == 0) { diff --git a/patches/minisatip5-axe.patch b/patches/minisatip5-axe.patch index 375983f8..7936b13f 100644 --- a/patches/minisatip5-axe.patch +++ b/patches/minisatip5-axe.patch @@ -1,8 +1,24 @@ diff --git a/adapter.c b/adapter.c -index 839c078..a95564d 100644 +index cd5d8f5..2bb026c 100644 --- a/adapter.c +++ b/adapter.c -@@ -612,6 +612,7 @@ int tune(int aid, int sid) +@@ -117,6 +117,7 @@ int adapter_timeout(sockets *s) + return 0; + } + ++#ifndef AXE + if (opts.no_threads) + { + for (i = 0; i < MAX_ADAPTERS; i++) +@@ -133,6 +134,7 @@ int adapter_timeout(sockets *s) + s->sid, do_close, max_close); + if (!do_close) + s->rtime = max_close; ++#endif + + return do_close; + } +@@ -617,6 +619,7 @@ int tune(int aid, int sid) ad->status = -1; ad->status_cnt = 0; set_socket_pos(ad->sock, 0); // flush the existing buffer @@ -10,7 +26,7 @@ index 839c078..a95564d 100644 ad->rlen = 0; if (ad->sid_cnt > 1) // the master changed the frequency { -@@ -1284,6 +1285,53 @@ void set_slave_adapters(char *o) +@@ -1304,6 +1307,53 @@ void set_slave_adapters(char *o) } } @@ -65,7 +81,7 @@ index 839c078..a95564d 100644 void set_adapters_delsys(char *o) { diff --git a/adapter.h b/adapter.h -index d7d9194..317b19c 100644 +index 39d4d5f..c4eb45f 100644 --- a/adapter.h +++ b/adapter.h @@ -6,7 +6,11 @@ @@ -84,12 +100,12 @@ index d7d9194..317b19c 100644 char enabled; SMutex mutex; char type; // available on the system -- int fe, dvr; -+ int fe, fe2, dvr; +- int fe, dvr, dmx; ++ int fe, fe2, dvr, dmx; int pa, fn; // physical adapter, physical frontend number fe_delivery_system_t sys[MAX_DELSYS]; -@@ -84,6 +88,9 @@ typedef struct struct_adapter +@@ -85,6 +89,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 diseqc diseqc_param; @@ -99,10 +115,10 @@ index d7d9194..317b19c 100644 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); +@@ -131,6 +138,8 @@ void set_diseqc_adapters(char *o); void set_diseqc_timing(char *o); void set_slave_adapters(char *o); + void set_adapter_dmxsource(char *o); +void set_link_adapters(char *o); +void set_unicable_input(char *o); void reset_pids_type(int aid, int clear_pat); @@ -264,7 +280,7 @@ index 0000000..d8b06bc + +#endif diff --git a/dvb.c b/dvb.c -index 7916d2b..7daa5a8 100644 +index 74124fc..bcfc684 100644 --- a/dvb.c +++ b/dvb.c @@ -42,6 +42,11 @@ @@ -279,7 +295,7 @@ index 7916d2b..7daa5a8 100644 char *fe_pilot[] = { "on", "off", " ", //auto NULL }; -@@ -329,29 +334,45 @@ int dvb_open_device(adapter *ad) +@@ -329,25 +334,40 @@ 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); @@ -315,25 +331,29 @@ index 7916d2b..7daa5a8 100644 return 1; } ad->type = ADAPTER_DVB; - + ad->dmx = -1; LOG("opened DVB adapter %d fe:%d dvr:%d", ad->id, ad->fe, ad->dvr); +#ifndef AXE if (ioctl(ad->dvr, DMX_SET_BUFFER_SIZE, opts.dvr_buffer) < 0) LOG("couldn't set DVR buffer size error %d: %s", errno, strerror(errno)) else - LOG("Done setting DVR buffer to %d bytes", opts.dvr_buffer); +@@ -367,7 +387,7 @@ int dvb_open_device(adapter *ad) + LOG("Set DMX_SET_SOURCE for adapter %d to %d", ad->id, ad->dmx_source); + + } +- +#endif return 0; } -@@ -377,6 +398,31 @@ void diseqc_cmd(int fd, int times, char *str, struct dvb_diseqc_master_cmd *cmd, +@@ -393,6 +413,46 @@ void diseqc_cmd(int fd, int times, char *str, struct dvb_diseqc_master_cmd *cmd, } +#ifdef AXE -+void axe_wakeup(int voltage) ++void axe_wakeup(int fe_fd, int voltage) +{ -+ int i; ++ int i, mask; + adapter *a; + if (opts.axe_power < 2) + return; @@ -345,7 +365,22 @@ index 7916d2b..7daa5a8 100644 + return; + } + LOG("AXE wakeup"); -+ for (i = 0; i < 4; i++) { ++ for (i = mask = 0; i < 4; i++) { ++ /* lowband enabled */ ++ if (opts.quattro && opts.quattro_hiband == 1 && i < 2) { ++ mask = 3; ++ continue; ++ } ++ /* hiband enabled */ ++ if (opts.quattro && opts.quattro_hiband == 2 && i >= 2) { ++ mask = 3<<2; ++ continue; ++ } ++ mask |= 1<committed_no; -@@ -412,6 +458,9 @@ int send_diseqc(int fd, int pos, int pos_change, int pol, int hiband, diseqc *d) +@@ -428,6 +488,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); +#ifdef AXE -+ axe_wakeup(pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13); ++ axe_wakeup(fd, 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)); -@@ -472,6 +521,9 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, diseqc *d) +@@ -490,6 +553,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, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1], - cmd.msg[2], cmd.msg[3], cmd.msg[4]); + 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); ++ axe_wakeup(fd, 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)); -@@ -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]); +@@ -537,6 +603,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 -+ axe_wakeup(SEC_VOLTAGE_13); ++ axe_wakeup(fd, 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)); -@@ -541,6 +596,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d) +@@ -559,6 +628,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d) return d->ufreq * 1000; } @@ -398,11 +433,11 @@ index 7916d2b..7daa5a8 100644 + 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; ++ else if (opts.quattro && opts.quattro_hiband == 1 && input < 2) ++ *equattro = diseqc; + /* 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 if (opts.quattro && opts.quattro_hiband == 2 && input >= 2 && input < 4) ++ *equattro = diseqc; + else + *equattro = 0; + return *equattro; @@ -412,7 +447,7 @@ index 7916d2b..7daa5a8 100644 int setup_switch(int frontend_fd, adapter *ad, transponder *tp) { int hiband = 0; -@@ -564,15 +636,112 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) +@@ -582,15 +668,111 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) hiband = 1; } @@ -424,7 +459,7 @@ index 7916d2b..7daa5a8 100644 + if (tp->diseqc_param.switch_type != SWITCH_UNICABLE && + tp->diseqc_param.switch_type != SWITCH_JESS) { + input = ad->id; -+ if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) { ++ if (!opts.quattro || extra_quattro(input, diseqc, &equattro)) { + if (equattro > 0) + diseqc = equattro - 1; + adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa); @@ -461,8 +496,7 @@ index 7916d2b..7daa5a8 100644 + } + goto axe; + } -+ } -+ if (ad && opts.quattro) { ++ } else if (opts.quattro) { + if (opts.quattro_hiband == 1 && hiband) { + LOG("axe_fe: hiband is not allowed for quattro config (adapter %d)", input); + return 0; @@ -484,7 +518,7 @@ index 7916d2b..7daa5a8 100644 + adm->old_hiband = hiband; + adm->old_diseqc = diseqc = 0; + } -+ adm->axe_used |= (1 << input); ++ adm->axe_used |= (1 << ad->id); + adm->axe_feused = 1; + goto axe; + } @@ -503,30 +537,34 @@ index 7916d2b..7daa5a8 100644 + if (tp->diseqc_param.switch_type == SWITCH_UNICABLE) { +- freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband, +- &tp->diseqc_param); +#ifdef AXE + if (ad) + freq = send_unicable(ad->fe, freq / 1000, diseqc, + 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->diseqc_param.switch_type == SWITCH_JESS) { +- freq = send_jess(frontend_fd, freq / 1000, diseqc, pol, hiband, +- &tp->diseqc_param); +#ifdef AXE + if (ad) + freq = send_jess(ad->fe, freq / 1000, diseqc, + 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->diseqc_param.switch_type == SWITCH_SLAVE) { -@@ -591,6 +760,17 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) - pol, hiband, diseqc); +@@ -609,6 +791,17 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) + diseqc); } +#ifdef AXE @@ -543,7 +581,7 @@ index 7916d2b..7daa5a8 100644 ad->old_pol = pol; ad->old_hiband = hiband; ad->old_diseqc = diseqc; -@@ -626,6 +806,14 @@ int dvb_tune(int aid, transponder * tp) +@@ -644,6 +837,14 @@ int dvb_tune(int aid, transponder * tp) memset(p_cmd, 0, sizeof(p_cmd)); bclear = getTick(); @@ -558,7 +596,7 @@ index 7916d2b..7daa5a8 100644 if ((ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear)) == -1) { LOG("FE_SET_PROPERTY DTV_CLEAR failed for fd %d: %s", fd_frontend, -@@ -645,8 +833,10 @@ int dvb_tune(int aid, transponder * tp) +@@ -663,8 +864,10 @@ int dvb_tune(int aid, transponder * tp) ADD_PROP(DTV_SYMBOL_RATE, tp->sr) ADD_PROP(DTV_INNER_FEC, tp->fec) @@ -569,7 +607,7 @@ index 7916d2b..7daa5a8 100644 #if DVBAPIVERSION >= 0x0502 ADD_PROP(DTV_STREAM_ID, tp->plp) #endif -@@ -655,7 +845,12 @@ int dvb_tune(int aid, transponder * tp) +@@ -673,7 +876,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], @@ -583,7 +621,7 @@ index 7916d2b..7daa5a8 100644 break; case SYS_DVBT: -@@ -756,29 +951,46 @@ int dvb_tune(int aid, transponder * tp) +@@ -774,29 +982,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)); @@ -635,7 +673,7 @@ index 7916d2b..7daa5a8 100644 return -1; } -@@ -804,10 +1016,22 @@ int dvb_set_pid(adapter *a, uint16_t i_pid) +@@ -822,10 +1047,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; @@ -658,7 +696,7 @@ index 7916d2b..7daa5a8 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) -@@ -816,10 +1040,20 @@ int dvb_del_filters(int fd, int pid) +@@ -834,10 +1071,20 @@ int dvb_del_filters(int fd, int pid) LOG("clearing filter on PID %d FD %d", pid, fd); close(fd); return 0; @@ -679,7 +717,7 @@ index 7916d2b..7daa5a8 100644 int i, res, rv = 0; struct dvb_frontend_info fe_info; -@@ -908,6 +1142,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys) +@@ -926,6 +1173,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; @@ -687,7 +725,7 @@ index 7916d2b..7daa5a8 100644 } -@@ -1020,6 +1255,7 @@ void dvb_get_signal(adapter *ad) +@@ -1037,6 +1285,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; @@ -695,7 +733,7 @@ index 7916d2b..7daa5a8 100644 if (ad->snr > 4096) new_gs = 0; if (new_gs) -@@ -1032,6 +1268,14 @@ void dvb_get_signal(adapter *ad) +@@ -1049,6 +1298,14 @@ void dvb_get_signal(adapter *ad) ad->strength = ad->strength >> 8; ad->snr = ad->snr >> 8; } @@ -710,12 +748,13 @@ index 7916d2b..7daa5a8 100644 } void dvb_commit(adapter *a) -@@ -1039,6 +1283,47 @@ void dvb_commit(adapter *a) +@@ -1056,12 +1313,52 @@ void dvb_commit(adapter *a) return; } +-void dvb_close(adapter *a) +int dvb_close(adapter *a2) -+{ + { +#ifdef AXE + adapter *c; + int aid, busy; @@ -726,19 +765,21 @@ index 7916d2b..7daa5a8 100644 + 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++; ++ c->axe_used &= ~(1 << a2->id); ++ if (c->axe_used || c->fe > 0) busy++; + } + if (busy > 0 && opts.axe_power > 1) + goto nostandby; + for (aid = 0; aid < 4; aid++) { + c = a[aid]; ++ if (opts.axe_power < 2 && c != a2 && busy) ++ continue; + 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) ++ if (c->fe2 < 0) + continue; + LOG("AXE standby: adapter %d", aid); + axe_fe_standby(c->fe2, -1); @@ -751,14 +792,18 @@ index 7916d2b..7daa5a8 100644 + } +nostandby: + axe_set_tuner_led(a2->id + 1, 0); ++ return 0; ++#else + if (a->dmx >= 0) + close(a->dmx); + a->dmx = -1; +- return; +#endif + return 0; -+} -+ + } + void find_dvb_adapter(adapter **a) - { - int na = 0; -@@ -1047,9 +1332,21 @@ void find_dvb_adapter(adapter **a) +@@ -1072,9 +1369,21 @@ void find_dvb_adapter(adapter **a) int i = 0, j = 0; adapter *ad; @@ -780,7 +825,7 @@ index 7916d2b..7daa5a8 100644 sprintf(buf, "/dev/dvb/adapter%d/frontend%d", i, j); fd = open(buf, O_RDONLY | O_NONBLOCK); if (fd < 0) -@@ -1057,7 +1354,8 @@ void find_dvb_adapter(adapter **a) +@@ -1082,7 +1391,8 @@ void find_dvb_adapter(adapter **a) sprintf(buf, "/dev/dvb/adapter%d/ca%d", i, j); fd = open(buf, O_RDONLY | O_NONBLOCK); } @@ -790,16 +835,7 @@ index 7916d2b..7daa5a8 100644 if (fd >= 0) { // if (is_adapter_disabled(na)) -@@ -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; -- ad->close = NULL; -+ ad->close = (Adapter_commit) dvb_close; - ad->get_signal = (Device_signal) dvb_get_signal; - ad->type = ADAPTER_DVB; - close(fd); -@@ -1088,6 +1386,14 @@ void find_dvb_adapter(adapter **a) +@@ -1113,6 +1423,14 @@ void find_dvb_adapter(adapter **a) if (na == MAX_ADAPTERS) return; } @@ -814,11 +850,56 @@ index 7916d2b..7daa5a8 100644 } for (; na < MAX_ADAPTERS; na++) if (a[na]) +diff --git a/html/status.html b/html/status.html +index 15dc0fa..01fe57f 100644 +--- a/html/status.html ++++ b/html/status.html +@@ -16,6 +16,10 @@ + font-family: Tahoma, Geneva, sans-serif; + font-size: 1em; + } ++ .level { ++ display: inline; ++ white-space: nowrap; ++ } + /* + .enabled { + color: green; +@@ -33,12 +37,8 @@ + + + +-This page will refresh every 5 seconds.
+ +