i think i almost have the default pass, i have to understand one more function

This commit is contained in:
2018-11-18 18:19:38 +01:00
parent 8206ede06a
commit 36aeaa07f6
264 changed files with 11666 additions and 1 deletions

33
verb/fs.sbin/acodec Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
# acodec -a <reg> -d <data>
if [ "$1" == "-a" ]; then
if [ "$2" == "" ]; then
echo "Usage: acodec -a <reg> -d <data>"
fi
if [ "$3" == "" ]; then
i2c -cfg f8 -dev 1a -clk 200 -a $2
echo "read WM8960: Register ($2)."
elif [ "$3" != "-d" ] || [ "$4" == "" ]; then
echo "Usage: acodec -a <reg> -d <data>"
else
i2c -cfg f8 -dev 1a -clk 200 -a $2 -d $4
echo "write WM8960: Register ($2), Data ($4)."
fi
exit
fi
if [ "$1" == "-d" ]; then
if [ "$2" == "" ]; then
echo "Usage: acodec -a <reg> -d <data>"
fi
if [ "$3" != "-a" ] || [ "$4" == "" ]; then
echo "Usage: acodec -a <reg> -d <data>"
else
i2c -cfg f8 -dev 1a -clk 200 -a $4 -d $2
echo "write WM8960: Register ($4), Data ($2)."
fi
exit
fi
echo "Usage: acodec -a <reg> -d <data>"

56
verb/fs.sbin/automount.sh Executable file
View File

@@ -0,0 +1,56 @@
#! /bin/sh
if [ "$1" == "" ]; then
echo "parameter is none"
exit 1
else
echo "***** $1 *****"
fi
mounted=`mount | grep $1 | wc -l`
# mounted, assume we umount
if [ $mounted -ge 1 ]; then
echo "R/media/$1"
echo "R/media/$1"
if ! umount "/media/$1"; then
exit 1
fi
if ! rm -r "/media/$1"; then
exit 1
fi
# not mounted, lets mount under /media
else
if ! mkdir -p "/media/$1"; then
exit 1
fi
chkexfat -f /dev/$1
chkhfs -f /dev/$1
chkntfs -f /dev/$1
mounted=`mount | grep $1 | wc -l`
num=3
while [ $mounted -lt 1 -a $num -gt 0 ]
do
mount "/dev/$1" "/media/$1"
mounted=`mount | grep $1 | wc -l`
num=`expr $num - 1`
done
mounted=`mount | grep $1 | wc -l`
while [ $mounted -lt 1 -a $num -lt 3 ]
do
ntfs-3g "/dev/$1" "/media/$1" -o force
mounted=`mount | grep $1 | wc -l`
num=`expr $num + 1`
done
if [ $mounted -lt 1 ]; then
rm -r "/media/$1"
exit 1
fi
echo "A/media/$1"
echo "A/media/$1"
fi
# Goahead need to know the event happened.
killall -SIGTTIN goahead
exit 0

40
verb/fs.sbin/automount_boot.sh Executable file
View File

@@ -0,0 +1,40 @@
#! /bin/sh
if [ "$1" == "" ]; then
echo "parameter is none"
exit 1
else
echo "***** $1 *****"
fi
mounted=`mount | grep $1 | wc -l`
if ! mkdir -p "/media/$1"; then
exit 1
fi
chkexfat -f /dev/$1
chkhfs -f /dev/$1
chkntfs -f /dev/$1
mounted=`mount | grep $1 | wc -l`
num=3
while [ $mounted -lt 1 -a $num -gt 0 ]
do
mount "/dev/$1" "/media/$1"
mounted=`mount | grep $1 | wc -l`
num=`expr $num - 1`
done
mounted=`mount | grep $1 | wc -l`
while [ $mounted -lt 1 -a $num -lt 3 ]
do
ntfs-3g "/dev/$1" "/media/$1" -o force
mounted=`mount | grep $1 | wc -l`
num=`expr $num + 1`
done
if [ $mounted -lt 1 ]; then
rm -r "/media/$1"
exit 1
fi
# Goahead need to know the event happened.
killall -SIGTTIN goahead
exit 0

16
verb/fs.sbin/cameraname.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
#
# $Id: cameraname.sh, v1.00 2009-11-05 andy
#
# usage: cameraname.sh
#
echo "*** begin cameraname.sh ***"
# restart dhcp for camera name change (mydlink request -> will cause disconnection on mydlink relay mode)
# gpio dhcp
# restart mDNSResponder for camera change - Remove (use BonjourName)
# killall -q mDNSResponder
# gpio mDNSResponder

18
verb/fs.sbin/chpasswd.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
#
# $Id: chpasswd.sh, v1.01 2015-03-24 steven
#
# usage: chpasswd.sh
#
user=`nvram_get 2860 AdminID`
pass=`nvram_get 2860 AdminPassword`
if [ "$user" == "" ]; then
echo "chpasswd: no user name"
exit 1
fi
echo "$user:$pass" > /tmp/tmpchpw
chpasswd < /tmp/tmpchpw
rm -f /tmp/tmpchpw

