diff --git a/patches/minisatip-axe.patch b/patches/minisatip-axe.patch index 13ee1ca5..1e078b70 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..f71ac85 100755 +index 285faea..382cefb 100755 --- a/adapter.c +++ b/adapter.c @@ -29,10 +29,15 @@ @@ -292,6 +292,75 @@ index 285faea..f71ac85 100755 int delsys_match(adapter *ad, int del_sys) { +@@ -866,3 +974,68 @@ int delsys_match(adapter *ad, int del_sys) + return 0; + + } ++ ++#ifdef AXE ++ ++#define myf(buf, buflen, fmt, ...) do { \ ++ size_t l = strlen(buf); \ ++ snprintf(buf + l, buflen - l, fmt, ##__VA_ARGS__); \ ++} while (0) ++ ++extern streams st[]; ++ ++#include ++ ++static char *axe_status_pol(int pol) ++{ ++ switch (pol) { ++ case 0: return "none"; ++ case 1: return "v"; ++ case 2: return "h"; ++ case 3: return "l"; ++ case 4: return "r"; ++ default: return "unknown"; ++ } ++} ++ ++void ++axe_status(char *buf, size_t buflen) ++{ ++ size_t idx = 0; ++ int i, k, j, port; ++ char *host; ++ ++ buf[0] = '\0'; ++ myf(buf, buflen, "StatusVersion=1\n"); ++ for (i = 0; i < MAX_ADAPTERS; i++) { ++ if (!a[i].enabled) continue; ++ if (a[i].sid_cnt == 0) continue; ++ myf(buf, buflen, "\nSubscriptions_%d=%d\n", i + 1, a[i].sid_cnt); ++ myf(buf, buflen, "DiseqC_%d=%d\n", i + 1, a[i].tp.diseqc); ++ myf(buf, buflen, "Freq_%d=%d\n", i + 1, a[i].tp.freq); ++ myf(buf, buflen, "Pol_%d=%s\n", i + 1, axe_status_pol(a[i].tp.pol)); ++ for (k = 0; k < MAX_PIDS; k++) { ++ if (a[i].pids[k].flags == 0) continue; ++ if (k == 0) ++ myf(buf, buflen, "Pids_%d=%d", i + 1, a[i].pids[k].pid); ++ else ++ myf(buf, buflen, ",%d", a[i].pids[k].pid); ++ } ++ if (k > 0) ++ myf(buf, buflen, "\n"); ++ for (k = j = 0; k < MAX_STREAMS; k++) { ++ streams *s = &st[k]; ++ if (!s->enabled) continue; ++ if (s->adapter != i) continue; ++ port = ntohs(s->sa.sin_port); ++ host = inet_ntoa(s->sa.sin_addr); ++ myf(buf, buflen, "Stream_%d_%d=%s:%d\n", i + 1, ++j, host, port); ++ myf(buf, buflen, "Streaming_%d_%d=%d\n", i + 1, j, s->do_play ? "active" : "inactive"); ++ if (s->sp > 0) { ++ myf(buf, buflen, "IOCnt_%d_%d=%zu\n", i + 1, j, s->sp); ++ myf(buf, buflen, "Bytes_%d_%d=%zu\n", i + 1, j, s->sb); ++ } ++ } ++ } ++} ++#endif diff --git a/adapter.h b/adapter.h index 629bd9c..d95e59a 100755 --- a/adapter.h @@ -314,10 +383,10 @@ index 629bd9c..d95e59a 100755 diff --git a/axe.h b/axe.h new file mode 100644 -index 0000000..46e8b02 +index 0000000..f6e9772 --- /dev/null +++ b/axe.h -@@ -0,0 +1,116 @@ +@@ -0,0 +1,117 @@ +#ifndef __AXE_H +#define __AXE_H + @@ -430,6 +499,7 @@ index 0000000..46e8b02 + +void axe_set_tuner_led(int tuner, int on); +void axe_set_network_led(int on); ++void axe_status(char *buf, size_t buflen); + +#endif + @@ -793,7 +863,7 @@ index 5701bd2..32fd683 100755 } diff --git a/minisatip.c b/minisatip.c -index d4076ba..baf14ab 100755 +index d4076ba..39f0671 100755 --- a/minisatip.c +++ b/minisatip.c @@ -36,6 +36,7 @@ @@ -928,7 +998,23 @@ index d4076ba..baf14ab 100755 rlen = s->rlen; s->rlen = 0; -@@ -904,6 +947,9 @@ ssdp_reply (sockets * s) +@@ -781,6 +824,15 @@ read_http (sockets * s) + return 0; + } + ++#ifdef AXE ++ if (strncmp (arg[1], "/axe-status.txt", 15) == 0) ++ { ++ axe_status(buf, sizeof(buf)); ++ http_response (s, 200, "CACHE-CONTROL: no-cache\r\nContent-type: text/plain", buf, 0, 0); ++ return 0; ++ } ++#endif ++ + if (strncmp (arg[1], "/icons/", 7) == 0) + { + char *ctype = NULL; +@@ -904,6 +956,9 @@ ssdp_reply (sockets * s) return 0; } @@ -938,7 +1024,7 @@ index d4076ba..baf14ab 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 +1033,13 @@ main (int argc, char *argv[]) +@@ -987,7 +1042,13 @@ main (int argc, char *argv[]) set_options (argc, argv); if (opts.daemon) becomeDaemon (); @@ -952,7 +1038,7 @@ index d4076ba..baf14ab 100755 readBootID(); if ((ssdp = udp_bind (NULL, 1900)) < 1) FAIL ("SSDP: Could not bind on udp port 1900"); -@@ -1021,7 +1073,9 @@ main (int argc, char *argv[]) +@@ -1021,7 +1082,9 @@ main (int argc, char *argv[]) select_and_execute (); unlink(PID_FILE); free_all (); @@ -963,7 +1049,7 @@ index d4076ba..baf14ab 100755 } -@@ -1247,12 +1301,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) { +@@ -1247,12 +1310,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) { idx = 1; else if ( idx < 0) idx = 0; @@ -983,7 +1069,7 @@ index d4076ba..baf14ab 100755 both = 0; va_start(arg, fmt); len += vsnprintf(output[idx] + len, sizeof(output[0]) - len, fmt, arg); -@@ -1271,9 +1329,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) { +@@ -1271,9 +1338,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) { } if(both){ @@ -1084,3 +1170,16 @@ index db4a46d..d5b7761 100755 copy32( rtcp, 56, sid->ssrc); rtcp[60] = 'S'; rtcp[61] = 'E'; +diff --git a/stream.h b/stream.h +index 5f1bd6f..5885c59 100755 +--- a/stream.h ++++ b/stream.h +@@ -38,7 +38,7 @@ typedef struct struct_streams + *pids; + struct iovec iov[MAX_PACK + 2]; + int iiov; +- int sp,sb; ++ size_t sp,sb; + int timeout; + + } streams;