minisatip update - optimize read loop, handle diseqc

This commit is contained in:
Jaroslav Kysela 2015-03-30 09:54:51 +02:00
parent 10c89e86a2
commit 21e8ed1566
1 changed files with 34 additions and 22 deletions

View File

@ -113,7 +113,7 @@ index 0000000..5af4c73
+
+#endif
diff --git a/dvb.c b/dvb.c
index 5701bd2..d731bd9 100755
index 5701bd2..a06978c 100755
--- a/dvb.c
+++ b/dvb.c
@@ -41,6 +41,10 @@
@ -127,22 +127,12 @@ index 5701bd2..d731bd9 100755
extern struct struct_opts opts;
@@ -330,6 +334,7 @@ int setup_switch (int frontend_fd, transponder *tp)
hiband = 1;
}
+#ifndef AXE
if(tp->switch_type == SWITCH_UNICABLE)
{
freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq);
@@ -343,6 +348,15 @@ int setup_switch (int frontend_fd, transponder *tp)
@@ -343,6 +347,13 @@ 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);
}
+#else
+#ifdef AXE
+ LOGL(3, "axe_fe: reset for fd %d", frontend_fd);
+ if (ioctl(frontend_fd, FE_SET_VOLTAGE, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) == -1)
+ LOG("axe_fd FE_SET_VOLTAGE failed for fd %d: %s", frontend_fd, strerror(errno));
+ if (axe_fe_reset(frontend_fd) < 0)
+ LOG("axe_fe: RESET failed for fd %d: %s", frontend_fd, strerror(errno));
+ if (axe_fe_thread_up(frontend_fd, hiband | (pol << 1)) < 0)
@ -151,7 +141,7 @@ index 5701bd2..d731bd9 100755
tp->old_pol = pol;
tp->old_hiband = hiband;
@@ -383,8 +397,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -383,8 +394,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},
@ -162,7 +152,7 @@ index 5701bd2..d731bd9 100755
{.cmd = DTV_TUNE},
};
static struct dtv_properties dvbs2_cmdseq =
@@ -465,8 +481,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -465,8 +478,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
p = &dvbs2_cmdseq;
p->props[DELSYS].u.data = tp->sys;
p->props[MODULATION].u.data = tp->mtype;
@ -173,7 +163,7 @@ index 5701bd2..d731bd9 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 +493,12 @@ tune_it_s2 (int fd_frontend, transponder * tp)
@@ -475,7 +490,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],
@ -187,7 +177,7 @@ index 5701bd2..d731bd9 100755
break;
@@ -560,6 +583,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -560,6 +580,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
char buf[100];
int fd;
@ -208,7 +198,7 @@ index 5701bd2..d731bd9 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 +622,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -585,6 +619,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
}
LOG ("setting filter on PID %d for fd %d", i_pid, fd);
@ -216,7 +206,7 @@ index 5701bd2..d731bd9 100755
return fd;
}
@@ -592,6 +630,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
@@ -592,6 +627,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
int del_filters (int fd, int pid)
{
@ -234,7 +224,7 @@ index 5701bd2..d731bd9 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 +648,7 @@ int del_filters (int fd, int pid)
@@ -599,6 +645,7 @@ int del_filters (int fd, int pid)
else
LOG ("clearing filters on PID %d FD %d", pid, fd);
close (fd);
@ -242,7 +232,7 @@ index 5701bd2..d731bd9 100755
return 0;
}
@@ -606,6 +656,10 @@ int del_filters (int fd, int pid)
@@ -606,6 +653,10 @@ int del_filters (int fd, int pid)
fe_delivery_system_t
dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
{
@ -253,7 +243,7 @@ index 5701bd2..d731bd9 100755
int i, res, rv = 0;
struct dvb_frontend_info fe_info;
@@ -703,6 +757,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
@@ -703,6 +754,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;
@ -309,3 +299,25 @@ index d4076ba..581d1bd 100755
readBootID();
if ((ssdp = udp_bind (NULL, 1900)) < 1)
FAIL ("SSDP: Could not bind on udp port 1900");
diff --git a/socketworks.c b/socketworks.c
index b4891f1..1d6f3e0 100755
--- a/socketworks.c
+++ b/socketworks.c
@@ -433,6 +433,17 @@ select_and_execute ()
ss->rtime = c_time;
if(rlen>0)
ss->rlen += rlen;
+#ifdef AXE
+ if (ss->type == TYPE_DVR) {
+ while (rlen > 0 && ss->lbuf - ss->rlen >= 1316) {
+ rlen = read (ss->sock, &ss->buf[ss->rlen], ss->lbuf - ss->rlen);
+ if (rlen > 0)
+ ss->rlen += rlen;
+ }
+ if (rlen == 0)
+ rlen = 1;
+ }
+#endif
//force 0 at the end of the string
if(ss->lbuf >= ss->rlen)
ss->buf[ss->rlen] = 0;