29
verb/fs.sbin/config-dns.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
#
# $Id: config-dns.sh,v 1.2 2007-10-15 08:26:00 winfred Exp $
#
# usage: config-dns.sh [<dns1>] [<dns2>]
#
fname="/etc/resolv.conf"
fbak="/etc/resolv_conf.bak"
# in case no previous file
touch $fname
# backup file without nameserver part
sed -e '/nameserver/d' $fname > $fbak
# set primary and seconday DNS
if [ "$1" != "" ]; then
echo "nameserver $1" > $fname
else # empty dns
rm -f $fname
fi
if [ "$2" != "" ]; then
echo "nameserver $2" >> $fname
fi
cat $fbak >> $fname
rm -f $fbak

View File

@@ -0,0 +1,13 @@
#!/bin/sh
#
# $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/user/rt2880_app/scripts/config-igmpproxy.sh#1 $
#
# usage: config-igmpproxy.sh <wan_if_name> <lan_if_name>
#
. /sbin/global.sh
igmpproxy.sh $wan_ppp_if $lan_if
killall -q igmpproxy
igmpproxy

225
verb/fs.sbin/config-udhcpd.sh Executable file
View File

@@ -0,0 +1,225 @@
#!/bin/sh
#
# $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/user/rt2880_app/scripts/config-udhcpd.sh#1 $
#
# usage: see function usage()
#
. /sbin/config.sh
. /sbin/global.sh
fname="/etc/udhcpd.conf"
fbak="/etc/udhcpd.conf_bak"
pidfile="/var/run/udhcpd.pid"
leases="/var/udhcpd.leases"
usage () {
echo "usage: config-udhcpd.sh [option]..."
echo "options:"
echo " -h : print this help"
echo " -s ipaddr : set ipaddr as start of the IP lease block"
echo " -e ipaddr : set ipaddr as end of the IP lease block"
echo " -i ifc : set ifc as the interface that udhcpd will use"
echo " -d dns1 [dns2] : set dns1 and dns2 as DNS"
echo " -m mask : set mask as subnet netmask"
echo " -g gateway : set gateway as router's IP address"
echo " -t time : set time seconds as the IP life time"
echo " -r [sleep_time] : run dhcp server"
echo " -k : kill the running dhcp server"
echo " -S [mac ipaddr] : statically assign IP to given MAC address"
# echo " -x static_netmask : Ra propritary cmd"
# echo " -y static_router : Ra propritary cmd"
exit
}
config () {
case "$1" in
"-s")
sed -e '/start/d' $fname > $fbak
echo "start $2" >> $fbak ;;
"-e")
sed -e '/end/d' $fname > $fbak
echo "end $2" >> $fbak ;;
"-i")
sed -e '/interface/d' $fname > $fbak
echo "interface $2" >> $fbak ;;
"-d")
sed -e '/option *dns/d' $fname > $fbak
echo "option dns $2 $3" >> $fbak ;;
"-m")
sed -e '/option *subnet/d' $fname > $fbak
echo "option subnet $2" >> $fbak ;;
"-g")
sed -e '/option *router/d' $fname > $fbak
echo "option router $2" >> $fbak ;;
"-t")
sed -e '/option *lease/d' $fname > $fbak
echo "option lease $2" >> $fbak ;;
"-S")
if [ "$2" = "" ]; then
sed -e '/static_lease/d' $fname > $fbak
elif [ "$3" = "" ]; then
echo "insufficient arguments.."
usage
else
echo "static_lease $2 $3" >> $fname
return
fi
;;
"-x")
sed -e '/static_netmask/d' $fname > $fbak
echo "static_netmask $2" >> $fbak ;;
"-y")
sed -e '/static_router/d' $fname > $fbak
echo "static_router $2" >> $fbak ;;
*) return;;
esac
cat $fbak > $fname
rm -f $fbak
return
}
# arg1: phy address.
link_down()
{
# get original register value
get_mii=`mii_mgr -g -p $1 -r 0`
orig=`echo $get_mii | sed 's/^.....................//'`
# stupid hex value calculation.
pre=`echo $orig | sed 's/...$//'`
post=`echo $orig | sed 's/^..//'`
num_hex=`echo $orig | sed 's/^.//' | sed 's/..$//'`
case $num_hex in
"0") rep="8" ;;
"1") rep="9" ;;
"2") rep="a" ;;
"3") rep="b" ;;
"4") rep="c" ;;
"5") rep="d" ;;
"6") rep="e" ;;
"7") rep="f" ;;
# The power is already down
*) echo "Port$1 is down. Skip.";return;;
esac
new=$pre$rep$post
# power down
mii_mgr -s -p $1 -r 0 -v $new
}
link_up()
{
# get original register value
get_mii=`mii_mgr -g -p $1 -r 0`
orig=`echo $get_mii | sed 's/^.....................//'`
# stupid hex value calculation.
pre=`echo $orig | sed 's/...$//'`
post=`echo $orig | sed 's/^..//'`
num_hex=`echo $orig | sed 's/^.//' | sed 's/..$//'`
case $num_hex in
"8") rep="0" ;;
"9") rep="1" ;;
"a") rep="2" ;;
"b") rep="3" ;;
"c") rep="4" ;;
"d") rep="5" ;;
"e") rep="6" ;;
"f") rep="7" ;;
# The power is already up
*) echo "Port$1 is up. Skip.";return;;
esac
new=$pre$rep$post
# power up
mii_mgr -s -p $1 -r 0 -v $new
}
reset_all_phys()
{
sleep_time=$1
if [ "$CONFIG_RAETH_ROUTER" != "y" -a "$CONFIG_RT_3052_ESW" != "y" ]; then
return
fi
opmode=`nvram_get 2860 OperationMode`
#skip WAN port
if [ "$opmode" != "1" ]; then #no wan port
link_down 0
link_down 4
elif [ "$CONFIG_WAN_AT_P4" = "y" ]; then #wan port at port4
link_down 0
elif [ "$CONFIG_WAN_AT_P0" = "y" ]; then #wan port at port0
link_down 4
fi
link_down 1
link_down 2
link_down 3
#force Windows clients to renew IP and update DNS server
sleep $sleep_time
#skip WAN port
if [ "$opmode" != "1" ]; then #no wan port
link_up 0
link_up 4
elif [ "$CONFIG_WAN_AT_P4" = "y" ]; then #wan port at port4
link_up 0
elif [ "$CONFIG_WAN_AT_P0" = "y" ]; then #wan port at port0
link_up 4
fi
link_up 1
link_up 2
link_up 3
}
# argv 1 is empty
if [ "$1" = "" ]; then
usage
fi
# argv 2 is empty
if [ "$2" = "" ]; then
if [ "$1" != "-r" -a "$1" != "-k" -a "$1" != "-S" ]; then
usage
fi
fi
touch $fname
case "$1" in
"-h") usage;;
"-s") config "$1" "$2";;
"-e") config "$1" "$2";;
"-i") config "$1" "$2";;
"-d") config "$1" "$2" "$3";;
"-m") config "$1" "$2";;
"-g") config "$1" "$2";;
"-t") config "$1" "$2";;
"-S") config "$1" "$2" "$3";;
"-r")
if [ -e ${pidfile} ]; then
kill `cat $pidfile`
else
killall udhcpd
fi
rm -f $pidfile
touch $leases
sed '/^lease_file /d' $fname > $fbak
cat $fbak > $fname
echo "lease_file $leases" >> $fname
udhcpd $fname
reset_all_phys $2;;
"-k")
if [ -e ${pidfile} ]; then
kill `cat $pidfile`
else
killall udhcpd
fi
rm -f $pidfile ;;
"-x") config "$1" "$2";;
"-y") config "$1" "$2";;
*) usage;;
esac

