another minisatip fix

This commit is contained in:
Jaroslav Kysela 2016-02-29 21:24:39 +01:00
parent e8e9039064
commit e2775b1edb
2 changed files with 83 additions and 22 deletions

View File

@ -1,5 +1,5 @@
diff --git a/adapter.c b/adapter.c diff --git a/adapter.c b/adapter.c
index 285faea..6168975 100755 index 285faea..10d162f 100755
--- a/adapter.c --- a/adapter.c
+++ b/adapter.c +++ b/adapter.c
@@ -29,10 +29,15 @@ @@ -29,10 +29,15 @@
@ -249,7 +249,25 @@ index 285faea..6168975 100755
} }
else else
LOG ("not tuning for SID %d (do_tune=%d, master_sid=%d)", sid, LOG ("not tuning for SID %d (do_tune=%d, master_sid=%d)", sid,
@@ -684,7 +782,11 @@ describe_adapter (int sid, int aid) @@ -659,6 +757,17 @@ get_adapter1 (int aid,char *file, int line)
return &a[aid];
}
+adapter *
+get_adapter21 (int aid,char *file, int line)
+{
+ if (aid < 0 || aid >= MAX_ADAPTERS || a[aid].force_disable)
+ {
+ LOG ("%s:%d: get_adapter2 returns NULL for adapter_id %d", file, line, aid);
+ return NULL;
+ }
+ return &a[aid];
+}
+
char dad[1000];
char *
describe_adapter (int sid, int aid)
@@ -684,7 +793,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
@ -261,7 +279,7 @@ index 285faea..6168975 100755
{ {
int new_gs = 1; int new_gs = 1;
ts = getTick (); ts = getTick ();
@@ -701,11 +803,20 @@ describe_adapter (int sid, int aid) @@ -701,11 +814,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);
@ -282,7 +300,7 @@ index 285faea..6168975 100755
} }
if(use_ad) if(use_ad)
{ {
@@ -715,14 +826,14 @@ describe_adapter (int sid, int aid) @@ -715,14 +837,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=",
@ -300,7 +318,7 @@ index 285faea..6168975 100755
t->c2tft, t->ds, t->plp, t->inversion); t->c2tft, t->ds, t->plp, t->inversion);
for (i = 0; i < MAX_PIDS; i++) for (i = 0; i < MAX_PIDS; i++)
if (use_ad && ad->pids[i].flags == 1) if (use_ad && ad->pids[i].flags == 1)
@@ -825,7 +936,7 @@ void enable_adapters(char *o) @@ -825,7 +947,7 @@ void enable_adapters(char *o)
void set_unicable_adapters(char *o, int type) void set_unicable_adapters(char *o, int type)
{ {
@ -309,7 +327,7 @@ index 285faea..6168975 100755
char buf[100], *arg[20], *sep1, *sep2; char buf[100], *arg[20], *sep1, *sep2;
strncpy(buf, o, sizeof(buf)); strncpy(buf, o, sizeof(buf));
@@ -839,17 +950,67 @@ void set_unicable_adapters(char *o, int type) @@ -839,17 +961,67 @@ void set_unicable_adapters(char *o, int type)
sep2 = strchr(arg[i], '-'); sep2 = strchr(arg[i], '-');
if( !sep1 || !sep2) if( !sep1 || !sep2)
continue; continue;
@ -378,7 +396,7 @@ index 285faea..6168975 100755
int delsys_match(adapter *ad, int del_sys) int delsys_match(adapter *ad, int del_sys)
{ {
@@ -866,3 +1027,71 @@ int delsys_match(adapter *ad, int del_sys) @@ -866,3 +1038,71 @@ int delsys_match(adapter *ad, int del_sys)
return 0; return 0;
} }
@ -451,7 +469,7 @@ index 285faea..6168975 100755
+} +}
+#endif +#endif
diff --git a/adapter.h b/adapter.h diff --git a/adapter.h b/adapter.h
index 629bd9c..45024a4 100755 index 629bd9c..c84506f 100755
--- a/adapter.h --- a/adapter.h
+++ b/adapter.h +++ b/adapter.h
@@ -24,7 +24,7 @@ typedef struct struct_adapter @@ -24,7 +24,7 @@ typedef struct struct_adapter
@ -473,7 +491,13 @@ index 629bd9c..45024a4 100755
} adapter; } adapter;
int init_hw (); int init_hw ();
@@ -65,7 +68,8 @@ void dump_pids (int aid); @@ -60,13 +63,16 @@ void mark_pids_deleted (int aid, int sid, char *pids);
int mark_pids_add (int sid, int aid, char *pids);
int update_pids (int aid);
adapter * get_adapter1 (int aid, char *file, int line);
+adapter * get_adapter21 (int aid, char *file, int line);
char *describe_adapter (int sid, int aid);
void dump_pids (int aid);
void sort_pids (int aid); void sort_pids (int aid);
void enable_adapters(char *o); void enable_adapters(char *o);
void set_unicable_adapters(char *o, int type); void set_unicable_adapters(char *o, int type);
@ -483,6 +507,8 @@ index 629bd9c..45024a4 100755
int delsys_match(adapter *ad, int del_sys); int delsys_match(adapter *ad, int del_sys);
#define get_adapter(a) get_adapter1(a, __FILE__, __LINE__) #define get_adapter(a) get_adapter1(a, __FILE__, __LINE__)
+#define get_adapter2(a) get_adapter21(a, __FILE__, __LINE__)
#endif /* */
diff --git a/axe.h b/axe.h diff --git a/axe.h b/axe.h
new file mode 100644 new file mode 100644
index 0000000..cfc1927 index 0000000..cfc1927
@ -641,7 +667,7 @@ index 0000000..cfc1927
diff --git a/dvb.c b/dvb.c diff --git a/dvb.c b/dvb.c
old mode 100755 old mode 100755
new mode 100644 new mode 100644
index 5701bd2..d352f8a index 5701bd2..c741112
--- a/dvb.c --- a/dvb.c
+++ b/dvb.c +++ b/dvb.c
@@ -41,6 +41,10 @@ @@ -41,6 +41,10 @@
@ -690,7 +716,7 @@ index 5701bd2..d352f8a
+ for (i = 0; i < 4 && mask; i++) { + for (i = 0; i < 4 && mask; i++) {
+ if (((1 << i) & mask) == 0) + if (((1 << i) & mask) == 0)
+ continue; + continue;
+ a = get_adapter(i); + a = get_adapter2(i);
+ if (a == NULL || a->force_disable) + if (a == NULL || a->force_disable)
+ continue; + continue;
+ if (ioctl(a->fe, FE_SET_VOLTAGE, voltage) == -1) + if (ioctl(a->fe, FE_SET_VOLTAGE, voltage) == -1)
@ -825,7 +851,7 @@ index 5701bd2..d352f8a
+ if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) { + if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) {
+ if (equattro > 0) + if (equattro > 0)
+ diseqc = equattro - 1; + diseqc = equattro - 1;
+ adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa); + adm = get_adapter2(ad->slave ? ad->slave - 1 : ad->pa);
+ if (adm == NULL) { + if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input); + LOG("axe_fe: unknown master adapter %d", input);
+ return 0; + return 0;
@ -868,7 +894,7 @@ index 5701bd2..d352f8a
+ return 0; + return 0;
+ } + }
+ input = ((hiband ^ 1) << 1) | (pol ^ 1); + input = ((hiband ^ 1) << 1) | (pol ^ 1);
+ adm = get_adapter(input); + adm = get_adapter2(input);
+ if (adm == NULL) { + if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input); + LOG("axe_fe: unknown master adapter %d", input);
+ return 0; + return 0;
@ -885,7 +911,7 @@ index 5701bd2..d352f8a
+ } + }
+ } else { + } else {
+ input = opts.axe_unicinp[aid]; + input = opts.axe_unicinp[aid];
+ ad = get_adapter(input); + ad = get_adapter2(input);
+ if (ad == NULL) { + if (ad == NULL) {
+ LOGL(3, "axe setup: unable to find adapter %d", input); + LOGL(3, "axe setup: unable to find adapter %d", input);
+ return 0; + return 0;

View File

@ -1,5 +1,5 @@
diff --git a/adapter.c b/adapter.c diff --git a/adapter.c b/adapter.c
index cd5d8f5..2bb026c 100644 index cd5d8f5..8c1fd9c 100644
--- a/adapter.c --- a/adapter.c
+++ b/adapter.c +++ b/adapter.c
@@ -117,6 +117,7 @@ int adapter_timeout(sockets *s) @@ -117,6 +117,7 @@ int adapter_timeout(sockets *s)
@ -26,7 +26,26 @@ index cd5d8f5..2bb026c 100644
ad->rlen = 0; ad->rlen = 0;
if (ad->sid_cnt > 1) // the master changed the frequency if (ad->sid_cnt > 1) // the master changed the frequency
{ {
@@ -1304,6 +1307,53 @@ void set_slave_adapters(char *o) @@ -935,6 +938,18 @@ get_adapter1(int aid, char *file, int line)
return a[aid];
}
+adapter *
+get_adapter21(int aid, char *file, int line)
+{
+ if (aid < 0 || aid >= MAX_ADAPTERS || !a[aid] || disabled[aid])
+ {
+ LOG("%s:%d: get_adapter2 returns NULL for adapter_id %d", file, line,
+ aid);
+ return NULL;
+ }
+ return a[aid];
+}
+
char* get_stream_pids(int s_id, char *dest, int max_size);
char *
describe_adapter(int sid, int aid, char *dad, int ld)
@@ -1304,6 +1319,53 @@ void set_slave_adapters(char *o)
} }
} }
@ -81,7 +100,7 @@ index cd5d8f5..2bb026c 100644
void set_adapters_delsys(char *o) void set_adapters_delsys(char *o)
{ {
diff --git a/adapter.h b/adapter.h diff --git a/adapter.h b/adapter.h
index 39d4d5f..c4eb45f 100644 index 39d4d5f..0cd4d8e 100644
--- a/adapter.h --- a/adapter.h
+++ b/adapter.h +++ b/adapter.h
@@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
@ -115,7 +134,15 @@ index 39d4d5f..c4eb45f 100644
int old_diseqc; int old_diseqc;
int old_hiband; int old_hiband;
int old_pol; int old_pol;
@@ -131,6 +138,8 @@ void set_diseqc_adapters(char *o); @@ -122,6 +129,7 @@ int update_pids(int aid);
int tune(int aid, int sid);
SPid *find_pid(int aid, int p);
adapter * get_adapter1(int aid, char *file, int line);
+adapter * get_adapter21(int aid, char *file, int line);
char *describe_adapter(int sid, int aid, char *dad, int ld);
void dump_pids(int aid);
void sort_pids(int aid);
@@ -131,6 +139,8 @@ void set_diseqc_adapters(char *o);
void set_diseqc_timing(char *o); void set_diseqc_timing(char *o);
void set_slave_adapters(char *o); void set_slave_adapters(char *o);
void set_adapter_dmxsource(char *o); void set_adapter_dmxsource(char *o);
@ -124,6 +151,14 @@ index 39d4d5f..c4eb45f 100644
void reset_pids_type(int aid, int clear_pat); void reset_pids_type(int aid, int clear_pat);
void reset_ecm_type_for_key(int aid, int key); void reset_ecm_type_for_key(int aid, int key);
int delsys_match(adapter *ad, int del_sys); int delsys_match(adapter *ad, int del_sys);
@@ -143,6 +153,7 @@ void set_adapters_delsys(char *o);
int signal_thread(sockets *s);
#define get_adapter(a) get_adapter1(a, __FILE__, __LINE__)
+#define get_adapter2(a) get_adapter21(a, __FILE__, __LINE__)
#define get_adapter_nw(aid) ((aid >= 0 && aid < MAX_ADAPTERS && a[aid] && a[aid]->enabled)?a[aid]:NULL)
#define adapter_lock(a) adapter_lock1(__FILE__,__LINE__,a)
diff --git a/axe.h b/axe.h diff --git a/axe.h b/axe.h
new file mode 100644 new file mode 100644
index 0000000..d8b06bc index 0000000..d8b06bc
@ -280,7 +315,7 @@ index 0000000..d8b06bc
+ +
+#endif +#endif
diff --git a/dvb.c b/dvb.c diff --git a/dvb.c b/dvb.c
index 74124fc..bcfc684 100644 index 74124fc..5e7acc6 100644
--- a/dvb.c --- a/dvb.c
+++ b/dvb.c +++ b/dvb.c
@@ -42,6 +42,11 @@ @@ -42,6 +42,11 @@
@ -462,7 +497,7 @@ index 74124fc..bcfc684 100644
+ if (!opts.quattro || extra_quattro(input, diseqc, &equattro)) { + if (!opts.quattro || extra_quattro(input, diseqc, &equattro)) {
+ if (equattro > 0) + if (equattro > 0)
+ diseqc = equattro - 1; + diseqc = equattro - 1;
+ adm = get_adapter(ad->slave ? ad->slave - 1 : ad->pa); + adm = get_adapter2(ad->slave ? ad->slave - 1 : ad->pa);
+ if (adm == NULL) { + if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input); + LOG("axe_fe: unknown master adapter %d", input);
+ return 0; + return 0;
@ -506,7 +541,7 @@ index 74124fc..bcfc684 100644
+ return 0; + return 0;
+ } + }
+ input = ((hiband ^ 1) << 1) | (pol ^ 1); + input = ((hiband ^ 1) << 1) | (pol ^ 1);
+ adm = get_adapter(input); + adm = get_adapter2(input);
+ if (adm == NULL) { + if (adm == NULL) {
+ LOG("axe_fe: unknown master adapter %d", input); + LOG("axe_fe: unknown master adapter %d", input);
+ return 0; + return 0;
@ -525,7 +560,7 @@ index 74124fc..bcfc684 100644
+ } else { + } else {
+ aid = ad->id & 3; + aid = ad->id & 3;
+ input = opts.axe_unicinp[aid]; + input = opts.axe_unicinp[aid];
+ ad = get_adapter(input); + ad = get_adapter2(input);
+ if (ad == NULL) { + if (ad == NULL) {
+ LOGL(3, "axe setup: unable to find adapter %d", input); + LOGL(3, "axe setup: unable to find adapter %d", input);
+ return 0; + return 0;