aboutsummaryrefslogtreecommitdiffstats
path: root/package/ltq-tapidemo/files/bringup_tapidemo
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2011-02-01 14:32:25 +0000
committerJohn Crispin <john@openwrt.org>2011-02-01 14:32:25 +0000
commitfd551c1fa7526aca631a07f0fd3134433c9fa5fe (patch)
tree1b6db352842d684f7cbd478a2dbc1724d09cdfe5 /package/ltq-tapidemo/files/bringup_tapidemo
parent79b3d8f69aa02e2dc80f04a1ac84e971a2a33f8b (diff)
downloadupstream-fd551c1fa7526aca631a07f0fd3134433c9fa5fe.tar.gz
upstream-fd551c1fa7526aca631a07f0fd3134433c9fa5fe.tar.bz2
upstream-fd551c1fa7526aca631a07f0fd3134433c9fa5fe.zip
* rename voice package * sync with lantiqs release * make it work on lantiq kernel
SVN-Revision: 25275
Diffstat (limited to 'package/ltq-tapidemo/files/bringup_tapidemo')
-rw-r--r--package/ltq-tapidemo/files/bringup_tapidemo89
1 files changed, 89 insertions, 0 deletions
diff --git a/package/ltq-tapidemo/files/bringup_tapidemo b/package/ltq-tapidemo/files/bringup_tapidemo
new file mode 100644
index 0000000000..6eb13d25f1
--- /dev/null
+++ b/package/ltq-tapidemo/files/bringup_tapidemo
@@ -0,0 +1,89 @@
+#!/bin/sh /etc/rc.common
+# (C) 2008 openwrt.org
+
+START=96
+
+[ ! -f /dev/vmmc10 ] && {
+ mknod /dev/vmmc10 c 122 10
+ mknod /dev/vmmc11 c 122 11
+ mknod /dev/vmmc12 c 122 12
+ mknod /dev/vmmc13 c 122 13
+ mknod /dev/vmmc14 c 122 14
+ mknod /dev/vmmc15 c 122 15
+ mknod /dev/vmmc16 c 122 16
+ mknod /dev/vmmc17 c 122 17
+ mknod /dev/vmmc18 c 122 18
+}
+
+TD_EXTRA_FLAGS_FXO=
+TD_EXTRA_FLAGS_KPI2UDP=
+TD_DOWNLOAD_PATH=/lib/firmware/
+DEV_NODE_TERIDIAN=ter10
+
+ # Show help
+help()
+{
+ echo "Usage:"
+ echo " - $0 WAN-IF-NAME - start TAPIDEMO without FXO support"
+ echo " - $0 WAN-IF-NAME fxo - start TAPIDEMO with FXO support."
+ echo " - $0 stop - stop TAPIDEMO"
+}
+
+# Check if device node for Teridian exists
+checkFxoSupport()
+{
+ if [ ! -e /dev/$DEV_NODE_TERIDIAN ];then
+ echo "FXO support is disabled. Can not find required driver's device node."
+ else
+ TD_EXTRA_FLAGS_FXO="-x"
+ fi
+}
+
+# Check if module drv_kpi2udp is loaded
+checkKpi2UdpSupport()
+{
+ tmp=`cat /proc/modules | grep 'drv_kpi2udp '`
+ if [ "$tmp" != "" ]; then
+ TD_EXTRA_FLAGS_KPI2UDP="-q"
+ fi
+}
+
+start()
+{
+ TD_WANIF=$1
+
+ TD_WANIF_IP=`ifconfig $TD_WANIF | grep 'inet addr:' | cut -f2 -d: | cut -f1 -d' '`
+ if [ "$TD_WANIF_IP" = "" ]; then
+ echo "Error, getting IP address for network device $TD_WANIF failed."
+ exit 1
+ fi
+
+ if [ "$2" = "" ];then
+ # FXO support is disabled.
+ continue
+ elif [ "$2" = "fxo" ];then
+ checkFxoSupport
+ else
+ echo "Error, unknown second parameter."
+ help
+ exit 1
+ fi
+
+ checkKpi2UdpSupport
+
+ if [ -r /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+
+ TD_DEBUG_LEVEL=$tapiDebugLevel
+ if [ "$TD_DEBUG_LEVEL" = "" ]; then
+ TD_DEBUG_LEVEL=3
+ fi
+
+ /usr/sbin/tapidemo -d $TD_DEBUG_LEVEL $TD_EXTRA_FLAGS_FXO $TD_EXTRA_FLAGS_KPI2UDP -i $TD_WANIF_IP -l $TD_DOWNLOAD_PATH &
+}
+
+stop()
+{
+ killall tapidemo > /dev/null 2> /dev/null
+}