minisatip.patch: unicable fixes, LED fixes, demux open fixes

This commit is contained in:
Jaroslav Kysela 2015-04-06 18:42:47 +02:00
parent 7906071467
commit 0c159293c5

View File

@ -1,5 +1,5 @@
diff --git a/adapter.c b/adapter.c diff --git a/adapter.c b/adapter.c
index 285faea..d1fcf93 100755 index 285faea..086242d 100755
--- a/adapter.c --- a/adapter.c
+++ b/adapter.c +++ b/adapter.c
@@ -29,10 +29,15 @@ @@ -29,10 +29,15 @@
@ -106,7 +106,7 @@ index 285faea..d1fcf93 100755
if (a[na].fe > 0) if (a[na].fe > 0)
close (a[na].fe); close (a[na].fe);
if (a[na].sock >= 0) if (a[na].sock >= 0)
@@ -366,7 +416,33 @@ close_adapter_for_stream (int sid, int aid) @@ -366,7 +416,29 @@ close_adapter_for_stream (int sid, int aid)
// delete the attached PIDs as well // delete the attached PIDs as well
mark_pids_deleted (aid, sid, NULL); mark_pids_deleted (aid, sid, NULL);
update_pids (aid); update_pids (aid);
@ -130,29 +130,45 @@ index 285faea..d1fcf93 100755
+ LOG("AXE standby: adapter %d busy (%d), keeping", i, a[i].sid_cnt); + LOG("AXE standby: adapter %d busy (%d), keeping", i, a[i].sid_cnt);
+ } + }
+ sockets_del(a[aid].sock); + sockets_del(a[aid].sock);
+ sprintf (buf, "/dev/axe/demuxts-%d", a[i].pa); + a[aid].sock = -1;
+ a[aid].dvr = open (buf, O_RDONLY | O_NONBLOCK);
+ 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);
+ } + }
+#endif +#endif
+// if (a[aid].sid_cnt == 0) +// if (a[aid].sid_cnt == 0)
// close_adapter (aid); // close_adapter (aid);
} }
@@ -419,6 +495,10 @@ int tune (int aid, int sid) @@ -419,7 +491,10 @@ int tune (int aid, int sid)
ad->tp.switch_type = ad->switch_type; ad->tp.switch_type = ad->switch_type;
ad->tp.uslot = ad->uslot; ad->tp.uslot = ad->uslot;
ad->tp.ufreq = ad->ufreq; ad->tp.ufreq = ad->ufreq;
-
+ +
+#ifdef AXE +#ifdef AXE
+ axe_set_tuner_led(aid + 1, 1); + axe_set_tuner_led(aid + 1, 1);
+#endif +#endif
rv = tune_it_s2 (ad->fe, &ad->tp); rv = tune_it_s2 (ad->fe, &ad->tp);
a[aid].status = 0; a[aid].status = 0;
@@ -684,7 +764,11 @@ describe_adapter (int sid, int aid) a[aid].status_cnt = 0;
@@ -428,6 +503,18 @@ int tune (int aid, int sid)
close_streams_for_adapter (aid, sid);
update_pids (aid);
}
+#ifdef AXE
+ if (a[aid].dvr < 0) {
+ char buf[32];
+ sprintf (buf, "/dev/axe/demuxts-%d", a[i].pa);
+ a[aid].dvr = open (buf, O_RDONLY | O_NONBLOCK);
+ 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);
+ }
+ if (rv < 0)
+ axe_set_tuner_led(aid + 1, 0);
+#endif
}
else
LOG ("not tuning for SID %d (do_tune=%d, master_sid=%d)", sid,
@@ -684,7 +771,11 @@ describe_adapter (int sid, int aid)
memset (dad, 0, sizeof (dad)); memset (dad, 0, sizeof (dad));
x = 0; x = 0;
// do just max 3 signal check 1s after tune // do just max 3 signal check 1s after tune
@ -164,7 +180,7 @@ index 285faea..d1fcf93 100755
{ {
int new_gs = 1; int new_gs = 1;
ts = getTick (); ts = getTick ();
@@ -701,11 +785,20 @@ describe_adapter (int sid, int aid) @@ -701,11 +792,20 @@ describe_adapter (int sid, int aid)
if (ad->max_snr <= ad->snr) ad->max_snr = (ad->snr>0)?ad->snr:1; 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)", 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); 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);
@ -185,7 +201,7 @@ index 285faea..d1fcf93 100755
} }
if(use_ad) if(use_ad)
{ {
@@ -715,14 +808,14 @@ describe_adapter (int sid, int aid) @@ -715,14 +815,14 @@ describe_adapter (int sid, int aid)
} }
if (t->sys == SYS_DVBS || t->sys == SYS_DVBS2) 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=", sprintf (dad, "ver=1.0;src=%d;tuner=%d,%d,%d,%d,%d,%s,%s,%s,%s,%s,%d,%s;pids=",
@ -323,7 +339,7 @@ index 0000000..c29131d
+ +
+#endif +#endif
diff --git a/dvb.c b/dvb.c diff --git a/dvb.c b/dvb.c
index 5701bd2..3638836 100755 index 5701bd2..4590d43 100755
--- a/dvb.c --- a/dvb.c
+++ b/dvb.c +++ b/dvb.c
@@ -41,6 +41,10 @@ @@ -41,6 +41,10 @@
@ -397,21 +413,37 @@ index 5701bd2..3638836 100755
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) 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)); LOG("send_jess: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno));
msleep(15); msleep(15);
@@ -343,6 +379,13 @@ int setup_switch (int frontend_fd, transponder *tp) @@ -332,7 +368,15 @@ int setup_switch (int frontend_fd, transponder *tp)
if(tp->switch_type == SWITCH_UNICABLE)
{
+#ifdef AXE
+ adapter *a = get_adapter(0);
+ if (a)
+ freq = send_unicable(a->fe, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq);
+ else
+ LOGL(3, "axe unicable setup: unable to find adapter 0");
+#else
freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq);
+#endif
}else if(tp->switch_type == SWITCH_JESS)
{
freq = send_jess(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq);
@@ -343,6 +387,13 @@ int setup_switch (int frontend_fd, transponder *tp)
else 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); 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);
} }
+#ifdef AXE +#ifdef AXE
+ LOGL(3, "axe_fe: reset for fd %d", frontend_fd); + LOGL(3, "axe_fe: reset for fd %d up %d", frontend_fd, (hiband << 1) | pol);
+ if (axe_fe_reset(frontend_fd) < 0) + if (axe_fe_reset(frontend_fd) < 0)
+ LOG("axe_fe: RESET failed for fd %d: %s", frontend_fd, strerror(errno)); + LOG("axe_fe: RESET failed for fd %d: %s", frontend_fd, strerror(errno));
+ if (axe_fe_thread_up(frontend_fd, hiband | (pol << 1)) < 0) + if (axe_fe_thread_up(frontend_fd, (hiband << 1) | pol) < 0)
+ LOG("axe_fe: THREAD UP failed for fd %d: %s", frontend_fd, strerror(errno)); + LOG("axe_fe: THREAD UP failed for fd %d: %s", frontend_fd, strerror(errno));
+#endif +#endif
tp->old_pol = pol; tp->old_pol = pol;
tp->old_hiband = hiband; tp->old_hiband = hiband;
@@ -383,8 +426,10 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -383,8 +434,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
{.cmd = DTV_INVERSION,.u.data = 0}, {.cmd = DTV_INVERSION,.u.data = 0},
{.cmd = DTV_SYMBOL_RATE,.u.data = 0}, {.cmd = DTV_SYMBOL_RATE,.u.data = 0},
{.cmd = DTV_INNER_FEC,.u.data = 0}, {.cmd = DTV_INNER_FEC,.u.data = 0},
@ -422,7 +454,7 @@ index 5701bd2..3638836 100755
{.cmd = DTV_TUNE}, {.cmd = DTV_TUNE},
}; };
static struct dtv_properties dvbs2_cmdseq = static struct dtv_properties dvbs2_cmdseq =
@@ -465,8 +510,10 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -465,8 +518,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
p = &dvbs2_cmdseq; p = &dvbs2_cmdseq;
p->props[DELSYS].u.data = tp->sys; p->props[DELSYS].u.data = tp->sys;
p->props[MODULATION].u.data = tp->mtype; p->props[MODULATION].u.data = tp->mtype;
@ -433,7 +465,7 @@ index 5701bd2..3638836 100755
p->props[INVERSION].u.data = tp->inversion; p->props[INVERSION].u.data = tp->inversion;
p->props[SYMBOL_RATE].u.data = tp->sr; p->props[SYMBOL_RATE].u.data = tp->sr;
p->props[FEC_INNER].u.data = tp->fec; p->props[FEC_INNER].u.data = tp->fec;
@@ -475,7 +522,12 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -475,7 +530,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", 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], 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], fe_delsys[p->props[DELSYS].u.data], fe_modulation[p->props[MODULATION].u.data],
@ -447,7 +479,7 @@ index 5701bd2..3638836 100755
break; break;
@@ -560,6 +612,20 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -560,6 +620,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
char buf[100]; char buf[100];
int fd; int fd;
@ -468,7 +500,7 @@ index 5701bd2..3638836 100755
if ( i_pid > 8192 ) if ( i_pid > 8192 )
LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad); LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad);
@@ -585,6 +651,7 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -585,6 +659,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
} }
LOG ("setting filter on PID %d for fd %d", i_pid, fd); LOG ("setting filter on PID %d for fd %d", i_pid, fd);
@ -476,7 +508,7 @@ index 5701bd2..3638836 100755
return fd; return fd;
} }
@@ -592,6 +659,17 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -592,6 +667,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
int del_filters (int fd, int pid) int del_filters (int fd, int pid)
{ {
@ -494,7 +526,7 @@ index 5701bd2..3638836 100755
if (fd < 0) if (fd < 0)
LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid); LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid);
if (ioctl (fd, DMX_STOP) < 0) if (ioctl (fd, DMX_STOP) < 0)
@@ -599,6 +677,7 @@ int del_filters (int fd, int pid) @@ -599,6 +685,7 @@ int del_filters (int fd, int pid)
else else
LOG ("clearing filters on PID %d FD %d", pid, fd); LOG ("clearing filters on PID %d FD %d", pid, fd);
close (fd); close (fd);
@ -502,7 +534,7 @@ index 5701bd2..3638836 100755
return 0; return 0;
} }
@@ -606,6 +685,15 @@ int del_filters (int fd, int pid) @@ -606,6 +693,15 @@ int del_filters (int fd, int pid)
fe_delivery_system_t fe_delivery_system_t
dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
{ {
@ -518,7 +550,7 @@ index 5701bd2..3638836 100755
int i, res, rv = 0; int i, res, rv = 0;
struct dvb_frontend_info fe_info; struct dvb_frontend_info fe_info;
@@ -703,6 +791,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) @@ -703,6 +799,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); LOG ("returning default from dvb_delsys => %s (count %d)", fe_delsys[rv] , nsys);
return (fe_delivery_system_t) rv; return (fe_delivery_system_t) rv;