416
verb/fs.sbin/config.sh Executable file
View File

@@ -0,0 +1,416 @@
CONFIG_MIPS=y
CONFIG_ZONE_DMA=y
CONFIG_RALINK_RT5350_MP=y
CONFIG_RALINK_RT5350=y
CONFIG_RT5350_ASIC=y
CONFIG_RT2880_DRAM_32M=y
CONFIG_MTD_SPI_RALINK=y
CONFIG_KERNEL_NVRAM=y
CONFIG_RALINK_RAM_SIZE=32
CONFIG_MTD_PHYSMAP_START=0x1C000000
CONFIG_MTD_PHYSMAP_LEN=0x1000000
CONFIG_MTD_PHYSMAP_BUSWIDTH=2
CONFIG_RT2880_ROOTFS_IN_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=8192
CONFIG_LZMARAMFS=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_TIME=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_DMA_NEED_PCI_MAP_STATE=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
CONFIG_IRQ_CPU=y
CONFIG_SWAP_IO_SPACE=y
CONFIG_BOOT_ELF32=y
CONFIG_MIPS_L1_CACHE_SHIFT=5
CONFIG_CPU_MIPS32_R2=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
CONFIG_CPU_MIPS32=y
CONFIG_CPU_MIPSR2=y
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_32BIT=y
CONFIG_PAGE_SIZE_4KB=y
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_MIPS_MT_DISABLED=y
CONFIG_CPU_HAS_LLSC=y
CONFIG_CPU_HAS_SYNC=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_ZONE_DMA_FLAG=1
CONFIG_HZ_250=y
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
CONFIG_HZ=250
CONFIG_PREEMPT_NONE=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="../romfs"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_SYSCTL=y
CONFIG_EMBEDDED=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK_FUNC=y
CONFIG_PRINTK=y
CONFIG_FUTEX=y
CONFIG_SHMEM=y
CONFIG_SLAB=y
CONFIG_TINY=y
CONFIG_MEMPOOL=y
CONFIG_AIO=y
CONFIG_XATTR=y
CONFIG_FILE_LOCKING=y
CONFIG_INETPEER=y
CONFIG_NET_SK_FILTER=y
CONFIG_NET_DEV_MULTICAST=y
CONFIG_IGMP=y
CONFIG_MAX_SWAPFILES_SHIFT=5
CONFIG_NR_LDISCS=16
CONFIG_MAX_USER_RT_PRIO=100
CONFIG_TINY_EXPERIMENTAL=y
CONFIG_PDFLUSH=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=1
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_BLOCK=y
CONFIG_IOSCHED_NOOP=y
CONFIG_DEFAULT_NOOP=y
CONFIG_DEFAULT_IOSCHED="noop"
CONFIG_MMU=y
CONFIG_BINFMT_ELF=y
CONFIG_TRAD_SIGNALS=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_FIB_HASH=y
CONFIG_IP_MROUTE=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_NETFILTER=y
CONFIG_NAT_RCONE=y
CONFIG_NF_CONNTRACK_ENABLED=y
CONFIG_NF_CONNTRACK_SUPPORT=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_REDIRECT=y
CONFIG_NF_NAT_FTP=y
CONFIG_BRIDGE=y
CONFIG_LLC=y
CONFIG_WIRELESS_EXT=y
CONFIG_MTD=y
CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_SSTSTD=y
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_RALINK=y
CONFIG_MTD_BLOCK2MTD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_NET_RADIO=y
CONFIG_PPP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPPOE=y
CONFIG_SLHC=y
CONFIG_RALINK_GPIO=y
CONFIG_RALINK_GPIO_LED=y
CONFIG_RALINK_GDMA=y
CONFIG_GDMA_EVERYBODY=y
CONFIG_RALINK_I2C=y
CONFIG_RALINK_I2S=y
CONFIG_I2S_MCLK_12MHZ=y
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=2
CONFIG_SERIAL_8250_RUNTIME_UARTS=2
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_RALINK=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_VIDEO_DEV=y
CONFIG_VIDEO_V4L1=y
CONFIG_VIDEO_V4L1_COMPAT=y
CONFIG_VIDEO_V4L2=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_RAWMIDI=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_USB_AUDIO=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_RT3XXX_EHCI=y
CONFIG_USB_OHCI_HCD=y
CONFIG_RT3XXX_OHCI=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_SYSFS=y
CONFIG_RAMFS=y
CONFIG_MSDOS_PARTITION=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE="console=ttyS1,57600n8 root=/dev/ram0"
CONFIG_CRC_CCITT=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_PLIST=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_RALINK_RDM=y
CONFIG_RAETH=y
CONFIG_RA_NETWORK_TASKLET_BH=y
CONFIG_RAETH_SKB_RECYCLE_2K=y
CONFIG_RAETH_CHECKSUM_OFFLOAD=y
CONFIG_RT_3052_ESW=y
CONFIG_LAN_WAN_SUPPORT=y
CONFIG_WAN_AT_P4=y
CONFIG_ESW_DOUBLE_VLAN_TAG=y
CONFIG_WIFI_DRIVER=y
CONFIG_FIRST_IF_RT2860=y
CONFIG_SECOND_IF_NONE=y
CONFIG_RALINK_RT5350_1T1R=y
CONFIG_RT2860V2_STA=y
CONFIG_RT2860V2_STA_WSC=y
CONFIG_RT2860V2_STA_WSC_V2=y
CONFIG_RT2860V2_STA_RTMP_INTERNAL_TX_ALC=y
CONFIG_RT2860V2_STA_ED_MONITOR=y
CONFIG_RT_FIRST_CARD=2860
CONFIG_RT_FIRST_IF_RF_OFFSET=0x40000
CONFIG_LIB_LIBPTHREAD_FORCE=y
CONFIG_LIB_LIBNVRAM_FORCE=y
CONFIG_LIB_LIBUPNP_FORCE=y
CONFIG_LIB_CRYPT_FORCE=y
CONFIG_LIB_LIBM_FORCE=y
CONFIG_LIB_NSL_FORCE=y
CONFIG_LIB_UTIL_FORCE=y
CONFIG_LIB_RT_FORCE=y
CONFIG_USER_ALPHAPD_HTTPD=y
CONFIG_USER_ALPHAPD_SSL=y
CONFIG_USER_MATRIXSSL=y
CONFIG_USER_ALPHAPD_LANG_EN=y
CONFIG_LIB_LIBNVRAM_FORCE=y
CONFIG_USER_INADYN=y
CONFIG_USER_MATRIXSSL=y
CONFIG_USER_NTPCLIENT_NTPCLIENT=y
CONFIG_USER_OPENSSL=y
CONFIG_USER_PPPOECD=y
CONFIG_USER_UVC_STREAM=y
CONFIG_USER_UPNP_IGD=y
CONFIG_LIB_LIBPTHREAD_FORCE=y
CONFIG_LIB_LIBUPNP_FORCE=y
CONFIG_USER_WIRELESS_TOOLS=y
CONFIG_USER_WIRELESS_TOOLS_IWPRIV=y
CONFIG_USER_BUSYBOX_BUSYBOX=y
CONFIG_USER_IPERF=y
CONFIG_LIB_LIBM_FORCE=y
CONFIG_USER_MTD_WRITE=y
CONFIG_RALINKAPP=y
CONFIG_RALINKAPP_ATED=y
CONFIG_RALINKAPP_REG_RW=y
CONFIG_RALINKAPP_MII_MGR=y
CONFIG_RALINKAPP_NVRAM=y
CONFIG_LIB_LIBNVRAM_FORCE=y
CONFIG_RALINKAPP_GPIO=y
CONFIG_RALINKAPP_SWITCH=y
CONFIG_RALINKAPP_PCM=y
CONFIG_RALINKAPP_SCRIPTS=y
CONFIG_USER_LLTD=y

