From e5ba7e0e43f2c9bfc67bbb303f689305e6d2d0dc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 14 Apr 2015 21:22:23 +0200 Subject: [PATCH] updated minisatip (LED setup, DVR buffer flush), increased dmesg kernel buffer, added axe-debug script --- fs-add/etc/init.d/rcS | 3 ++ fs-add/sbin/axe-debug | 55 ++++++++++++++++++++++++++ kernel/arch/sh/configs/idl4k_defconfig | 2 +- patches/kernel.config | 2 +- patches/minisatip-axe.patch | 48 +++++++++++++--------- 5 files changed, 90 insertions(+), 20 deletions(-) create mode 100755 fs-add/sbin/axe-debug diff --git a/fs-add/etc/init.d/rcS b/fs-add/etc/init.d/rcS index 414713c8..4d2defd0 100755 --- a/fs-add/etc/init.d/rcS +++ b/fs-add/etc/init.d/rcS @@ -59,6 +59,7 @@ d=/lib/modules/axe insmod $d/stapi_core_stripped.ko insmod $d/stapi_ioctl_stripped.ko insmod $d/axe_i2c.ko +echo "i2c_dbg_trans 1" > /proc/bus/ivo_i2c insmod $d/axe_fe.ko insmod $d/axe_fp.ko insmod $d/axe_dmx.ko @@ -102,8 +103,10 @@ for i in $(cat /proc/devices); do done /etc/init.d/axe & axehelper wait 5000 -10 /tmp/axe-done +axehelper wait 2000 -10 #nc -l 127.0.0.1:1001 -e /bin/true rm -f /root/main_init.sh /tmp/axe-done +echo "i2c_dbg_trans 0" > /proc/bus/ivo_i2c # hostname test -r /etc/sysconfig/config && . /etc/sysconfig/config diff --git a/fs-add/sbin/axe-debug b/fs-add/sbin/axe-debug new file mode 100755 index 00000000..fb8baf06 --- /dev/null +++ b/fs-add/sbin/axe-debug @@ -0,0 +1,55 @@ +#!/bin/sh + +show_help() { + echo "AXE debug script, commands:" + echo " tuner [0x] : enable tuner (fe) debug" + echo " i2c : enable i2c debug" + echo " off : all debug off" + echo " reset : reset all tuners and kill (restart) minisatip" + echo " pti [dmesg|pid|util|pdev|vdev] [num0-3]" +} + +case "$1" in +tuner) + val1="$2" + test -z "$val1" && val1="0xffffffff" + echo "Enabling tuner debug $val1" + echo "deb $val1" > /proc/bus/nim_sockets + ;; +i2c) + if test -z "$2"; then + echo "Enabling i2c debug" + echo "i2c_dbg_trans 1" > /proc/bus/ivo_i2c + fi + ;; +off) + echo "Disabling kernel driver debug" + echo "deb 0" > /proc/bus/nim_sockets + echo "i2c_dbg_trans 0" > /proc/bus/ivo_i2c + ;; +reset) + echo "Reset all tuners" + echo "i2c_dbg_trans 1" > /proc/bus/ivo_i2c + echo "res" > /proc/bus/nim_sockets + sleep 10 + echo "i2c_dbg_trans 0" > /proc/bus/ivo_i2c + killall -9 minisatip + ;; +pti) + cmd="$2" + test -z "$cmd" && cmd=vdev + num="$3" + test -z "$num" && num=0 + noex="AAAAAAAAAABBBBBBBBB" + d="/proc/STAPI/stpti/PTI$num" + case "$cmd" in + dmesg) grep -v $noex $d/PrintBuffer ;; + pid) grep -v $noex $d/PIDTable ;; + util) while [ 1 -eq 1 ]; do grep -v $noex $d/UtilisationTP ; sleep 0.2; done ;; + pdev) while [ 1 -eq 1 ]; do grep -v $noex $d/pDevice ; sleep 0.2 ; done ;; + vdev) while [ 1 -eq 1 ]; do grep -v $noex $d/vDeviceInfo ; sleep 0.2 ; done ;; + esac + ;; +*) + show_help +esac diff --git a/kernel/arch/sh/configs/idl4k_defconfig b/kernel/arch/sh/configs/idl4k_defconfig index 5ac81ddb..93659ef4 100644 --- a/kernel/arch/sh/configs/idl4k_defconfig +++ b/kernel/arch/sh/configs/idl4k_defconfig @@ -70,7 +70,7 @@ CONFIG_RCU_FANOUT=32 # CONFIG_RCU_FANOUT_EXACT is not set # CONFIG_TREE_RCU_TRACE is not set # CONFIG_IKCONFIG is not set -CONFIG_LOG_BUF_SHIFT=14 +CONFIG_LOG_BUF_SHIFT=20 # CONFIG_CGROUPS is not set # CONFIG_SYSFS_DEPRECATED_V2 is not set CONFIG_RELAY=y diff --git a/patches/kernel.config b/patches/kernel.config index 5ac81ddb..93659ef4 100644 --- a/patches/kernel.config +++ b/patches/kernel.config @@ -70,7 +70,7 @@ CONFIG_RCU_FANOUT=32 # CONFIG_RCU_FANOUT_EXACT is not set # CONFIG_TREE_RCU_TRACE is not set # CONFIG_IKCONFIG is not set -CONFIG_LOG_BUF_SHIFT=14 +CONFIG_LOG_BUF_SHIFT=20 # CONFIG_CGROUPS is not set # CONFIG_SYSFS_DEPRECATED_V2 is not set CONFIG_RELAY=y diff --git a/patches/minisatip-axe.patch b/patches/minisatip-axe.patch index 7359d1c0..13ee1ca5 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..ebc7694 100755 +index 285faea..f71ac85 100755 --- a/adapter.c +++ b/adapter.c @@ -29,10 +29,15 @@ @@ -107,7 +107,7 @@ index 285faea..ebc7694 100755 sockets_timeout (a[i].sock, 60000); LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys); -@@ -194,6 +226,24 @@ close_adapter (int na) +@@ -194,6 +226,26 @@ close_adapter (int na) mark_pids_deleted (na, -1, NULL); update_pids (na); // if(a[na].dmx>0)close(a[na].dmx); @@ -121,6 +121,7 @@ index 285faea..ebc7694 100755 + LOG("AXE standby"); + for (i = 0; i < 4; i++) { + axe_fe_standby(a[i].fe, -1); ++ axe_set_tuner_led(i + 1, 0); + ioctl(a[i].fe, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF); + a[i].tp.old_diseqc = a[i].tp.old_pol = a[i].tp.old_hiband = -1; + } @@ -128,11 +129,12 @@ index 285faea..ebc7694 100755 + LOG("AXE standby: adapter %d busy (%d), keeping", i, a[i].sid_cnt); + } + } ++ axe_set_tuner_led(na + 1, 0); +#endif if (a[na].fe > 0) close (a[na].fe); if (a[na].sock >= 0) -@@ -366,8 +416,8 @@ close_adapter_for_stream (int sid, int aid) +@@ -366,8 +418,8 @@ close_adapter_for_stream (int sid, int aid) // delete the attached PIDs as well mark_pids_deleted (aid, sid, NULL); update_pids (aid); @@ -143,16 +145,20 @@ index 285faea..ebc7694 100755 } -@@ -410,7 +460,7 @@ update_pids (int aid) +@@ -410,7 +462,11 @@ update_pids (int aid) int tune (int aid, int sid) { adapter *ad = get_adapter(aid); - int i, rv = 0; + int rv = 0; ++#ifdef AXE ++ ssize_t drv; ++ char buf[1316]; ++#endif if(!ad) return -400; ad->last_sort = getTick (); -@@ -419,7 +469,10 @@ int tune (int aid, int sid) +@@ -419,7 +475,12 @@ int tune (int aid, int sid) ad->tp.switch_type = ad->switch_type; ad->tp.uslot = ad->uslot; ad->tp.ufreq = ad->ufreq; @@ -160,22 +166,25 @@ index 285faea..ebc7694 100755 + +#ifdef AXE + axe_set_tuner_led(aid + 1, 1); ++ axe_fe_reset(ad->fe); ++ do { drv = read(ad->dvr, buf, sizeof(buf)); } while (drv > 0); +#endif rv = tune_it_s2 (ad->fe, &ad->tp); a[aid].status = 0; a[aid].status_cnt = 0; -@@ -428,6 +481,10 @@ int tune (int aid, int sid) +@@ -428,6 +489,11 @@ int tune (int aid, int sid) close_streams_for_adapter (aid, sid); update_pids (aid); } +#ifdef AXE ++ //do { drv = read(ad->dvr, buf, sizeof(buf)); } while (drv > 0); + 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 +741,11 @@ describe_adapter (int sid, int aid) +@@ -684,7 +750,11 @@ describe_adapter (int sid, int aid) memset (dad, 0, sizeof (dad)); x = 0; // do just max 3 signal check 1s after tune @@ -187,7 +196,7 @@ index 285faea..ebc7694 100755 { int new_gs = 1; ts = getTick (); -@@ -701,11 +762,20 @@ describe_adapter (int sid, int aid) +@@ -701,11 +771,20 @@ describe_adapter (int sid, int aid) 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)", 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); @@ -208,7 +217,7 @@ index 285faea..ebc7694 100755 } if(use_ad) { -@@ -715,14 +785,14 @@ describe_adapter (int sid, int aid) +@@ -715,14 +794,14 @@ describe_adapter (int sid, int aid) } 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=", @@ -226,7 +235,7 @@ index 285faea..ebc7694 100755 t->c2tft, t->ds, t->plp, t->inversion); for (i = 0; i < MAX_PIDS; i++) if (use_ad && ad->pids[i].flags == 1) -@@ -825,7 +895,7 @@ void enable_adapters(char *o) +@@ -825,7 +904,7 @@ void enable_adapters(char *o) void set_unicable_adapters(char *o, int type) { @@ -235,7 +244,7 @@ index 285faea..ebc7694 100755 char buf[100], *arg[20], *sep1, *sep2; strncpy(buf, o, sizeof(buf)); -@@ -839,17 +909,46 @@ void set_unicable_adapters(char *o, int type) +@@ -839,17 +918,46 @@ void set_unicable_adapters(char *o, int type) sep2 = strchr(arg[i], '-'); if( !sep1 || !sep2) continue; @@ -305,10 +314,10 @@ index 629bd9c..d95e59a 100755 diff --git a/axe.h b/axe.h new file mode 100644 -index 0000000..4c62d86 +index 0000000..46e8b02 --- /dev/null +++ b/axe.h -@@ -0,0 +1,113 @@ +@@ -0,0 +1,116 @@ +#ifndef __AXE_H +#define __AXE_H + @@ -396,12 +405,15 @@ index 0000000..4c62d86 + +void axe_set_tuner_led(int tuner, int on) +{ -+ static int state = -1; ++ static int state = 0; + char buf[16]; -+ if (state != on) { ++ if (((state >> tuner) & 1) != !!on) { + sprintf(buf, "T%d_LED %d\n", tuner, on ? 1 : 0); + axe_fp_fd_write(buf); -+ state = on; ++ if (on) ++ state |= 1 << tuner; ++ else ++ state &= ~(1 << tuner); + } +} + @@ -781,7 +793,7 @@ index 5701bd2..32fd683 100755 } diff --git a/minisatip.c b/minisatip.c -index d4076ba..3203b5a 100755 +index d4076ba..baf14ab 100755 --- a/minisatip.c +++ b/minisatip.c @@ -36,6 +36,7 @@ @@ -813,7 +825,7 @@ index d4076ba..3203b5a 100755 opts.bootid = 0; opts.force_scan = 0; - opts.dvr = DVR_BUFFER; -+ opts.dvr = 70*7*DVB_FRAME; ++ opts.dvr = 14*7*DVB_FRAME; opts.file_line = 0; memset(opts.playlist, sizeof(opts.playlist), 0);