diff --git a/.gitignore b/.gitignore index 8e8a5b9..ad34b81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /minisatip *.o +*.d config.log config.status Makefile diff --git a/Makefile.in b/Makefile.in index ed8b1e5..f41b772 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,7 @@ LINUXDVB=@LINUXDVB@ AXE=@AXE@ -CFLAGS?=-ggdb -fPIC $(EXTRA_CFLAGS) @CFLAGS@ +CFLAGS?=-Wall -Wno-switch -ggdb -fPIC $(EXTRA_CFLAGS) @CFLAGS@ LDFLAGS?=-lpthread -lrt @LDFLAGS@ OBJS=minisatip.o socketworks.o stream.o adapter.o utils.o @@ -78,7 +78,7 @@ CFLAGS+=-DDISABLE_LINUXDVB OBJS+=dvb.o endif -OBJS-$(AXE) += axe.c +OBJS-$(AXE) += axe.o CFLAGS-$(AXE) += -DAXE @@ -96,14 +96,23 @@ OBJS+=$(OBJS-1) CFLAGS+=$(CFLAGS-1) LDFLAGS+=$(LDFLAGS-1) +DEPS=$(OBJS:.o=.d) -minisatip: $(OBJS) +minisatip: $(DEPS) $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) +%.d : %.c + @$(CC) $(CFLAGS) -MM $(basename $*).c | sed -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@ + %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -c $*.c -o $@ all: minisatip clean: - rm *.o minisatip >> /dev/null + rm *.o *.d minisatip >> /dev/null + +# pull in dependency info for *existing* .o files +ifneq "$(MAKECMDGOALS)" "clean" +-include $(DEPS) +endif diff --git a/adapter.c b/adapter.c index cfb742d..7b8814a 100644 --- a/adapter.c +++ b/adapter.c @@ -65,6 +65,7 @@ adapter *adapter_alloc() { adapter *ad = malloc1(sizeof(adapter)); memset(ad, 0, sizeof(adapter)); + /* diseqc setup */ ad->diseqc_param.fast = opts.diseqc_fast; ad->diseqc_param.committed_no = opts.diseqc_committed_no; @@ -84,14 +85,14 @@ adapter *adapter_alloc() ad->old_pol = -1; ad->dmx_source = -1; ad->slow_dev = opts.nopm; - /* LOF setup */ + ad->diseqc_multi = opts.diseqc_multi; + /* LOF setup */ ad->diseqc_param.lnb_low = opts.lnb_low; ad->diseqc_param.lnb_high = opts.lnb_high; ad->diseqc_param.lnb_circular = opts.lnb_circular; ad->diseqc_param.lnb_switch = opts.lnb_switch; - return ad; } @@ -119,8 +120,7 @@ void find_adapters() // avoid adapter close unless all the adapters can be closed int adapter_timeout(sockets *s) { - int do_close = 1, i; - int64_t rtime = getTick(), max_close = 0; + int do_close = 1; adapter *ad = get_adapter(s->sid); if (!ad) return 1; @@ -187,7 +187,6 @@ int num_adapters = 0; int init_hw(int i) { - char name[100]; int64_t st, et; adapter *ad; if (i < 0 || i >= MAX_ADAPTERS) @@ -291,7 +290,6 @@ int init_hw(int i) get_delsys(ad->sys[0]), get_delsys(ad->sys[1]), get_delsys(ad->sys[2]), get_delsys(ad->sys[3])); -OK: mutex_unlock(&ad->mutex); return 0; @@ -303,7 +301,6 @@ NOK: int init_all_hw() { int i, rv; - char name[50]; LOG("starting init_all_hw %d", init_complete); if (init_complete) @@ -385,11 +382,10 @@ int close_adapter(int na) int getAdaptersCount() { - int i, j, k; - char sys; + int i, j, k, sys; adapter *ad; - char fes[20][MAX_ADAPTERS]; - char ifes[20]; + int fes[20][MAX_ADAPTERS]; + int ifes[20]; char order[] = { SYS_DVBS2, SYS_DVBT, SYS_DVBC_ANNEX_A, SYS_DVBT2, SYS_DVBC2 }; @@ -701,7 +697,6 @@ int tune(int aid, int sid) { adapter *ad = get_adapter(aid); int rv = 0, flush_data = 0; - SPid *p; if (!ad) return -400; @@ -939,7 +934,6 @@ int mark_pids_add(int sid, int aid, char *pids) int compare_tunning_parameters(int aid, transponder * tp) { - int same = 0; adapter *ad = get_adapter(aid); if (!ad) return -1; @@ -1075,7 +1069,7 @@ char* get_stream_pids(int s_id, char *dest, int max_size); char * describe_adapter(int sid, int aid, char *dad, int ld) { - int i = 0, ts, j, use_ad, len; + int use_ad, len; transponder *t; adapter *ad; streams *ss; @@ -1095,7 +1089,7 @@ describe_adapter(int sid, int aid, char *dad, int ld) } else t = &ad->tp; - memset(dad, 0, sizeof(dad)); + memset(dad, 0, ld); if (use_ad) { @@ -1336,6 +1330,51 @@ void set_diseqc_adapters(char *o) } } +void set_diseqc_multi(char *o) +{ + int i, la, a_id, position; + char buf[100], *arg[20], *sep1; + adapter *ad; + strncpy(buf, o, sizeof(buf)); + la = split(arg, buf, sizeof(arg), ','); + for (i = 0; i < la; i++) + { + if (arg[i] && arg[i][0] == '*') + { + ad = NULL; + a_id = -1; + } + else + { + a_id = map_intd(arg[i], NULL, -1); + if (a_id < 0 || a_id >= MAX_ADAPTERS) + continue; + + if (!a[a_id]) + a[a_id] = adapter_alloc(); + ad = a[a_id]; + } + + sep1 = strchr(arg[i], ':'); + + if (!sep1) + continue; + position = map_intd(sep1 + 1, NULL, -1); + if (position < 0) + continue; + if (ad) + { + ad->diseqc_multi = position; + } + else + { + opts.diseqc_multi = position; + } + LOGL(0, + "Setting diseqc multi adapter %d position %d", + a_id, position); + } +} void set_lnb_adapters(char *o) { @@ -1407,7 +1446,7 @@ void set_diseqc_timing(char *o) int before_cmd, after_cmd, after_repeated_cmd; int after_switch, after_burst, after_tone; char buf[2000], *arg[20]; - char *sep1, *sep2, *sep3, *sep4, *sep5, *sep6, *sep7; + char *sep1, *sep2, *sep3, *sep4, *sep5, *sep6; adapter *ad; strncpy(buf, o, sizeof(buf)); la = split(arg, buf, sizeof(arg), ','); @@ -1553,7 +1592,7 @@ void set_nopm_adapters(char *o) extern char *fe_delsys[]; void set_adapters_delsys(char *o) { - int i, j, la, a_id, ds; + int i, la, a_id, ds; char buf[100], *arg[20], *sep; adapter *ad; strncpy(buf, o, sizeof(buf)); @@ -1655,7 +1694,6 @@ int signal_thread(sockets *s) int i; int64_t ts, ctime; adapter *ad; - int status; for (i = 0; i < MAX_ADAPTERS; i++) if ((ad = get_adapter_nw(i)) && ad->get_signal && ad->tp.freq && (ad->status_cnt++ > 2) // make sure the kernel has updated the status @@ -1876,9 +1914,9 @@ _symbols adapters_sym[] = { "ad_sys", VAR_AARRAY_INT, a, 1, MAX_ADAPTERS, offsetof( adapter, tp.sys) }, { "ad_allsys", VAR_FUNCTION_STRING, (void *) &get_all_delsys, 0, - 0, 0 }, + MAX_ADAPTERS, 0 }, { "ad_pids", VAR_FUNCTION_STRING, (void *) &get_adapter_pids, 0, - 0, 0 }, + MAX_ADAPTERS, 0 }, { "tuner_s2", VAR_INT, &tuner_s2, 1, 0, 0 }, { "tuner_t2", VAR_INT, &tuner_t2, 1, 0, 0 }, { "tuner_c2", VAR_INT, &tuner_c2, 1, 0, 0 }, diff --git a/adapter.h b/adapter.h index 375a820..0445820 100755 --- a/adapter.h +++ b/adapter.h @@ -53,6 +53,7 @@ typedef int (*Del_filters)(int fd, int pid); typedef int (*Adapter_commit)(void *ad); typedef int (*Open_device)(void *ad); typedef int (*Device_signal)(void *ad); +typedef int (*Device_wakeup)(void *ad, int fd, int voltage); typedef int (*Tune)(int aid, transponder * tp); typedef fe_delivery_system_t (*Dvb_delsys)(int aid, int fd, fe_delivery_system_t *sys); @@ -99,6 +100,7 @@ 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 diseqc_multi; int old_diseqc; int old_hiband; int old_pol; @@ -115,6 +117,7 @@ typedef struct struct_adapter Tune tune; Dvb_delsys delsys; Device_signal get_signal; + Device_wakeup wakeup; Adapter_commit post_init, close; } adapter; @@ -147,6 +150,7 @@ void enable_adapters(char *o); void set_unicable_adapters(char *o, int type); void set_diseqc_adapters(char *o); void set_diseqc_timing(char *o); +void set_diseqc_multi(char *o); void set_slave_adapters(char *o); void set_nopm_adapters(char *o); void set_adapter_dmxsource(char *o); diff --git a/axe.c b/axe.c index 486b2f8..b77b62d 100755 --- a/axe.c +++ b/axe.c @@ -47,10 +47,7 @@ #ifndef DISABLE_LINUXDVB extern struct struct_opts opts; -int dvb_tune(int aid, transponder * tp); -int setup_switch(adapter *ad); -void get_signal(int fd, int * status, uint32_t * ber, uint16_t * strength, - uint16_t * snr); +void get_signal(int fd, uint32_t * status, uint32_t * ber, uint16_t * strength, uint16_t * snr); int send_jess(adapter *ad, int fd, int freq, int pos, int pol, int hiband, diseqc *d); int send_unicable(adapter *ad, int fd, int freq, int pos, int pol, int hiband, diseqc *d); int send_diseqc(adapter *ad, int fd, int pos, int pos_change, int pol, int hiband, diseqc *d); @@ -107,6 +104,8 @@ void axe_set_network_led(int on) int axe_read(int socket, void *buf, int len, sockets *ss, int *rv) { *rv = read(socket, buf, len); + if (len == *rv) + LOGL(3, "AXE: MAX READ %d", len); // if(*rv < 0 || *rv == 0 || errno == -EAGAIN) if(*rv < 0 || *rv == 0 || errno == -EAGAIN) { @@ -155,7 +154,7 @@ void axe_post_init(adapter *ad) } -void axe_wakeup(int fe_fd, int voltage) +void axe_wakeup(void *_ad, int fe_fd, int voltage) { int i, mask; adapter *a; @@ -270,7 +269,7 @@ int axe_setup_switch(adapter *ad) } adapter *ad2, *adm; - int input = 0, src, aid, pos = 0, equattro = 0, master = -1; + int input = 0, aid, pos = 0, equattro = 0, master = -1; if (tp->diseqc_param.switch_type != SWITCH_UNICABLE && tp->diseqc_param.switch_type != SWITCH_JESS) { @@ -341,7 +340,7 @@ int axe_setup_switch(adapter *ad) input = master; if (!tune_check(adm, pol, hiband, diseqc)) { send_diseqc(adm, adm->fe2, diseqc, adm->old_diseqc != diseqc, - pol, hiband, &tp->diseqc_param); + pol, hiband, &tp->diseqc_param); adm->old_pol = pol; adm->old_hiband = hiband; adm->old_diseqc = diseqc; @@ -385,18 +384,35 @@ int axe_setup_switch(adapter *ad) }else ad->axe_used |= (1 << aid); - LOG("adapter %d: using source %d, fe %d fe2 %d", ad->id, input, ad->fe, ad->fe2); + LOG("adapter %d: using source %d, fe %d fe2 %d", + ad->id, input, ad->fe, ad->fe2); } if (tp->diseqc_param.switch_type == SWITCH_UNICABLE) { freq = send_unicable(ad, ad->fe2, freq / 1000, diseqc, - pol, hiband, &tp->diseqc_param); + pol, hiband, &tp->diseqc_param); } else if (tp->diseqc_param.switch_type == SWITCH_JESS) { freq = send_jess(ad, ad->fe2, freq / 1000, diseqc, - pol, hiband, &tp->diseqc_param); + pol, hiband, &tp->diseqc_param); + } + else if (tp->diseqc_param.switch_type == SWITCH_SLAVE) + { + LOGL(2, "FD %d (%d) is a slave adapter", frontend_fd); + } + else + { + if (ad->old_pol != pol || ad->old_hiband != hiband + || ad->old_diseqc != diseqc) + send_diseqc(ad, frontend_fd, diseqc, ad->old_diseqc != diseqc, pol, + hiband, &tp->diseqc_param); + 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); } ad->old_pol = pol; @@ -415,30 +431,154 @@ axe: LOG("axe_fe: RESET failed for fd %d: %s", frontend_fd, strerror(errno)); if (axe_fe_input(frontend_fd, input)) LOG("axe_fe: INPUT failed for fd %d input %d: %s", frontend_fd, input, strerror(errno)); - if (opts.quattro) - return freq; return freq; } +#define ADD_PROP(c, d) { \ + p_cmd[iProp].cmd = (c); \ + p_cmd[iProp].u.data = (d); \ + iProp++; \ +} int axe_tune(int aid, transponder * tp) { adapter *ad = get_adapter(aid); - ssize_t drv; char buf[1316]; + + int64_t bclear, bpol; + int iProp = 0; + int fd_frontend = ad->fe; + + int freq = tp->freq; + struct dtv_property p_cmd[20]; + struct dtv_properties p = + { .num = 0, .props = p_cmd }; + struct dvb_frontend_event ev; + + struct dtv_property p_clear[] = + { + { .cmd = DTV_CLEAR }, + }; + + struct dtv_properties cmdseq_clear = + { .num = 1, .props = p_clear }; + axe_set_tuner_led(aid + 1, 1); axe_dmxts_stop(ad->dvr); axe_fe_reset(ad->fe); //probably can be removed - do { drv = read(ad->dvr, buf, sizeof(buf)); } while (drv > 0); - return dvb_tune(aid, tp); + memset(p_cmd, 0, sizeof(p_cmd)); + bclear = getTick(); + if ((ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear)) == -1) + { + LOG("FE_SET_PROPERTY DTV_CLEAR failed for fd %d: %s", fd_frontend, + strerror(errno)); + // return -1; + } + + switch (tp->sys) + { + case SYS_DVBS: + case SYS_DVBS2: + + bpol = getTick(); + freq = axe_setup_switch(ad); + if (freq < MIN_FRQ_DVBS || freq > MAX_FRQ_DVBS) + LOG_AND_RETURN(-404, "Frequency %d is not within range ", freq) + + ADD_PROP(DTV_SYMBOL_RATE, tp->sr) + ADD_PROP(DTV_INNER_FEC, tp->fec) +#if DVBAPIVERSION >= 0x0502 + ADD_PROP(DTV_STREAM_ID, tp->plp) +#endif + + LOG("tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%jd, ts pol=%jd", + tp->freq, freq, get_pol(tp->pol), tp->pol, tp->sr, + fe_fec[tp->fec], fe_delsys[tp->sys], fe_modulation[tp->mtype], + "auto", "auto", + bclear, bpol) + break; + + case SYS_DVBT: + case SYS_DVBT2: + + if (tp->freq < MIN_FRQ_DVBT || tp->freq > MAX_FRQ_DVBT) + LOG_AND_RETURN(-404, "Frequency %d is not within range ", tp->freq) + + freq = freq * 1000; + ADD_PROP(DTV_BANDWIDTH_HZ, tp->bw) + ADD_PROP(DTV_CODE_RATE_HP, tp->fec) + ADD_PROP(DTV_CODE_RATE_LP, tp->fec) + ADD_PROP(DTV_GUARD_INTERVAL, tp->gi) + ADD_PROP(DTV_TRANSMISSION_MODE, tp->tmode) + ADD_PROP(DTV_HIERARCHY, HIERARCHY_AUTO) +#if DVBAPIVERSION >= 0x0502 + ADD_PROP(DTV_STREAM_ID, tp->plp & 0xFF) +#endif + + LOG( + "tuning to %d delsys: %s bw:%d inversion:%s mod:%s fec:%s guard:%s transmission: %s, ts clear = %jd", + freq, fe_delsys[tp->sys], tp->bw, fe_specinv[tp->inversion], + fe_modulation[tp->mtype], fe_fec[tp->fec], fe_gi[tp->gi], + fe_tmode[tp->tmode], bclear) + break; + + case SYS_DVBC2: + case SYS_DVBC_ANNEX_A: + + if (tp->freq < MIN_FRQ_DVBC || tp->freq > MAX_FRQ_DVBC) + LOG_AND_RETURN(-404, "Frequency %d is not within range ", tp->freq) + + freq = freq * 1000; + ADD_PROP(DTV_SYMBOL_RATE, tp->sr) +#if DVBAPIVERSION >= 0x0502 + ADD_PROP(DTV_STREAM_ID, ((tp->ds & 0xFF) << 8) | (tp->plp & 0xFF)) +#endif + // valid for DD DVB-C2 devices + + LOG("tuning to %d sr:%d specinv:%s delsys:%s mod:%s ts clear = %jd", + freq, tp->sr, fe_specinv[tp->inversion], fe_delsys[tp->sys], + fe_modulation[tp->mtype], bclear) + break; + + default: + LOG("tuning to unknown delsys: %s freq %s ts clear = %jd", freq, + fe_delsys[tp->sys], bclear) + break; + } + + ADD_PROP(DTV_FREQUENCY, freq) + ADD_PROP(DTV_INVERSION, tp->inversion) + ADD_PROP(DTV_MODULATION, tp->mtype); + ADD_PROP(DTV_DELIVERY_SYSTEM, tp->sys); + ADD_PROP(DTV_TUNE, 0) + + p.num = iProp; + /* discard stale QPSK events */ + while (1) + { + if (ioctl(fd_frontend, FE_GET_EVENT, &ev) == -1) + break; + } + + if ((ioctl(fd_frontend, FE_SET_PROPERTY, &p)) == -1) + if (ioctl(fd_frontend, FE_SET_PROPERTY, &p) == -1) + { + LOG("dvb_tune: set property failed %d %s", errno, strerror(errno)); + axe_set_tuner_led(aid + 1, 0); + return -404; + } + + axe_dmxts_start(ad->dvr); + return 0; } + int axe_set_pid(adapter *a, uint16_t i_pid) { if (i_pid > 8192 || a == NULL) @@ -597,6 +737,7 @@ void find_axe_adapter(adapter **a) ad->post_init = (Adapter_commit) axe_post_init; ad->close = (Adapter_commit) axe_close; ad->get_signal = (Device_signal) axe_get_signal; + ad->wakeup = (Device_wakeup) axe_wakeup; ad->type = ADAPTER_DVB; close(fd); na++; @@ -622,7 +763,7 @@ void free_axe_input(adapter *ad) adapter *ad2; for (aid = 0; aid < 4; aid++) { - ad2 = get_adapter(aid); + ad2 = get_configured_adapter(aid); if(ad2) ad2->axe_used &= ~(1 << ad->id); } @@ -715,7 +856,6 @@ adapter *axe_vdevice_sync(int aid) char buf[1024], *p; int64_t t; uint32_t addr, pktc, syncerrc, tperrc, ccerr; - int fd; if (!ad) return NULL; @@ -770,9 +910,9 @@ char *get_axe_coax(int aid, char *dest, int max_size) _symbols axe_sym[] = { - { "ad_axe_pktc", VAR_FUNCTION_INT64, (void *) &get_axe_pktc, 0, 0, 0 }, - { "ad_axe_ccerr", VAR_FUNCTION_INT64, (void *) &get_axe_ccerr, 0, 0, 0 }, - { "ad_axe_coax", VAR_FUNCTION_STRING, (void *) &get_axe_coax, 0, 0, 0 }, + { "ad_axe_pktc", VAR_FUNCTION_INT64, (void *) &get_axe_pktc, 0, MAX_ADAPTERS, 0 }, + { "ad_axe_ccerr", VAR_FUNCTION_INT64, (void *) &get_axe_ccerr, 0, MAX_ADAPTERS, 0 }, + { "ad_axe_coax", VAR_FUNCTION_STRING, (void *) &get_axe_coax, 0, MAX_ADAPTERS, 0 }, { NULL, 0, NULL, 0, 0 } }; diff --git a/axe.h b/axe.h index af35a61..46ce50c 100644 --- a/axe.h +++ b/axe.h @@ -97,7 +97,7 @@ static inline int axe_dmxts_stop(int fd) void axe_set_tuner_led(int tuner, int on); void axe_set_network_led(int on); void axe_status(char *buf, size_t buflen); -void axe_wakeup(int fe_fd, int voltage); +void axe_wakeup(void *ad, int fe_fd, int voltage); void find_axe_adapter(adapter **a); int axe_setup_switch(adapter *ad); void free_axe_input(adapter *ad); diff --git a/dvb.c b/dvb.c index 15f59c8..a38e5ef 100644 --- a/dvb.c +++ b/dvb.c @@ -42,10 +42,6 @@ #include "ca.h" #include "utils.h" -#ifdef AXE -#include "axe.h" -#endif - char *fe_pilot[] = { "on", "off", " ", //auto NULL }; @@ -417,6 +413,11 @@ int send_diseqc(adapter *ad, int fd, int pos, int pos_change, int pol, int hiban { 0xe0, 0x10, 0x39, 0xf0, 0x00, 0x00 }, 4 }; + if (pos_change && ad->diseqc_multi >= 0 && pos != ad->diseqc_multi) { + send_diseqc(ad, fd, ad->diseqc_multi, 1, pol, hiband, d); + pos_change = 1; + } + if (uncommitted_no > committed_no) uncommitted_first = 1; @@ -436,9 +437,8 @@ int send_diseqc(adapter *ad, int fd, int pos, int pos_change, int pol, int hiban LOGL(3, "send_diseqc fd %d, pos = %d (c %d u %d), pol = %d, hiband = %d", fd, pos, posc, posu, pol, hiband); -#ifdef AXE - axe_wakeup(fd, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13); -#endif + if (ad->wakeup) + ad->wakeup(ad, fd, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13); if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd, @@ -504,9 +504,8 @@ int send_unicable(adapter *ad, int fd, int freq, int pos, int pol, int hiband, d "send_unicable fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); -#ifdef AXE - axe_wakeup(fd, SEC_VOLTAGE_13); -#endif + if (ad->wakeup) + ad->wakeup(ad, fd, SEC_VOLTAGE_13); if(!ad->tune_time) { if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) @@ -551,14 +550,12 @@ int send_jess(adapter *ad, int fd, int freq, int pos, int pol, int hiband, diseq cmd.msg[4] = d->pin; } - LOGL(3, - "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", - fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], - cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); + LOGL(3, "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", + fd, freq, d->ufreq, pos, pol, hiband, d->uslot, cmd.msg[0], + cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); -#ifdef AXE - axe_wakeup(fd, SEC_VOLTAGE_13); -#endif + if (ad->wakeup) + ad->wakeup(ad, fd, SEC_VOLTAGE_13); if(!ad->tune_time) { @@ -609,23 +606,13 @@ int setup_switch(adapter *ad) if (tp->diseqc_param.switch_type == SWITCH_UNICABLE) { -#ifdef AXE - freq = send_unicable(ad, ad->fe2, freq / 1000, diseqc, pol, hiband, - &tp->diseqc_param); -#else - freq = send_unicable(ad, frontend_fd, freq / 1000, diseqc, pol, hiband, - &tp->diseqc_param); -#endif + freq = send_unicable(ad, frontend_fd, freq / 1000, diseqc, + pol, hiband, &tp->diseqc_param); } else if (tp->diseqc_param.switch_type == SWITCH_JESS) { -#ifdef AXE - freq = send_jess(ad, ad->fe2, freq / 1000, diseqc, pol, hiband, - &tp->diseqc_param); -#else - freq = send_jess(ad, frontend_fd, freq / 1000, diseqc, pol, hiband, - &tp->diseqc_param); -#endif + freq = send_jess(ad, frontend_fd, freq / 1000, diseqc, + pol, hiband, &tp->diseqc_param); } else if (tp->diseqc_param.switch_type == SWITCH_SLAVE) { @@ -639,9 +626,9 @@ int setup_switch(adapter *ad) hiband, &tp->diseqc_param); 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); + "the switch position doesn't need to be changed: " + "pol %d, hiband %d, switch position %d", + pol, hiband, diseqc); } ad->old_pol = pol; @@ -694,35 +681,24 @@ int dvb_tune(int aid, transponder * tp) case SYS_DVBS2: bpol = getTick(); -#ifndef AXE freq = setup_switch(ad); -#else - freq = axe_setup_switch(ad); -#endif if (freq < MIN_FRQ_DVBS || freq > MAX_FRQ_DVBS) LOG_AND_RETURN(-404, "Frequency %d is not within range ", freq) - ADD_PROP(DTV_SYMBOL_RATE, tp->sr) + ADD_PROP(DTV_SYMBOL_RATE, tp->sr) ADD_PROP(DTV_INNER_FEC, tp->fec) -#ifndef AXE - ADD_PROP(DTV_PILOT, tp->plts) - ADD_PROP(DTV_ROLLOFF, tp->ro) -#endif + ADD_PROP(DTV_PILOT, tp->plts) + ADD_PROP(DTV_ROLLOFF, tp->ro) #if DVBAPIVERSION >= 0x0502 - ADD_PROP(DTV_STREAM_ID, tp->plp) + ADD_PROP(DTV_STREAM_ID, tp->plp) #endif - LOG( - "tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%jd, ts pol=%jd", - tp->freq, freq, get_pol(tp->pol), tp->pol, tp->sr, - fe_fec[tp->fec], fe_delsys[tp->sys], fe_modulation[tp->mtype], -#ifdef AXE - "auto", "auto", -#else - fe_rolloff[tp->ro], fe_pilot[tp->plts], -#endif - bclear, bpol) - break; + LOG("tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%jd, ts pol=%jd", + tp->freq, freq, get_pol(tp->pol), tp->pol, tp->sr, + fe_fec[tp->fec], fe_delsys[tp->sys], fe_modulation[tp->mtype], + fe_rolloff[tp->ro], fe_pilot[tp->plts], + bclear, bpol) + break; case SYS_DVBT: case SYS_DVBT2: @@ -799,7 +775,7 @@ int dvb_tune(int aid, transponder * tp) break; default: - LOG("tuninng to unknown delsys: %s freq %s ts clear = %jd", freq, + LOG("tuning to unknown delsys: %s freq %s ts clear = %jd", freq, fe_delsys[tp->sys], bclear) break; } @@ -822,14 +798,8 @@ 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)); -#ifdef AXE - axe_set_tuner_led(aid + 1, 0); -#endif return -404; } -#ifdef AXE - axe_dmxts_start(ad->dvr); -#endif return 0; } @@ -984,7 +954,7 @@ fe_delivery_system_t dvb_delsys(int aid, int fd, fe_delivery_system_t *sys) } -void get_signal(int fd, int * status, uint32_t * ber, uint16_t * strength, +void get_signal(int fd, uint32_t * status, uint32_t * ber, uint16_t * strength, uint16_t * snr) { *status = *ber = *snr = *strength = 0; @@ -1009,7 +979,7 @@ void get_signal(int fd, int * status, uint32_t * ber, uint16_t * strength, } } -int get_signal_new(int fd, int * status, uint32_t * ber, uint16_t * strength, +int get_signal_new(int fd, uint32_t * status, uint32_t * ber, uint16_t * strength, uint16_t * snr) { diff --git a/dvb.h b/dvb.h index ae3991e..26a67d2 100644 --- a/dvb.h +++ b/dvb.h @@ -241,4 +241,11 @@ char *get_gi(int i); char *get_specinv(int i); char *get_pol(int i); +extern char *fe_delsys[]; +extern char *fe_fec[]; +extern char *fe_tmode[]; +extern char *fe_modulation[]; +extern char *fe_specinv[]; +extern char *fe_gi[]; + #endif /* */ diff --git a/html/sort_desc.png b/html/sort_desc.png new file mode 100644 index 0000000..0e156de Binary files /dev/null and b/html/sort_desc.png differ diff --git a/html/status.html b/html/status.html index 8d2f6e5..812a13d 100755 --- a/html/status.html +++ b/html/status.html @@ -2,7 +2,7 @@ - Minisatip/$version$ on $http_host$ + Minisatip status @@ -58,201 +66,204 @@ -
Refresh: + + + +
Refresh: sec. - + + + + + +
+ +