28
verb/fs.sbin/cpubusy.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/user/rt2880_app/scripts/cpubusy.sh#1 $
#
# usage: cpubysu.sh
#
echo ""
echo "!! 'killall cpubusy.sh' to Break !!"
echo ""
file="/tmp/dummy"
cpfile="/tmp/testcopy"
i=0
x=0
while true; do
i=`expr $i + 1`
echo "--- $i ---" > ${file}
j=0
while [ $j -lt 1000 ]; do
j=`expr $j + 1`
echo " cpu dummy echo for the $i, $j times" >> ${file}
cp /bin/goahead ${cpfile}
done
sleep 1
done

54
verb/fs.sbin/ddns.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
#
# $Id: ddns.sh, v1.00 2009-11-12 andy
#
# usage: ddns.sh
#
killall -q inadyn
# check ddns enable or disable
enable=`nvram_get 2860 DDNSEnable`
if [ "$enable" = "0" ]; then
exit 0
fi
srv=`nvram_get 2860 DDNSProvider`
ddns=`nvram_get 2860 DDNSHostName`
u=`nvram_get 2860 DDNSUserName`
pw=`nvram_get 2860 DDNSPassword`
to=`nvram_get 2860 DDNSTimeout`
if [ "$srv" = "" -o "$srv" = "none" ]; then
exit 0
fi
if [ "$ddns" = "" -o "$u" = "" -o "$pw" = "" ]; then
exit 0
fi
dyndnssrv="dyndns.org"
if [ "$srv" = "www.dlinkddns.com" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$dyndnssrv &
elif [ "$srv" = "www.DynDNS.org(Custom)" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system custom@$dyndnssrv &
elif [ "$srv" = "www.DynDNS.org(Free)" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$dyndnssrv &
elif [ "$srv" = "www.DynDNS.org" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$dyndnssrv &
elif [ "$srv" = "members.dyndns.org" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$dyndnssrv &
elif [ "$srv" = "dyndns.org" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system dyndns@$dyndnssrv &
elif [ "$srv" = "freedns.afraid.org" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
elif [ "$srv" = "zoneedit.com" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
elif [ "$srv" = "no-ip.com" ]; then
inadyn -u $u -p $pw -a $ddns --dyndns_system default@$srv &
else
inadyn -u $u -p $pw -a $ddns --dyndns_server_name $srv &
#echo "$0: unknown DDNS provider: $srv"
#exit 1
fi

24
verb/fs.sbin/dhcp.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# $Id: dhcp.sh, v1.00 2009-11-05 andy
#
# usage: dhcp.sh
#
echo "*** begin dhcp.sh ***"
lan_if="br0"
gpio dhcpstate 0
ipmode=`nvram_get 2860 IPAddressMode`
if [ "$ipmode" = "4" ]; then
echo "*** re-start dhcp client ***"
gpio dhcpstate 1
gpio defaultip
gpio gw 0.0.0.0
killall -q udhcpc
cameraname=`nvram_get 2860 CameraName`
udhcpc -i $lan_if -s /sbin/udhcpc.sh -p /var/run/udhcpc.pid -H $cameraname &
else
killall -q udhcpc
fi

9
verb/fs.sbin/focus.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
ov7740 -a 13 -d 00
ov7740 -a 0f -d 00
ov7740 -a 10 -d FC
ov7740 -a 00 -d 3f
ov7740 -a 01 -d 59
ov7740 -a 02 -d 59

109
verb/fs.sbin/internet.sh Executable file
View File

@@ -0,0 +1,109 @@
#!/bin/sh
#
# $Id: internet.sh, v1.00 2009-11-05 andy
#
# usage: internet.sh
#
sleep 1
echo "*****************"
echo "* INTERNET.SH *"
echo "*****************"
# run config.sh if this shell script have any configuration symbol
#. /sbin/config.sh
lan_if="br0"
# setup username:password
login=`nvram_get 2860 AdminID`
if [ "$login" = "" ]; then
echo "loading default configuration ..."
sleep 3
login=`nvram_get 2860 AdminID`
fi
pass=`nvram_get 2860 AdminPassword`
echo "$login::0:0:Adminstrator:/:/bin/sh" > /etc/passwd
echo "$login:x:0:$login" > /etc/group
chpasswd.sh $login $pass
# ftp server for wireless throughput test
echo "21 stream tcp nowait $login /usr/bin/ftpd ftpd -w" > /etc/inetd.conf
gpio telnetd_ftpd
#inetd &
# audio
model=`gpio model`
if [ "$model" == "DCS-5000L" ]; then
pcmcmd -s -q 11025 &
else
pcmcmd -s -q 8000 -x 15 &
fi
# video
uvc_stream -b &
# sleep 2 sec. in order to uvc_stream can get correct configuration data after factory reset
sleep 2
# Set RT5350 to dump switch mode (restore to no VLAN partition)
#switch reg w 14 5555
#switch reg w 40 1001
#switch reg w 44 1001
#switch reg w 48 1001
#switch reg w 4c 1
#switch reg w 50 2001
#switch reg w 70 ffffffff
#switch reg w 98 7f7f
#switch reg w e4 7f
# lo interface up -- mydlink need it
ifconfig lo up
# setup bridge, lan and wlan interface, and fast forwarding time (setfd, setmaxage)
ifconfig eth2 0.0.0.0
ifconfig ra0 0.0.0.0
brctl addbr br0
brctl addif br0 ra0
brctl addif br0 eth2
brctl setfd br0 1
brctl setmaxage br0 1
# setup wlan enable/disable
wlanonoff=`nvram_get 2860 WirelessDisable`
if [ "$wlanonoff" = "0" ]; then
gpio wlan 0
fi
if [ "$wlanonoff" = "1" ]; then
ifconfig ra0 down
gpio wlan 1
fi
# setup lan
lan.sh
# lltd
lld2d $lan_if
# ping (send arp)
gpio ping &
swing
# Set RT5350 to dump switch mode (restore to no VLAN partition)
switch reg w 14 5555
switch reg w 40 1001
switch reg w 44 1001
switch reg w 48 1001
switch reg w 4c 1
switch reg w 50 2001
switch reg w 70 ffffffff
switch reg w 98 7f7f
switch reg w e4 7f
echo "************************"
echo "* END OF INTERNET.SH *"
echo "************************"

134
verb/fs.sbin/lan.sh Executable file
View File

@@ -0,0 +1,134 @@
#!/bin/sh
#
# $Id: lan.sh, v1.00 2009-11-05 andy
#
# usage: lan.sh
#
echo "*** begin lan.sh ***"
lan_if="br0"
gpio dhcpstate 0
# ip address mode
ipmode=`nvram_get 2860 IPAddressMode`
# ip address, subnet mask, default gateway
# Fixed IP (1) and PPPoE (5) -- Init with Fixed IP
# DHCP (4) -- Init with Default IP
if [ "$ipmode" != "4" ]; then
ip=`nvram_get 2860 IPAddress`
nm=`nvram_get 2860 SubnetMask`
gw=`nvram_get 2860 DefaultGateway`
ifconfig $lan_if $ip netmask $nm
route del default
gpio gw 0.0.0.0
if [ "$gw" == "0.0.0.0" ]; then
gw=""
fi
if [ "$gw" != "" ]; then
route add default gw $gw
gpio gw $gw
else
route add default gw $ip
fi
else
gpio defaultip
gpio gw 0.0.0.0
fi
# dns address
pd=`nvram_get 2860 DNSIPAddress1`
sd=`nvram_get 2860 DNSIPAddress2`
config-dns.sh $pd $sd
gpio dns1 0.0.0.0
gpio dns2 0.0.0.0
gpio dns1 $pd
gpio dns2 $sd
# web server alphapd
#killall -q alphapd
#alphapd &
web.sh
# ddns
ddns.sh
# ntp
ntp.sh
# schedule for mail and ftp client
killall -q schedule
killall -q mail
killall -q ftpputimage
schedule &
# udp configuration and tftp upload
killall -q lanconfig
killall -q tftpupload
lanconfig &
tftpupload &
# mydlinkevent
killall -q mydlinkevent
mydlinkevent &
# mDNSResponder
killall -q mDNSResponder
gpio mDNSResponder
# upnp
#upnp=`nvram_get 2860 UPnPEnable`
#if [ "$upnp" = "1" ]; then
route add -net 239.0.0.0 netmask 255.0.0.0 dev br0
killall -q udev
killall -q ucp
udev &
ucp &
#else
#route del -net 239.0.0.0 netmask 255.0.0.0 dev br0
#killall -q udev
#killall -q ucp
#fi
# mydlink
#/mydlink/opt.local stop
#/mydlink/opt.local start
echo "from lan.sh"
gpio mydlink
# dhcp client mode
if [ "$ipmode" = "4" ]; then
gpio dhcpstate 1
killall -q udhcpc
cameraname=`nvram_get 2860 CameraName`
udhcpc -i $lan_if -s /sbin/udhcpc.sh -p /var/run/udhcpc.pid -H $cameraname &
else
killall -q udhcpc
killall -q zcip
ifconfig br0:0 down
gpio autoip 0.0.0.0
fi
# pppoe mode
if [ "$ipmode" = "5" ]; then
u=`nvram_get 2860 PPPoEUserID`
pw=`nvram_get 2860 PPPoEPassword`
# pppoecd must be kill twice. why?
killall -q pppoecd
killall -q pppoecd
gpio pppoe_state 16
pppoecd $lan_if -u "$u" -p "$pw" -R -k -I 30 -T 6 -N -1 -d &
else
killall -q pppoecd
killall -q pppoecd
gpio pppoe 0.0.0.0 0.0.0.0
fi
echo "*** end lan.sh ***"

38
verb/fs.sbin/ntp.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
#
# $Id: ntp.sh, v1.00 2009-11-09 andy
#
# usage: ntp.sh
#
killall -q ntpclient
# check manual mode or NTP mode
mode=`nvram_get 2860 DateTimeMode`
if [ "$mode" = "1" ]; then
exit 0
fi
srv=`nvram_get 2860 TimeServerIPAddress`
tz=`nvram_get 2860 TimeZone`
if [ "$srv" = "" ]; then
exit 0
fi
# 10 minutes = 600 seconds
# sync=600
# change to 24 hour = 24*60*60 = 86400 seconds
sync=86400
if [ "$tz" = "" ]; then
tz="UCT_000"
fi
echo $tz > /etc/tmpTZ
sed -e 's#.*_\(-*\)0*\(.*\)#GMT-\1\2#' /etc/tmpTZ > /etc/tmpTZ2
sed -e 's#\(.*\)--\(.*\)#\1\2#' /etc/tmpTZ2 > /etc/TZ
rm -rf /etc/tmpTZ
rm -rf /etc/tmpTZ2
ntpclient -s -c 0 -h $srv -i $sync &

74
verb/fs.sbin/pppoe.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/sh
#
# $Id: pppoe.sh, v1.00 2009-11-11 andy
#
# usage: pppoe.sh <ip> <subnet> <gw> <dns1> <dns2>
#
echo "**** pppoe.sh ***"
# ip address and subnet mask
gpio pppoe 0.0.0.0 0.0.0.0
gpio pppoe $1 $2
# default gateway
if [ $3 != "0.0.0.0" ]; then
gpio gw 0.0.0.0
gpio gw $3
route del default dev br0
else
ip=`nvram_get 2860 IPAddress`
gw=`nvram_get 2860 DefaultGateway`
route del default
gpio gw 0.0.0.0
if [ "$gw" != "" ]; then
route add default gw $gw
gpio gw $gw
else
route add default gw $ip
fi
fi
# dns
RESOLV_CONF="/etc/resolv.conf"
echo -n > $RESOLV_CONF
if [ $4 != "0.0.0.0" -a $5 != "0.0.0.0" ]; then
echo nameserver $4 >> $RESOLV_CONF
gpio dns1 0.0.0.0
gpio dns1 $4
echo nameserver $5 >> $RESOLV_CONF
gpio dns2 0.0.0.0
gpio dns2 $5
elif [ $4 != "0.0.0.0" -a $5 = "0.0.0.0" ]; then
echo nameserver $4 >> $RESOLV_CONF
gpio dns1 0.0.0.0
gpio dns1 $4
pd=`nvram_get 2860 DNSIPAddress1`
gpio dns2 0.0.0.0
if [ "$pd" != "" ]; then
echo nameserver $pd >> $RESOLV_CONF
gpio dns2 $pd
fi
elif [ $4 = "0.0.0.0" -a $5 = "0.0.0.0" ]; then
pd=`nvram_get 2860 DNSIPAddress1`
sd=`nvram_get 2860 DNSIPAddress2`
gpio dns1 0.0.0.0
gpio dns2 0.0.0.0
if [ "$pd" != "" ]; then
echo nameserver $pd >> $RESOLV_CONF
gpio dns1 $pd
fi
if [ "$sd" != "" ]; then
echo nameserver $sd >> $RESOLV_CONF
gpio dns2 $sd
fi
fi
ddns.sh
if [ $1 != "0.0.0.0" ]; then
ntp.sh
else
killall -q ntpclient
fi

18
verb/fs.sbin/snort.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
#
# $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/user/rt2880_app/scripts/snort.sh#1 $
#
# usage: snort.sh
#
se=`nvram_get 2860 SnortEnable`
killall -q snort
# debug
#echo "se=$se"
#run snort
if [ "$se" = "1" ]; then
/bin/snort -c /etc_ro/snort.conf -l /var/log -s &
fi

BIN
verb/fs.sbin/ucp Executable file

Binary file not shown.

BIN
verb/fs.sbin/udev Executable file

Binary file not shown.

133
verb/fs.sbin/udhcpc.sh Executable file
View File

@@ -0,0 +1,133 @@
#!/bin/sh
#
# udhcpc script, v1.00 2009-11-05 andy
#
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
# /sbin/ifconfig $interface 0.0.0.0 #don't clear to 0, leave it to be config ip
;;
bound)
# change dhcp state
gpio dhcpstate 2
killall -q zcip
ifconfig br0:0 down
gpio autoip 0.0.0.0
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting route"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
gpio gw 0.0.0.0
metric=0
for i in $router ; do
metric=`expr $metric + 1`
route add default gw $i dev $interface metric $metric
done
gpio gw $i
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
idx="1"
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
if [ $idx = "1" ]; then
gpio dns1 0.0.0.0
gpio dns1 $i
idx="2"
elif [ $idx = "2" ]; then
gpio dns2 0.0.0.0
gpio dns2 $i
idx="3"
fi
done
if [ $idx = "1" ]; then
pd=`nvram_get 2860 DNSIPAddress1`
sd=`nvram_get 2860 DNSIPAddress2`
if [ "$pd" != "" ]; then
echo -n > $RESOLV_CONF
echo nameserver $pd >> $RESOLV_CONF
gpio dns1 0.0.0.0
gpio dns1 $pd
fi
if [ "$sd" != "" ]; then
echo nameserver $sd >> $RESOLV_CONF
gpio dns2 0.0.0.0
gpio dns2 $sd
fi
elif [ $idx = "2" ]; then
pd=`nvram_get 2860 DNSIPAddress1`
if [ "$pd" != "" ]; then
echo nameserver $pd >> $RESOLV_CONF
gpio dns2 0.0.0.0
gpio dns2 $pd
fi
fi
# ddns
ddns.sh
# upnp
#upnp=`nvram_get 2860 UPnPEnable`
#if [ "$upnp" = "1" ]; then
route add -net 239.0.0.0 netmask 255.0.0.0 dev br0
killall -q udev
killall -q ucp
udev &
ucp &
#fi
# ntp
ntp.sh
# schedule for mail and ftp client
killall -q schedule
killall -q mail
killall -q ftpputimage
schedule &
# udp configuration and tftp upload
killall -q lanconfig
killall -q tftpupload
lanconfig &
tftpupload &
# mydlinkevent
killall -q mydlinkevent
mydlinkevent &
# mDNSResponder
killall -q mDNSResponder
gpio mDNSResponder
# mydlink
#/mydlink/opt.local stop
#/mydlink/opt.local start
echo "from udhcpc.sh"
gpio mydlink
# web server alphapd
# killall -q alphapd
# alphapd &
web.sh
;;
esac
exit 0

12
verb/fs.sbin/video.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
#
# $Id: video.sh, v1.00 2009-11-11 andy
#
# usage: video.sh
#
echo "**** video.sh ***"
killall -q uvc_stream
sleep 3
uvc_stream -b &

35
verb/fs.sbin/vpn-passthru.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
. /sbin/config.sh
. /sbin/global.sh
l2tp_pt=`nvram_get 2860 l2tpPassThru`
ipsec_pt=`nvram_get 2860 ipsecPassThru`
pptp_pt=`nvram_get 2860 pptpPassThru`
# note: they must be removed in order
if [ "$CONFIG_NF_CONNTRACK_SUPPORT" = "y" ]; then
rmmod nf_nat_pptp 1>/dev/null 2>&1
rmmod nf_conntrack_pptp 1>/dev/null 2>&1
rmmod nf_nat_proto_gre 1>/dev/null 2>&1
rmmod nf_conntrack_proto_gre 1>/dev/null 2>&1
else
rmmod ip_nat_pptp 1>/dev/null 2>&1
rmmod ip_conntrack_pptp 1>/dev/null 2>&1
fi
if [ "$pptp_pt" = "1" -o "$l2tp_pt" = "1" -o "$ipsec_pt" = "1" ]; then
if [ "$CONFIG_NF_CONNTRACK_SUPPORT" = "y" ]; then
insmod -q nf_conntrack_proto_gre
insmod -q nf_nat_proto_gre
if [ "$pptp_pt" = "1" ]; then
insmod -q nf_conntrack_pptp
insmod -q nf_nat_pptp
fi
else
insmod -q ip_conntrack_pptp
insmod -q ip_nat_pptp
fi
fi

5
verb/fs.sbin/web.sh Executable file
View File

@@ -0,0 +1,5 @@
# reload web server alphapd
killall -q alphapd
sleep 1
alphapd &

32
verb/fs.sbin/wlan.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
#
# $Id: wlan.sh, v1.00 2009-11-11 andy
#
# usage: wlan.sh
#
echo "**** wlan.sh ***"
lan_link=`gpio lanlink`
if [ "$lan_link" = "1" ]; then
exit 0
fi
ifconfig ra0 down
wlan_disable=`nvram_get 2860 WirelessDisable`
if [ "$wlan_disable" = "0" ]; then
gpio wlan 0
ifconfig ra0 up
fi
if [ "$wlan_disable" = "1" ]; then
gpio wlan 1
fi
# mydlink
#/mydlink/opt.local stop
#/mydlink/opt.local start
gpio mydlink
gpio ping &

45
verb/fs.sbin/zcip.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# only for use as a "zcip" callback script
if [ "x$interface" = x ]
then
exit 1
fi
# zcip should start on boot/resume and various media changes
case "$1" in
init)
# for now, zcip requires the link to be already up,
# and it drops links when they go down. that isn't
# the most robust model...
exit 0
;;
config)
if [ "x$ip" = x ]
then
exit 1
fi
# remember $ip for $interface, to use on restart
if [ "x$IP" != x -a -w "$IP.$interface" ]
then
echo $ip > "$IP.$interface"
fi
#exec ip address add dev $interface \
# scope link local "$ip/16" broadcast +
ifconfig br0:0 $ip
gpio autoip $ip
killall -q mDNSResponder
gpio mDNSResponder
exit 0
;;
deconfig)
if [ x$ip = x ]
then
exit 1
fi
#exec ip address del dev $interface local $ip
ifconfig br0:0 down
exit 0
;;
esac
exit 1