From e3f17f91a8ec0d442af460af1af3d141d8b99639 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 1 Mar 2016 18:13:20 +0100 Subject: [PATCH] minisatip fixes --- patches/minisatip-axe.patch | 92 +++++++++++++++++++-------------- patches/minisatip5-axe.patch | 98 +++++++++++++++++++++--------------- 2 files changed, 111 insertions(+), 79 deletions(-) diff --git a/patches/minisatip-axe.patch b/patches/minisatip-axe.patch index d0184b7a..ccc876f5 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..10d162f 100755 +index 285faea..937ac7c 100755 --- a/adapter.c +++ b/adapter.c @@ -29,10 +29,15 @@ @@ -68,7 +68,7 @@ index 285faea..10d162f 100755 } int -@@ -122,9 +148,23 @@ init_hw () +@@ -122,9 +148,22 @@ init_hw () find_adapters (); LOG ("trying to open [%d] adapter %d and frontend %d", i, a[i].pa, a[i].fn); @@ -85,7 +85,6 @@ index 285faea..10d162f 100755 + +#ifdef AXE + a[i].fe2 = a[i].fe; -+ a[i].axe_feused = 0; + sprintf (buf, "/dev/axe/demuxts-%d", a[i].pa); +#else sprintf (buf, "/dev/dvb/adapter%d/dvr%d", a[i].pa, a[i].fn); @@ -93,7 +92,7 @@ index 285faea..10d162f 100755 a[i].dvr = open (buf, O_RDONLY | O_NONBLOCK); if (a[i].fe < 0 || a[i].dvr < 0) { -@@ -139,22 +179,24 @@ init_hw () +@@ -139,22 +178,24 @@ init_hw () a[i].enabled = 1; if (!a[i].buf) @@ -121,7 +120,7 @@ index 285faea..10d162f 100755 init_dvb_parameters (&a[i].tp); mark_pids_deleted (i, -1, NULL); update_pids (i); -@@ -165,8 +207,8 @@ init_hw () +@@ -165,8 +206,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); @@ -132,7 +131,7 @@ index 285faea..10d162f 100755 sockets_timeout (a[i].sock, 60000); LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys); -@@ -179,7 +221,6 @@ init_hw () +@@ -179,7 +220,6 @@ init_hw () return num_adapters; } @@ -140,7 +139,7 @@ index 285faea..10d162f 100755 void close_adapter (int na) { -@@ -194,8 +235,44 @@ close_adapter (int na) +@@ -194,10 +234,47 @@ close_adapter (int na) mark_pids_deleted (na, -1, NULL); update_pids (na); // if(a[na].dmx>0)close(a[na].dmx); @@ -157,7 +156,7 @@ index 285faea..10d162f 100755 + if (j > 0 && opts.axe_power > 1) + goto nostandby; + for (i = 0; i < 4; i++) { -+ if (opts.axe_power < 2 && i != na && j) ++ if (opts.axe_power < 2 && i != na && j && a[i].sock >= 0) + 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", @@ -172,7 +171,6 @@ index 285faea..10d162f 100755 + ioctl(a[i].fe2, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF); + close(a[i].fe2); + 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; + } + } @@ -181,10 +179,15 @@ index 285faea..10d162f 100755 +#else if (a[na].fe > 0) close (a[na].fe); +- if (a[na].sock >= 0) +#endif - if (a[na].sock >= 0) ++ if (a[na].sock >= 0) { sockets_del (a[na].sock); ++ a[na].sock = -1; ++ } a[na].fe = 0; + // if(a[na].buf)free1(a[na].buf);a[na].buf=NULL; + LOG ("done closing adapter %d", na); @@ -343,6 +420,7 @@ set_adapter_for_stream (int sid, int aid) if (a[aid].master_sid == -1) a[aid].master_sid = sid; @@ -469,7 +472,7 @@ index 285faea..10d162f 100755 +} +#endif diff --git a/adapter.h b/adapter.h -index 629bd9c..c84506f 100755 +index 629bd9c..9420f93 100755 --- a/adapter.h +++ b/adapter.h @@ -24,7 +24,7 @@ typedef struct struct_adapter @@ -481,17 +484,16 @@ index 629bd9c..c84506f 100755 int pa, fn; // physical adapter, physical frontend number fe_delivery_system_t sys[10]; -@@ -45,6 +45,9 @@ typedef struct struct_adapter +@@ -45,6 +45,8 @@ typedef struct struct_adapter int switch_type; int uslot; // unicable/jess slot int ufreq; // unicable/jess frequency + int slave; + int axe_used; -+ int axe_feused; } adapter; int init_hw (); -@@ -60,13 +63,16 @@ void mark_pids_deleted (int aid, int sid, char *pids); +@@ -60,13 +62,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); @@ -667,7 +669,7 @@ index 0000000..cfc1927 diff --git a/dvb.c b/dvb.c old mode 100755 new mode 100644 -index 5701bd2..c741112 +index 5701bd2..60efc28 --- a/dvb.c +++ b/dvb.c @@ -41,6 +41,10 @@ @@ -794,7 +796,7 @@ index 5701bd2..c741112 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 +370,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre +@@ -312,6 +370,39 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre return ufreq * 1000; } @@ -813,12 +815,28 @@ index 5701bd2..c741112 + *equattro = 0; + return *equattro; +} ++ ++adapter *use_adapter(int input) ++{ ++ adapter *ad = input < 4 ? get_adapter2(input) : NULL; ++ char buf[32]; ++ if (ad) { ++ if (ad->fe2 <= 0) { ++ sprintf (buf, "/dev/axe/frontend-%d", input); ++ ad->fe2 = open(buf, O_RDONLY | O_NONBLOCK); ++ LOG("adapter %d force open, fe2: %d", input, ad->fe2); ++ if (ad->fe2 < 0) ++ ad = NULL; ++ } ++ } ++ return ad; ++} +#endif + int setup_switch (int frontend_fd, transponder *tp) { int i; -@@ -320,7 +395,7 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -320,7 +411,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; @@ -827,7 +845,7 @@ index 5701bd2..c741112 if (freq < SLOF) { freq = (freq - LOF1); -@@ -330,12 +405,112 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -330,12 +421,108 @@ int setup_switch (int frontend_fd, transponder *tp) hiband = 1; } @@ -845,13 +863,12 @@ index 5701bd2..c741112 + LOG("axe_fe: unknown adapter for fd %d", frontend_fd); + return 0; + } -+ ad->axe_feused = 1; + if (tp->switch_type != SWITCH_UNICABLE && tp->switch_type != SWITCH_JESS) { + input = aid; + if (ad && (!opts.quattro || extra_quattro(input, diseqc, &equattro))) { + if (equattro > 0) + diseqc = equattro - 1; -+ adm = get_adapter2(ad->slave ? ad->slave - 1 : ad->pa); ++ adm = use_adapter(ad->slave ? ad->slave - 1 : ad->pa); + if (adm == NULL) { + LOG("axe_fe: unknown master adapter %d", input); + return 0; @@ -871,13 +888,12 @@ index 5701bd2..c741112 + return 0; + } + adm->axe_used |= (1 << input); -+ adm->axe_feused = 1; + if (ad->slave) { + input = ad->slave - 1; + if(adm->tp.old_pol != pol || + adm->tp.old_hiband != hiband || + adm->tp.old_diseqc != diseqc) { -+ send_diseqc(adm->fe, diseqc, pol, hiband); ++ send_diseqc(adm->fe2, diseqc, pol, hiband); + adm->tp.old_pol = tp->old_pol = pol; + adm->tp.old_hiband = tp->old_hiband = hiband; + adm->tp.old_diseqc = tp->old_diseqc = diseqc; @@ -894,30 +910,28 @@ index 5701bd2..c741112 + return 0; + } + input = ((hiband ^ 1) << 1) | (pol ^ 1); -+ adm = get_adapter2(input); ++ adm = use_adapter(input); + if (adm == NULL) { + LOG("axe_fe: unknown master adapter %d", input); + return 0; + } + if(adm->tp.old_pol != pol || adm->tp.old_hiband != hiband) { -+ send_diseqc(adm->fe, 0, pol, hiband); ++ send_diseqc(adm->fe2, 0, pol, hiband); + adm->tp.old_pol = pol; + adm->tp.old_hiband = hiband; + adm->tp.old_diseqc = 0; + } + adm->axe_used |= (1 << aid); -+ adm->axe_feused = 1; + goto axe; + } + } else { + input = opts.axe_unicinp[aid]; -+ ad = get_adapter2(input); ++ ad = use_adapter(input); + if (ad == NULL) { + LOGL(3, "axe setup: unable to find adapter %d", input); + return 0; + } + ad->axe_used |= (1 << aid); -+ ad->axe_feused = 1; + } +#endif + @@ -925,7 +939,7 @@ index 5701bd2..c741112 { +#ifdef AXE + if (ad) -+ freq = send_unicable(ad->fe, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); ++ freq = send_unicable(ad->fe2, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); +#else freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); +#endif @@ -933,14 +947,14 @@ index 5701bd2..c741112 { +#ifdef AXE + if (ad) -+ freq = send_jess(ad->fe, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); ++ freq = send_jess(ad->fe2, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); +#else freq = send_jess(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq); +#endif }else { if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc) -@@ -343,6 +518,16 @@ int setup_switch (int frontend_fd, transponder *tp) +@@ -343,6 +530,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); } @@ -957,7 +971,7 @@ index 5701bd2..c741112 tp->old_pol = pol; tp->old_hiband = hiband; -@@ -383,8 +568,10 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -383,8 +580,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}, @@ -968,7 +982,7 @@ index 5701bd2..c741112 {.cmd = DTV_TUNE}, }; static struct dtv_properties dvbs2_cmdseq = -@@ -462,11 +649,15 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -462,11 +661,15 @@ tune_it_s2 (int fd_frontend, transponder * tp) tp->mtype = QPSK; bpol = getTick(); if_freq = setup_switch (fd_frontend, tp); @@ -984,7 +998,7 @@ index 5701bd2..c741112 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 +666,12 @@ tune_it_s2 (int fd_frontend, transponder * tp) +@@ -475,7 +678,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], @@ -998,7 +1012,7 @@ index 5701bd2..c741112 break; -@@ -560,6 +756,20 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -560,6 +768,20 @@ set_pid (int hw, int ad, uint16_t i_pid) char buf[100]; int fd; @@ -1019,7 +1033,7 @@ index 5701bd2..c741112 if ( i_pid > 8192 ) LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad); -@@ -585,6 +795,7 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -585,6 +807,7 @@ set_pid (int hw, int ad, uint16_t i_pid) } LOG ("setting filter on PID %d for fd %d", i_pid, fd); @@ -1027,7 +1041,7 @@ index 5701bd2..c741112 return fd; } -@@ -592,6 +803,17 @@ set_pid (int hw, int ad, uint16_t i_pid) +@@ -592,6 +815,17 @@ set_pid (int hw, int ad, uint16_t i_pid) int del_filters (int fd, int pid) { @@ -1045,7 +1059,7 @@ index 5701bd2..c741112 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 +821,7 @@ int del_filters (int fd, int pid) +@@ -599,6 +833,7 @@ int del_filters (int fd, int pid) else LOG ("clearing filters on PID %d FD %d", pid, fd); close (fd); @@ -1053,7 +1067,7 @@ index 5701bd2..c741112 return 0; } -@@ -606,6 +829,15 @@ int del_filters (int fd, int pid) +@@ -606,6 +841,15 @@ int del_filters (int fd, int pid) fe_delivery_system_t dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) { @@ -1069,7 +1083,7 @@ index 5701bd2..c741112 int i, res, rv = 0; struct dvb_frontend_info fe_info; -@@ -703,6 +935,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) +@@ -703,6 +947,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; diff --git a/patches/minisatip5-axe.patch b/patches/minisatip5-axe.patch index d44afafa..a39a270e 100644 --- a/patches/minisatip5-axe.patch +++ b/patches/minisatip5-axe.patch @@ -1,5 +1,5 @@ diff --git a/adapter.c b/adapter.c -index cd5d8f5..8c1fd9c 100644 +index cd5d8f5..7af67d4 100644 --- a/adapter.c +++ b/adapter.c @@ -117,6 +117,7 @@ int adapter_timeout(sockets *s) @@ -18,7 +18,15 @@ index cd5d8f5..8c1fd9c 100644 return do_close; } -@@ -617,6 +619,7 @@ int tune(int aid, int sid) +@@ -322,6 +324,7 @@ void close_adapter(int na) + ad->ca_mask = 0; + ad->fe = 0; + ad->dvr = 0; ++ ad->sock = -1; + ad->strength = 0; + ad->snr = 0; + ad->old_diseqc = -1; +@@ -617,6 +620,7 @@ int tune(int aid, int sid) ad->status = -1; ad->status_cnt = 0; set_socket_pos(ad->sock, 0); // flush the existing buffer @@ -26,7 +34,7 @@ index cd5d8f5..8c1fd9c 100644 ad->rlen = 0; if (ad->sid_cnt > 1) // the master changed the frequency { -@@ -935,6 +938,18 @@ get_adapter1(int aid, char *file, int line) +@@ -935,6 +939,18 @@ get_adapter1(int aid, char *file, int line) return a[aid]; } @@ -45,7 +53,7 @@ index cd5d8f5..8c1fd9c 100644 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) +@@ -1304,6 +1320,53 @@ void set_slave_adapters(char *o) } } @@ -100,7 +108,7 @@ index cd5d8f5..8c1fd9c 100644 void set_adapters_delsys(char *o) { diff --git a/adapter.h b/adapter.h -index 39d4d5f..0cd4d8e 100644 +index 39d4d5f..2d19b7d 100644 --- a/adapter.h +++ b/adapter.h @@ -6,7 +6,11 @@ @@ -124,17 +132,16 @@ index 39d4d5f..0cd4d8e 100644 int pa, fn; // physical adapter, physical frontend number fe_delivery_system_t sys[MAX_DELSYS]; -@@ -85,6 +89,9 @@ typedef struct struct_adapter +@@ -85,6 +89,8 @@ 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; + int slave; + int axe_used; -+ int axe_feused; int old_diseqc; int old_hiband; int old_pol; -@@ -122,6 +129,7 @@ int update_pids(int aid); +@@ -122,6 +128,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); @@ -142,7 +149,7 @@ index 39d4d5f..0cd4d8e 100644 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); +@@ -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); @@ -151,7 +158,7 @@ index 39d4d5f..0cd4d8e 100644 void reset_pids_type(int aid, int clear_pat); void reset_ecm_type_for_key(int aid, int key); int delsys_match(adapter *ad, int del_sys); -@@ -143,6 +153,7 @@ void set_adapters_delsys(char *o); +@@ -143,6 +152,7 @@ void set_adapters_delsys(char *o); int signal_thread(sockets *s); #define get_adapter(a) get_adapter1(a, __FILE__, __LINE__) @@ -315,7 +322,7 @@ index 0000000..d8b06bc + +#endif diff --git a/dvb.c b/dvb.c -index 74124fc..5e7acc6 100644 +index 74124fc..8282a06 100644 --- a/dvb.c +++ b/dvb.c @@ -42,6 +42,11 @@ @@ -458,7 +465,7 @@ index 74124fc..5e7acc6 100644 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)); -@@ -559,6 +628,23 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d) +@@ -559,6 +628,39 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, diseqc *d) return d->ufreq * 1000; } @@ -477,12 +484,28 @@ index 74124fc..5e7acc6 100644 + *equattro = 0; + return *equattro; +} ++ ++adapter *use_adapter(int input) ++{ ++ adapter *ad = input < 4 ? get_adapter2(input) : NULL; ++ char buf[32]; ++ if (ad) { ++ if (ad->fe2 <= 0) { ++ sprintf (buf, "/dev/axe/frontend-%d", input); ++ ad->fe2 = open(buf, O_RDONLY | O_NONBLOCK); ++ LOG("adapter %d force open, fe2: %d", input, ad->fe2); ++ if (ad->fe2 < 0) ++ ad = NULL; ++ } ++ } ++ return ad; ++} +#endif + int setup_switch(int frontend_fd, adapter *ad, transponder *tp) { int hiband = 0; -@@ -582,15 +668,111 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) +@@ -582,15 +684,107 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) hiband = 1; } @@ -490,14 +513,13 @@ index 74124fc..5e7acc6 100644 + adapter *ad2, *adm; + int input = 0, aid, equattro = 0; + -+ ad->axe_feused = 1; + if (tp->diseqc_param.switch_type != SWITCH_UNICABLE && + tp->diseqc_param.switch_type != SWITCH_JESS) { + input = ad->id; + if (!opts.quattro || extra_quattro(input, diseqc, &equattro)) { + if (equattro > 0) + diseqc = equattro - 1; -+ adm = get_adapter2(ad->slave ? ad->slave - 1 : ad->pa); ++ adm = use_adapter(ad->slave ? ad->slave - 1 : ad->pa); + if (adm == NULL) { + LOG("axe_fe: unknown master adapter %d", input); + return 0; @@ -517,13 +539,12 @@ index 74124fc..5e7acc6 100644 + return 0; + } + adm->axe_used |= (1 << input); -+ adm->axe_feused = 1; + if (ad->slave) { + input = ad->slave - 1; + if(adm->old_pol != pol || + adm->old_hiband != hiband || + adm->old_diseqc != diseqc) { -+ send_diseqc(adm->fe, diseqc, adm->old_diseqc != diseqc, ++ send_diseqc(adm->fe2, diseqc, adm->old_diseqc != diseqc, + pol, hiband, &tp->diseqc_param); + adm->old_pol = pol; + adm->old_hiband = hiband; @@ -541,32 +562,30 @@ index 74124fc..5e7acc6 100644 + return 0; + } + input = ((hiband ^ 1) << 1) | (pol ^ 1); -+ adm = get_adapter2(input); ++ adm = use_adapter(input); + if (adm == NULL) { + LOG("axe_fe: unknown master adapter %d", input); + return 0; + } + if(adm->old_pol != pol || adm->old_hiband != hiband) { -+ send_diseqc(adm->fe, 0, 0, pol, hiband, ++ send_diseqc(adm->fe2, 0, 0, pol, hiband, + &tp->diseqc_param); + adm->old_pol = pol; + adm->old_hiband = hiband; + adm->old_diseqc = diseqc = 0; + } + adm->axe_used |= (1 << ad->id); -+ adm->axe_feused = 1; + goto axe; + } + } else { + aid = ad->id & 3; + input = opts.axe_unicinp[aid]; -+ ad = get_adapter2(input); ++ ad = use_adapter(input); + if (ad == NULL) { + LOGL(3, "axe setup: unable to find adapter %d", input); + return 0; + } + ad->axe_used |= (1 << aid); -+ ad->axe_feused = 1; + } +#endif + @@ -576,7 +595,7 @@ index 74124fc..5e7acc6 100644 - &tp->diseqc_param); +#ifdef AXE + if (ad) -+ freq = send_unicable(ad->fe, freq / 1000, diseqc, ++ freq = send_unicable(ad->fe2, freq / 1000, diseqc, + pol, hiband, &tp->diseqc_param); +#else + freq = send_unicable(frontend_fd, freq / 1000, diseqc, @@ -589,7 +608,7 @@ index 74124fc..5e7acc6 100644 - &tp->diseqc_param); +#ifdef AXE + if (ad) -+ freq = send_jess(ad->fe, freq / 1000, diseqc, ++ freq = send_jess(ad->fe2, freq / 1000, diseqc, + pol, hiband, &tp->diseqc_param); +#else + freq = send_jess(frontend_fd, freq / 1000, diseqc, @@ -598,7 +617,7 @@ index 74124fc..5e7acc6 100644 } else if (tp->diseqc_param.switch_type == SWITCH_SLAVE) { -@@ -609,6 +791,17 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) +@@ -609,6 +803,17 @@ int setup_switch(int frontend_fd, adapter *ad, transponder *tp) diseqc); } @@ -616,7 +635,7 @@ index 74124fc..5e7acc6 100644 ad->old_pol = pol; ad->old_hiband = hiband; ad->old_diseqc = diseqc; -@@ -644,6 +837,14 @@ int dvb_tune(int aid, transponder * tp) +@@ -644,6 +849,14 @@ int dvb_tune(int aid, transponder * tp) memset(p_cmd, 0, sizeof(p_cmd)); bclear = getTick(); @@ -631,7 +650,7 @@ index 74124fc..5e7acc6 100644 if ((ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear)) == -1) { LOG("FE_SET_PROPERTY DTV_CLEAR failed for fd %d: %s", fd_frontend, -@@ -663,8 +864,10 @@ int dvb_tune(int aid, transponder * tp) +@@ -663,8 +876,10 @@ int dvb_tune(int aid, transponder * tp) ADD_PROP(DTV_SYMBOL_RATE, tp->sr) ADD_PROP(DTV_INNER_FEC, tp->fec) @@ -642,7 +661,7 @@ index 74124fc..5e7acc6 100644 #if DVBAPIVERSION >= 0x0502 ADD_PROP(DTV_STREAM_ID, tp->plp) #endif -@@ -673,7 +876,12 @@ int dvb_tune(int aid, transponder * tp) +@@ -673,7 +888,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], @@ -656,7 +675,7 @@ index 74124fc..5e7acc6 100644 break; case SYS_DVBT: -@@ -774,29 +982,46 @@ int dvb_tune(int aid, transponder * tp) +@@ -774,29 +994,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)); @@ -708,7 +727,7 @@ index 74124fc..5e7acc6 100644 return -1; } -@@ -822,10 +1047,22 @@ int dvb_set_pid(adapter *a, uint16_t i_pid) +@@ -822,10 +1059,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; @@ -731,7 +750,7 @@ index 74124fc..5e7acc6 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) -@@ -834,10 +1071,20 @@ int dvb_del_filters(int fd, int pid) +@@ -834,10 +1083,20 @@ int dvb_del_filters(int fd, int pid) LOG("clearing filter on PID %d FD %d", pid, fd); close(fd); return 0; @@ -752,7 +771,7 @@ index 74124fc..5e7acc6 100644 int i, res, rv = 0; struct dvb_frontend_info fe_info; -@@ -926,6 +1173,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys) +@@ -926,6 +1185,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; @@ -760,7 +779,7 @@ index 74124fc..5e7acc6 100644 } -@@ -1037,6 +1285,7 @@ void dvb_get_signal(adapter *ad) +@@ -1037,6 +1297,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; @@ -768,7 +787,7 @@ index 74124fc..5e7acc6 100644 if (ad->snr > 4096) new_gs = 0; if (new_gs) -@@ -1049,6 +1298,14 @@ void dvb_get_signal(adapter *ad) +@@ -1049,6 +1310,14 @@ void dvb_get_signal(adapter *ad) ad->strength = ad->strength >> 8; ad->snr = ad->snr >> 8; } @@ -783,7 +802,7 @@ index 74124fc..5e7acc6 100644 } void dvb_commit(adapter *a) -@@ -1056,12 +1313,52 @@ void dvb_commit(adapter *a) +@@ -1056,12 +1325,51 @@ void dvb_commit(adapter *a) return; } @@ -807,7 +826,7 @@ index 74124fc..5e7acc6 100644 + goto nostandby; + for (aid = 0; aid < 4; aid++) { + c = a[aid]; -+ if (opts.axe_power < 2 && c != a2 && busy) ++ if (opts.axe_power < 2 && c != a2 && busy && c->sock >= 0) + continue; + if (c->axe_used != 0 || c->sid_cnt > 0) { + LOG("AXE standby: adapter %d busy (cnt=%d/used=%04x/fe=%d), keeping", @@ -822,7 +841,6 @@ index 74124fc..5e7acc6 100644 + ioctl(c->fe2, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF); + close(c->fe2); + c->fe2 = -1; -+ c->axe_feused = 0; + c->old_diseqc = c->old_pol = c->old_hiband = -1; + } +nostandby: @@ -838,7 +856,7 @@ index 74124fc..5e7acc6 100644 } void find_dvb_adapter(adapter **a) -@@ -1072,9 +1369,21 @@ void find_dvb_adapter(adapter **a) +@@ -1072,9 +1380,21 @@ void find_dvb_adapter(adapter **a) int i = 0, j = 0; adapter *ad; @@ -860,7 +878,7 @@ index 74124fc..5e7acc6 100644 sprintf(buf, "/dev/dvb/adapter%d/frontend%d", i, j); fd = open(buf, O_RDONLY | O_NONBLOCK); if (fd < 0) -@@ -1082,7 +1391,8 @@ void find_dvb_adapter(adapter **a) +@@ -1082,7 +1402,8 @@ void find_dvb_adapter(adapter **a) sprintf(buf, "/dev/dvb/adapter%d/ca%d", i, j); fd = open(buf, O_RDONLY | O_NONBLOCK); } @@ -870,7 +888,7 @@ index 74124fc..5e7acc6 100644 if (fd >= 0) { // if (is_adapter_disabled(na)) -@@ -1113,6 +1423,14 @@ void find_dvb_adapter(adapter **a) +@@ -1113,6 +1434,14 @@ void find_dvb_adapter(adapter **a) if (na == MAX_ADAPTERS) return; }