[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/Script/wifi_script/realtek/bridge.sh b/ap/app/Script/wifi_script/realtek/bridge.sh
new file mode 100644
index 0000000..3fecf65
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/bridge.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				echo "$CONFIG_DIR/wlan_disabled = $WLAN_DISABLED_VALUE " >> $LOG
+				
+				ISUP=`$IFCONFIG $ARG | grep UP`
+				if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up					
+					if [ $? != 0 ]; then
+						echo "$IFCONFIG $ARG up failed "  >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+				
+					if [ "$ARG" != "wlan0" -a "$ARG" != "wlan0-vxd" ]; then
+						HAS_BEEN_ADDED=`$BR_UTIL show | grep $ARG`
+						if [ ! -z "$HAS_BEEN_ADDED" ]; then
+							echo "$ARG  has been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+						else
+							echo "$ARG  has not been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+							echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+							$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+							
+							if [ $? != 0 ]; then
+								echo "Failed: $BR_UTIL addif $BR_INTF $ARG"  >> $LOG
+								exit $ERROR_ADD_IF_FAIL;
+							fi
+					
+						fi
+						
+
+						#IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+						#$IFCONFIG $ARG $IP_ADDR
+						$IFCONFIG $ARG 0.0.0.0
+					fi
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek/bridge1.sh b/ap/app/Script/wifi_script/realtek/bridge1.sh
new file mode 100644
index 0000000..0167595
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/bridge1.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+				
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up
+					if [ $? != 0 ]; then
+						echo "Failed: $IFCONFIG $ARG up" >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+					echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+					$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+					if [ $? != 0 ]; then
+						echo "Failed: $BR_UTIL addif $BR_INTF $ARG" >> $LOG
+						exit $ERROR_ADD_IF_FAIL;
+					fi
+				#	IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+				#	$IFCONFIG $ARG $IP_ADDR
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek/default_setting.sh b/ap/app/Script/wifi_script/realtek/default_setting.sh
new file mode 100755
index 0000000..75f5fa7
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/default_setting.sh
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+## error code
+
+
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+
+if [ $# -lt 1 ]; then echo "Usage: $0 iface"; exit 1; fi
+ROOT=`nv get wifi_root_dir`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_ROOT_DIR" ]; then
+    mkdir -p $CONFIG_ROOT_DIR
+fi
+
+if [ ! -d "$CONFIG_DIR" ]; then
+    mkdir -p $CONFIG_DIR
+fi
+
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_script_dir" ]; then
+	echo "/sbin" > $CONFIG_ROOT_DIR/wifi_script_dir
+fi
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_bin_dir" ]; then
+	echo "/bin" > $CONFIG_ROOT_DIR/wifi_bin_dir
+fi
+
+WLAN_PREFIX=wlan
+
+case $1 in
+$WLAN_PREFIX[0-9]*)
+	EXT=${1#$WLAN_PREFIX[0-9]}
+	echo $EXT
+	;;
+*)
+	echo "invalid WLAN interface!($1)"
+	exit $ERROR_INVALID_PARAMETERS
+	;;
+esac
+
+echo "1" > $CONFIG_DIR/board_ver
+echo "00017301FA10" > $CONFIG_DIR/nic0_addr
+echo "00017301FA19" > $CONFIG_DIR/nic1_addr
+echo "00017301FA10" > $CONFIG_DIR/wlan0_addr
+echo "00017301FA11" > $CONFIG_DIR/wlan1_addr
+echo "00017301FA12" > $CONFIG_DIR/wlan2_addr
+echo "00017301FA13" > $CONFIG_DIR/wlan3_addr
+echo "00017301FA14" > $CONFIG_DIR/wlan4_addr
+echo "00017301FA15" > $CONFIG_DIR/wlan5_addr
+echo "00017301FA16" > $CONFIG_DIR/wlan6_addr
+echo "00017301FA17" > $CONFIG_DIR/wlan7_addr
+
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht40_2s
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht20
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ofdm
+echo "3" > $CONFIG_DIR/reg_domain
+echo "0" > $CONFIG_DIR/11n_xcap
+echo "0" > $CONFIG_DIR/led_type
+echo "0" > $CONFIG_DIR/tssi_1
+echo "0" > $CONFIG_DIR/tssi_2
+echo "0" > $CONFIG_DIR/11n_ther
+echo "0" > $CONFIG_DIR/trswitch
+
+#wlan_mode: 0: AP, 1: Clienr(network_type=0)/AD-Hoc(network_type=1) 
+echo "0" >  $CONFIG_DIR/wlan_mode
+echo "0" >  $CONFIG_DIR/wlan_disabled
+echo "family-test$EXT" > $CONFIG_DIR/ssid
+echo "3" > $CONFIG_DIR/MIMO_TR_mode
+
+#channel: default channel
+echo "1" > $CONFIG_DIR/channel
+#ch_hi: Available highest channel
+echo "0" > $CONFIG_DIR/ch_hi
+#ch_low: Available lowest channel
+echo "0" > $CONFIG_DIR/ch_low
+#band: 64: 11AC, 8: 11N, 4: 11A, 2: 11G, 1: 11B; ex. 11 = 8 + 2 + 1 => BGN mode
+echo "11" > $CONFIG_DIR/band
+#basic_rate: 15=0x0f -> bit0-bit11 as 1,2,5.5,11,6,9,12,18,24,36,48,54
+echo "15" > $CONFIG_DIR/basic_rates
+echo "4095" > $CONFIG_DIR/supported_rate
+echo "1" > $CONFIG_DIR/rate_adaptive_enabled
+echo "0" > $CONFIG_DIR/fix_rate
+echo "2347" > $CONFIG_DIR/rts_threshold
+echo "2346" > $CONFIG_DIR/frag_threshold
+echo "30000" >  $CONFIG_DIR/inactivity_time	#unit:10ms
+echo "100" > $CONFIG_DIR/beacon_interval
+echo "1" > $CONFIG_DIR/dtim_period
+echo "0" > $CONFIG_DIR/preamble_type
+echo "0" > $CONFIG_DIR/hidden_ssid
+echo "0" > $CONFIG_DIR/supported_sta_num
+echo "1" > $CONFIG_DIR/protection_disabled
+echo "0" > $CONFIG_DIR/macclone_enable
+echo "0" > $CONFIG_DIR/iapp_enable
+echo "2" > $CONFIG_DIR/wifi_specific
+echo "0" > $CONFIG_DIR/vap_enable
+echo "0" > $CONFIG_DIR/group_id
+echo "0" > $CONFIG_DIR/block_relay
+echo "1" > $CONFIG_DIR/wmm_enabled
+echo "0" > $CONFIG_DIR/guest_access
+
+echo "0" > $CONFIG_DIR/wds_enable
+echo "0" > $CONFIG_DIR/wds_pure
+
+echo "0" > $CONFIG_DIR/macac_enabled
+echo "0" > $CONFIG_DIR/macac_num
+#echo "001122334455" > $CONFIG_DIR/macac_addr1
+#echo "001234567890" > $CONFIG_DIR/macac_addr2
+
+echo "0" > $CONFIG_DIR/countrycode_enable
+echo "US" > $CONFIG_DIR/countrycode
+
+echo "0" > $CONFIG_DIR/wapiType
+echo "1234567890" > $CONFIG_DIR/wapiPsk
+echo "a" > $CONFIG_DIR/wapiPsklen
+echo "2" > $CONFIG_DIR/auth_type
+echo "0" > $CONFIG_DIR/encrypt
+echo "2" > $CONFIG_DIR/wpa_auth
+echo "87654321" > $CONFIG_DIR/wpa_psk
+echo "2" > $CONFIG_DIR/wpa_cipher
+echo "2" > $CONFIG_DIR/wpa2_cipher
+echo "0" > $CONFIG_DIR/psk_enable
+echo "86400" > $CONFIG_DIR/gk_rekey
+echo "0" > $CONFIG_DIR/psk_format
+
+echo "0" >  $CONFIG_DIR/wpa11w
+echo "0" >  $CONFIG_DIR/wpa2EnableSHA256
+
+echo "0" > $CONFIG_DIR/wep
+echo "0" > $CONFIG_DIR/wep_default_key
+echo "1" > $CONFIG_DIR/wep_key_type
+echo "0987654321" > $CONFIG_DIR/wepkey1_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey2_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey3_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey4_64_hex
+echo "3534333231" > $CONFIG_DIR/wepkey1_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey2_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey3_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey4_64_asc
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey1_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey2_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey3_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey4_128_hex
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey1_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey2_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey3_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey4_128_asc
+#network_type: 0 - Client mode, 1 - AD-Hoc mode
+echo "0" > $CONFIG_DIR/network_type
+echo "" > $CONFIG_DIR/default_ssid
+echo "0" > $CONFIG_DIR/power_scale
+
+# channel_bonding: BW: 0 - 20M mode, 1 - 40M, 2 - 80M mode
+echo "0" > $CONFIG_DIR/channel_bonding
+#control_sideband: BW: 0 - lower 2nd channel offset , 1 - higher 2nd channel offset
+echo "0" > $CONFIG_DIR/control_sideband
+echo "1" > $CONFIG_DIR/aggregation
+echo "1" > $CONFIG_DIR/short_gi
+echo "0" > $CONFIG_DIR/stbc_enabled
+echo "0" > $CONFIG_DIR/coexist_enabled
+
+echo "0" > $CONFIG_DIR/enable_1x
+echo "0.0.0.0" > $CONFIG_DIR/rs_ip
+echo "1812" > $CONFIG_DIR/rs_port
+echo "" > $CONFIG_DIR/rs_password
+echo "3" > $CONFIG_DIR/rs_maxretry
+echo "5" > $CONFIG_DIR/rs_interval_time
+echo "0" > $CONFIG_DIR/mac_auth_enabled
+echo "0" > $CONFIG_DIR/enable_supp_nonwpa
+echo "0" > $CONFIG_DIR/supp_nonwpa
+echo "0" > $CONFIG_DIR/wpa2_pre_auth
+
+echo "0" > $CONFIG_DIR/account_rs_enabled
+echo "0.0.0.0" > $CONFIG_DIR/account_rs_ip
+echo "0" > $CONFIG_DIR/account_rs_port
+echo "" > $CONFIG_DIR/account_rs_password
+echo "0" > $CONFIG_DIR/account_rs_update_enabled
+echo "0" > $CONFIG_DIR/account_rs_update_delay
+echo "0" > $CONFIG_DIR/account_rs_maxretry
+echo "0" > $CONFIG_DIR/account_rs_interval_time
+
+echo "0" > $CONFIG_DIR/wsc_disabled
+echo "3" > $CONFIG_DIR/wsc_method
+echo "0" > $CONFIG_DIR/wsc_configured
+echo "1" > $CONFIG_DIR/wsc_auth
+echo "1" > $CONFIG_DIR/wsc_enc
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "1" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+echo "" > $CONFIG_DIR/wsc_ssid
+echo "" > $CONFIG_DIR/wsc_psk
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+echo "27006672" > $CONFIG_DIR/wsc_pin
+
+echo "0.0.0.0" > $CONFIG_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_DIR/net_mask
+
+echo "192.168.1.250" > $CONFIG_ROOT_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_ROOT_DIR/net_mask
+echo "RTL8192CD" > $CONFIG_ROOT_DIR/device_name
+echo "0" > $CONFIG_ROOT_DIR/band2g5g_select
diff --git a/ap/app/Script/wifi_script/realtek/init.sh b/ap/app/Script/wifi_script/realtek/init.sh
new file mode 100644
index 0000000..8ac898a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/init.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-vxd"
+VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-vxd"
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE="$ROOT_WLAN-vxd"
+#VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $VIRTUAL_WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	VIRTUAL_WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_VIRTUAL_INTERFACE=$NUM
+	
+	
+
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+#		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+#		ISUP=`$IFCONFIG $WLAN >> $LOG | grep UP`
+		
+#		if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+#		else
+#			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE, ISUP=$ISUP" >> $LOG
+#		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start success"  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek/init1.sh b/ap/app/Script/wifi_script/realtek/init1.sh
new file mode 100644
index 0000000..91e37fc
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/init1.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge1.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c1.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+VIRTUAL_WLAN_INTERFACE=""
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+		else
+			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE" >> $LOG
+		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init1.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo " "  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek/kill_wps.sh b/ap/app/Script/wifi_script/realtek/kill_wps.sh
new file mode 100644
index 0000000..13c7e4b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/kill_wps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter kill_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/kill_wps1.sh b/ap/app/Script/wifi_script/realtek/kill_wps1.sh
new file mode 100644
index 0000000..485b63f
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/kill_wps1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/para_set.sh b/ap/app/Script/wifi_script/realtek/para_set.sh
new file mode 100755
index 0000000..9b5efa2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/para_set.sh
@@ -0,0 +1,378 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+fi
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+echo "set RF parameters" >> $LOG
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+		$SET_VA0 set_mib deny_legacy=3
+		$SET_VA1 set_mib deny_legacy=3			
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1		
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1			
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+		$SET_VA0 set_mib deny_legacy=12
+		$SET_VA1 set_mib deny_legacy=12			
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+		$SET_VA0 set_mib deny_legacy=4
+		$SET_VA1 set_mib deny_legacy=4		
+	else
+		$SET_WLAN set_mib deny_legacy=0
+		$SET_VA0 set_mib deny_legacy=0
+		$SET_VA1 set_mib deny_legacy=0
+	fi
+	$SET_WLAN set_mib band=$GET_BAND
+	$SET_VA0 set_mib band=$GET_BAND
+	$SET_VA1 set_mib band=$GET_BAND
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+else
+## for va0 va1 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+		        elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			        ENABLE=8
+		        elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			       ENABLE=10
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+		GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+		$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+		$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+	else
+		echo "Only WPA3 need PMF" >> $LOG
+		$SET_WLAN set_mib dot11IEEE80211W=0
+		$SET_WLAN set_mib enableSHA256=0
+	fi
+	
+fi # [ $IS_ROOT_WLAN = 1 ]
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+
+	MSSID=`nv get m_ssid_enable`	
+
+	if [ $MSSID = 1 ]; then
+		$IFCONFIG $1-va1 up
+		if [ $? != 0 ]; then
+			exit $ERROR_NO_SUCH_DEVICE
+		fi
+	fi
+fi
+
+date +[%H:%M:%S]paraset_$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/para_set1.sh b/ap/app/Script/wifi_script/realtek/para_set1.sh
new file mode 100755
index 0000000..acdc164
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/para_set1.sh
@@ -0,0 +1,328 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+
+
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+	else
+		$SET_WLAN set_mib deny_legacy=0
+	fi
+	
+	$SET_WLAN set_mib band=$GET_BAND	
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+
+## for wlan0 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+		        elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			        ENABLE=8
+		        elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			       ENABLE=10
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+		GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+		$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+		$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+	else
+		echo "Only WPA3 need PMF" >> $LOG
+		$SET_WLAN set_mib dot11IEEE80211W=0
+		$SET_WLAN set_mib enableSHA256=0
+	fi
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/trigger_wps.sh b/ap/app/Script/wifi_script/realtek/trigger_wps.sh
new file mode 100644
index 0000000..d42f57c
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/trigger_wps.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter trigger_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek/trigger_wps1.sh b/ap/app/Script/wifi_script/realtek/trigger_wps1.sh
new file mode 100644
index 0000000..c020f1a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/trigger_wps1.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+
+echo "enter trigger_wps1.sh WPS_MODE=$WPS_MODE >>>>>>>>" >> $LOG
+
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek/wlan_8192c.sh b/ap/app/Script/wifi_script/realtek/wlan_8192c.sh
new file mode 100755
index 0000000..c3362e3
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_8192c.sh
@@ -0,0 +1,604 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+## first start up, must be single ap, wlan0 used 12345678ffbb , then to apsta, or mssid
+## ap to apsta: wlan0 need reset mac
+## ap to mssid: wlan0 no need reset mac
+## apsta to mssid: wlan0 need reset mac
+## apsta to ap: wlan0 need reset mac
+## mssid to apsta: wlan0 need reset mac
+## mssid to ap: wlan0 no need reset mac
+##
+
+## if mssid wlan0 use fixded mac, if vxd up, wlan0 use wlan0_addr
+
+if [ "1" = "2" ];then
+
+	MSSID=`nv get m_ssid_enable`
+	APSTA=`nv get wifi_sta_connection`
+
+	if [ "$1" = "wlan0" ];then
+		if [ "$APSTA" = "0" -a "$MSSID" = "0" ];then
+	### single ap	
+			GET_VALUE=12345678ffbb
+	### multissid		
+		elif ["$MSSID" = "1" ];then
+			GET_VALUE=12345678ffbb
+	### apsta		
+		elif [ "$APSTA" = "1" ];then
+			GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		fi
+		$IFCONFIG $1 hw ether $GET_VALUE
+	else
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		$IFCONFIG $1 hw ether $GET_VALUE
+	fi
+	echo "$IFCONFIG $1 hw ether $GET_VALUE NOT GO here><><>" >> $LOG
+
+else
+
+	if [ "$1" = "wlan0" ];then
+##wlan0 use fixed addr	
+		GET_VALUE=12345678ffbb
+		
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+		#$IFCONFIG $1 hw ether $GET_VALUE
+	else
+	
+		if [ "$1" = "wlan0-vxd" ];then
+			echo "$IWPRIV $1 copy_mib" >> $LOG
+			$IWPRIV $1 copy_mib
+		fi
+	
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		#$IFCONFIG $1 hw ether $GET_VALUE
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+	fi
+fi
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+#	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+#	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+	$SET_WLAN set_mib countrystr=$GET_VALUE
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			ENABLE=8
+		elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			ENABLE=10
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+
+if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+else
+	echo "Only WPA3 need PMF" >> $LOG
+	$SET_WLAN set_mib dot11IEEE80211W=0
+	$SET_WLAN set_mib enableSHA256=0
+fi
+
+##########
diff --git a/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh b/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh
new file mode 100755
index 0000000..89a93ef
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_8192c1.sh
@@ -0,0 +1,556 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+iwpriv $1 set_mib hwaddr=$GET_VALUE
+
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+		$SET_WLAN set_mib ch_low=5
+#		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+#	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+#COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+#	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+#	$SET_WLAN set_mib countrystr=$GET_VALUE
+
+
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		elif [ $GET_WLAN_ENCRYPT = 8 ]; then
+			ENABLE=8
+		elif [ $GET_WLAN_ENCRYPT = 10 ]; then
+			ENABLE=10
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase="$GET_WPA_PSK"
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+
+if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
+	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+else
+	echo "Only WPA3 need PMF" >> $LOG
+	$SET_WLAN set_mib dot11IEEE80211W=0
+	$SET_WLAN set_mib enableSHA256=0
+fi
+
+##########
diff --git a/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh b/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh
new file mode 100644
index 0000000..9dbff1b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlan_basic_deal.sh
@@ -0,0 +1,180 @@
+#!/bin/sh
+#
+# script file to down up WLAN quickly
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+BR_UTIL=brctl
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+
+
+
+br0_add_va1()
+{
+	HAS_BEEN_ADDED=`$BR_UTIL show | grep va1`
+	if [ -z "$HAS_BEEN_ADDED" ]; then
+		echo "$BR_UTIL addif br0 wlan0-va1"  >> $LOG
+		$BR_UTIL addif br0 wlan0-va1 2> /dev/null
+		
+		if [ $? != 0 ]; then
+			echo "Failed: $BR_UTIL addif br0 wlan0-va1"  >> $LOG
+			exit $ERROR_ADD_IF_FAIL;
+		fi
+
+	fi
+}
+
+ifconfig_wlan0_up()
+{
+	ifconfig wlan0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_down()
+{
+	ifconfig wlan0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_up()
+{
+	ifconfig wlan0-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_down()
+{
+	ifconfig wlan0-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_up()
+{
+	ifconfig wlan0-va1 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_down()
+{
+	ifconfig wlan0-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+ifconfig_wlan0_vxd_down()
+{
+	ifconfig wlan0-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+basic_open_va0()
+{
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+}				
+
+basic_open_va0_va1()
+{
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num`
+    iwpriv wlan0-va1  set_mib  stanum=`nv get  m_MAX_Access_num`
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_open_va1()
+{
+	ifconfig_wlan0_va0_down
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib stanum=`nv get m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_close_va1()
+{
+	iwpriv	wlan0-va1  clear_acl_table
+	ifconfig_wlan0_va1_down
+	
+	ifconfig_wlan0_va0_down	
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+}
+
+basic_closesta_openmssid()
+{
+	ifconfig_wlan0_va0_down 
+	ifconfig_wlan0_vxd_down
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib  stanum=`nv get  m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up 
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+
+main()
+{
+	if [ "$1" == "open_va0" ]; then
+		basic_open_va0
+	elif  [ "$1" == "open_va1" ]; then
+		basic_open_va1
+	elif [ "$1" == "close_va1" ]; then
+		basic_close_va1
+	elif [ "$1" == "open_va0_va1"  ]; then
+		basic_open_va0_va1
+	elif  [  "$1" == "close_sta_open_va1" ] ; then
+		basic_closesta_openmssid
+	else
+		echo "$1 para wrong"  >> $LOG
+		exit $ERROR_INVALID_PARAMETERS;
+	fi
+
+}
+
+date +[%H:%M:%S]$1_start >> $LOG
+main $1
+date +[%H:%M:%S]$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh b/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh
new file mode 100644
index 0000000..3848dbf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wlanapp_8192c.sh
@@ -0,0 +1,464 @@
+#!/bin/sh
+#
+# script file to start wlan applications (IAPP, Auth, Autoconf) daemon
+#
+# Usage: wlanapp.sh [start|kill] wlan_interface...br_interface
+#
+
+## error code
+ERROR_WSCD_START_FAIL=8
+
+if [ $# -lt 2 ] || [ $1 != 'start' -a $1 != 'kill' ] ; then 
+	echo "Usage: $0 [start|kill] wlan_interface...br_interface" >> $LOG
+	exit 1 
+fi
+#CUR_PATH=`pwd`
+#TOP_VAR_DIR="/etc_ro"
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+TOP_VAR_DIR="$ROOT/wifi/realtek"
+TOP_ETC_DIR="/etc_ro/realtek/ath"
+TOP_TMP_DIR="$ROOT/tmp"
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ ! -d "$TOP_TMP_DIR" ]; then
+    mkdir $TOP_TMP_DIR
+fi
+
+if [ -z "$BIN_DIR" ]; then
+	BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${2:0:$WLAN_NAME_LEN}
+	ROOT_WLAN=${2%%-*}
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+GET_VALUE=
+GET_VALUE_TMP=
+KILLALL=killall
+FLASH_PROG=flash
+SLEEP=sleep
+
+START=1
+PARAM_NUM=$#
+PARAM_ALL=$*
+PARAM1=$1
+PARAM_BR=
+WLAN_INTERFACE=
+
+WLAN0_MODE=
+WLAN0_DISABLED=
+WLAN0_WSC_DISABLED=
+
+WLAN1_MODE=0
+WLAN1_DISABLED=1
+WLAN1_WSC_DISABLED=1
+both_band_ap=0
+
+rtl_check_wlan_band(){
+
+	WLAN0_MODE=`cat $CONFIG_ROOT_DIR/wlan0/wlan_mode`
+	WLAN0_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wlan_disabled`
+	WLAN0_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wsc_disabled`
+
+	if [ -d "$CONFIG_ROOT_DIR/wlan1" ] ; then
+		WLAN1_MODE=`cat $CONFIG_ROOT_DIR/wlan1/wlan_mode`
+		WLAN1_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wlan_disabled`
+		WLAN1_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wsc_disabled`
+	fi
+
+	if [ "$WLAN0_MODE" = "0" -o "$WLAN0_MODE" = "3" ] && [ "$WLAN1_MODE" = "0" -o "$WLAN1_MODE" = "3" ] && [ "$WLAN0_DISABLED" = "0" ] && [ "$WLAN1_DISABLED" = "0" ] && [ "$WLAN0_WSC_DISABLED" = "0" ] && [ "$WLAN1_WSC_DISABLED" = "0" ]; then
+		both_band_ap = 1
+	fi
+}
+
+rtl_check_wlan_if() {
+
+	echo "wlanapp_8192c.sh --rtl_check_wlan_if" >> $LOG
+
+	if [ $PARAM_NUM -ge 1 ]; then
+		for ARG in $PARAM_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				if [ -z "$WLAN_INTERFACE" ]; then
+					WLAN_INTERFACE="$ARG"
+				else
+					WLAN_INTERFACE="$WLAN_INTERFACE $ARG"
+				fi
+				;;
+			*)
+				PARAM_BR=$ARG
+				;;
+			esac
+		done
+	fi
+}
+	
+DEBUG_EASYCONF=
+VXD_INTERFACE=
+
+
+## kill 802.1x, autoconf and IAPP daemon ##
+rtl_kill_iwcontrol_pid() { 
+	PIDFILE="$TOP_VAR_DIR/run/iwcontrol.pid"
+	echo "wlanapp_8192c.sh --rtl_kill_iwcontrol_pid"  >> $LOG
+	if [ -f $PIDFILE ] ; then
+		PID=`cat $PIDFILE`
+		echo "IWCONTROL_PID=$PID"  >> $LOG
+		if [ "$PID" != "0" ]; then
+			kill -9 $PID 2>/dev/null
+		fi
+		rm -f $PIDFILE
+	fi
+}
+
+
+rtl_kill_wlan_pid() {
+
+	echo "wlanapp_8192c.sh --rtl_kill_wlan_pid"  >>  $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN.pid
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "AUTH_PID=$PID"
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE
+			
+			PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN-vxd.pid 
+			if [ -f $PIDFILE ] ; then		
+				PID=`cat $PIDFILE`
+				if [ "$PID" != "0" ]; then
+					kill -9 $PID 2>/dev/null
+				fi
+				rm -f $PIDFILE       		
+			fi
+		fi
+		
+		# for WPS ---------------------------------->>
+		PIDFILE=$TOP_VAR_DIR/run/wscd-$WLAN.pid
+		if [ "$both_band_ap" = "1" ]; then
+			PIDFILE=$TOP_VAR_DIR/run/wscd-wlan0-wlan1.pid
+		fi
+		
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "WSCD_PID=$PID"  >> $LOG
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE   
+		fi 
+	done
+	#<<----------------------------------- for WPS
+}
+
+## start 802.1x daemon ##
+DEAMON_CREATED=0
+VALID_WLAN_INTERFACE=
+
+
+rtl_start_wlan() {
+	echo "rtl_start_wlan WLAN_INTERFACE is "$WLAN_INTERFACE >> $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		echo "rtl_start_wlan start-1------------ CONFIG_DIR is "$CONFIG_DIR  >> $LOG
+		GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$GET_VALUE_WLAN_DISABLED" != 0 ]; then
+			continue
+		fi
+		
+		GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+		GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+		GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+		
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		VAP_AUTH_ENABLE=0
+		ROOT_AUTH_ENABLE=0
+		
+		_ENABLE_1X=0
+		_USE_RS=0
+
+		if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+			GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+			GET_MAC_AUTH_ENABLED=`cat $ROOT_CONFIG_DIR/mac_auth_enabled`
+			if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+				_ENABLE_1X=1
+				_USE_RS=1
+			fi
+		else
+			_ENABLE_1X=1
+			if  [ "$GET_WLAN_WPA_AUTH_TYPE" = 1 ]; then
+				_USE_RS=1
+			fi		
+		fi
+
+		echo "_ENABLE_1X= $_ENABLE_1X" >> $LOG	
+		ROLE=
+		if [ "$_ENABLE_1X" != 0 ]; then	
+			echo "$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN" >> $LOG
+			$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN
+			if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+				GET_VALUE=`cat $CONFIG_DIR/network_type`
+				if [ "$GET_VALUE" = '0' ]; then
+					ROLE=client-infra
+				else
+					ROLE=client-adhoc			
+				fi
+			else
+				ROLE=auth
+			fi
+
+			VAP_NOT_IN_PURE_AP_MODE=0		
+		
+			
+			if [ "$GET_VALUE_WLAN_MODE" = '0' ] && [ "$VAP_NOT_IN_PURE_AP_MODE" = '0' ]; then
+				if  [ "$GET_WLAN_WPA_AUTH_TYPE" != 2 ] || [ "$_USE_RS" != 0 ]; then
+					echo "$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf" >> $LOG
+					$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf
+					
+					DEAMON_CREATED=1
+					ROOT_AUTH_ENABLE=1
+				fi
+		
+			fi
+		fi
+		
+		if [ "$EXT" = "vxd" ]; then	
+			if [ "$ROLE" != "auth" ] || [ "$ROLE" = "auth" -a "$_USE_RS" != 0 ]; then
+				VXD_INTERFACE=$WLAN
+			fi
+		else
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			#|| [ $GET_WSC_DISABLE = 0 ]
+			if [ $ROOT_AUTH_ENABLE = 1 ] || [ $GET_WSC_DISABLE = 0 ]; then
+				if [ -z "$VALID_WLAN_INTERFACE" ]; then
+					VALID_WLAN_INTERFACE="$WLAN"
+				else
+					VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+				fi
+			fi
+		fi
+		
+	done
+
+}
+
+#end of start wlan
+
+
+# for WPS ------------------------------------------------->>
+rtl_start_wps() {
+
+
+	if [ ! -e $BIN_DIR/wscd ]; then
+		echo "wscd not exist $BIN_DIR is " $BIN_DIR  >> $LOG
+		return;
+	fi
+	echo "rtl_start_wps  WLAN is " $WLAN >> $LOG
+	echo "VALID_WLAN_INTERFACE is " $VALID_WLAN_INTERFACE  >> $LOG
+	
+	
+	for WLAN in $VALID_WLAN_INTERFACE ; do
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		echo  "EXT=$EXT" >> $LOG
+		if [ "$EXT" = "" ] || [ "$EXT" = "va0" ] || [ "$EXT" = "va1" ] || [ "$EXT" = "vxd" ]; then
+			
+			USE_IWCONTROL=1
+			DEBUG_ON=0
+			_ENABLE_1X=0
+			WSC=1
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			CONF_FILE=$TOP_VAR_DIR/wsc-$WLAN.conf
+			FiFO_File=$TOP_VAR_DIR/wscd-$WLAN.fifo
+			
+			echo "rtl_start_wps  CONFIG_DIR is " $CONFIG_DIR  >> $LOG
+			
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+			GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+			GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+			GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+
+			if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+				GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+				GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+				if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+					_ENABLE_1X=1
+				fi
+			else
+				_ENABLE_1X=1
+			fi
+			echo "_ENABLE_1X is " $_ENABLE_1X  >> $LOG
+			if [ "$EXT" = "vxd" ]; then
+				GET_VALUE_WLAN_CURR_MODE=`cat $CONFIG_DIR/wlan_mode`
+				if [ $GET_VALUE_WLAN_CURR_MODE = 1 ]; then
+					GET_WSC_DISABLE = 1
+				fi
+			fi
+			
+			if [ $GET_WSC_DISABLE != 0 ]; then
+				echo "GET_WSC_DISABLE is " $GET_WSC_DISABLE   >> $LOG
+				WSC=0
+			else
+				if  [ "$GET_VALUE_WLAN_DISABLED" != 0 ] || [ "$GET_VALUE_WLAN_MODE" = 2 ]; then
+					echo "GET_VALUE_WLAN_DISABLED is "$GET_VALUE_WLAN_DISABLED  >> $LOG
+					echo "GET_VALUE_WLAN_MODE is "$GET_VALUE_WLAN_MODE  >> $LOG
+					WSC=0
+				else  
+					if [ $GET_VALUE_WLAN_MODE = 1 ]; then	
+						GET_VALUE=`cat $CONFIG_DIR/network_type`
+						if [ "$GET_VALUE" != 0 ]; then
+							echo "network_type is "$GET_VALUE  >> $LOG
+							WSC=0
+						fi
+					fi
+					if [ $GET_VALUE_WLAN_MODE = 0 ]; then	
+						if [ $GET_WLAN_ENCRYPT -lt 2 ] && [ $_ENABLE_1X != 0 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "_ENABLE_1X is "$_ENABLE_1X  >> $LOG
+							WSC=0
+						fi			
+						if [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_WPA_AUTH_TYPE = 1 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "GET_WLAN_WPA_AUTH_TYPE is "$GET_WLAN_WPA_AUTH_TYPE  >> $LOG
+							WSC=0
+						fi			
+					fi
+				fi
+			fi
+			echo "-----------------WSC is "$WSC  >> $LOG 
+			if [ $WSC = 1 ]; then
+				if [ ! -f $TOP_VAR_DIR/wps/simplecfgservice.xml ]; then
+					if [ -e $TOP_VAR_DIR/wps ]; then
+						rm $TOP_VAR_DIR/wps -rf
+					fi
+					mkdir $TOP_VAR_DIR/wps
+					#cp $TOP_ETC_DIR/simplecfg*.xml $TOP_VAR_DIR/wps
+					cat $TOP_ETC_DIR/simplecfgservice.xml > $TOP_VAR_DIR/wps/simplecfgservice.xml
+				fi
+
+				if [ $GET_VALUE_WLAN_MODE = 1 ]; then			
+					UPNP=0
+					_CMD="-mode 2"
+				else		
+					GET_WSC_UPNP_ENABLED=`cat $CONFIG_DIR/wsc_upnp_enabled`
+					UPNP=$GET_WSC_UPNP_ENABLED
+					_CMD="-start"
+				fi
+				WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+				if [ "$WPS_MODE" = "1" ]; then
+					_CMD="$_CMD -method 1"
+				fi
+				echo " UPNP is " $UPNP >> $LOG
+				if [ $UPNP = 1 ]; then
+					route del -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+					route add -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+				fi
+		
+				if [ "$both_band_ap" = "1" ]; then
+					_CMD="$_CMD -both_band_ap"	
+				fi
+				echo "$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN"  >> $LOG
+				$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN
+				
+				_CMD="$_CMD -c $CONF_FILE -w $WLAN"
+		
+				if [ $DEBUG_ON = 1 ]; then
+					_CMD="$_CMD -debug"	
+				fi	
+				if [ $USE_IWCONTROL = 1 ]; then
+					_CMD="$_CMD -fi $FiFO_File"
+					DEAMON_CREATED=1
+					echo "DEAMON_CREATED=1" >> $LOG
+				fi
+		
+				if [ -f "$TOP_VAR_DIR/wps_start_pbc" ]; then		
+					_CMD="$_CMD -start_pbc"
+					rm -f $TOP_VAR_DIR/wps_start_pbc
+				fi
+
+				if [ -f "$TOP_VAR_DIR/wps_start_pin" ]; then		
+					_CMD="$_CMD -start"
+					rm -f $TOP_VAR_DIR/wps_start_pin
+				fi	
+				if [ -f "$TOP_VAR_DIR/wps_local_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_local_pin`		
+					_CMD="$_CMD -local_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_local_pin
+				fi
+				if [ -f "$TOP_VAR_DIR/wps_peer_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_peer_pin`		
+					_CMD="$_CMD -peer_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_peer_pin
+				fi				
+				WSC_CMD=$_CMD
+				echo "$BIN_DIR/wscd $WSC_CMD -daemon" >> $LOG
+				$BIN_DIR/wscd $WSC_CMD -daemon
+				echo "<<<<<<<<<<wscd >>>>>>>>>>> over" >> $LOG
+				WAIT=5
+				while [ $USE_IWCONTROL != 0 -a $WAIT != 0 ]		
+				do	
+					if [ -e $FiFO_File ]; then
+						break;
+					else
+						$SLEEP 1
+						WAIT=`expr $WAIT - 1`
+						#WAIT=$((WAIT - 1))
+					fi
+				done
+				if [ $WAIT = 0 ]; then
+					exit $ERROR_WSCD_START_FAIL;
+				fi
+			fi
+		fi
+	done
+}
+#<<--------------------------------------------------- for WPS
+
+rtl_start_iwcontrol() {
+	echo "rtl_start_iwcontrol"  >> $LOG
+	if [ $DEAMON_CREATED = 1 ]; then
+		echo "$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL"  >> $LOG
+		$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL
+	fi
+}
+
+rtl_wlanapp() {
+
+	echo "rtl_wlanapp"  >> $LOG
+
+	if [ $PARAM1 = 'kill' ]; then
+		START=0
+	fi
+	rtl_check_wlan_if
+	if [ -z "$WLAN_INTERFACE" ]; then
+		echo "Error in $0, no wlan interface is given!"  >> $LOG
+		exit 0
+	fi
+	rtl_kill_iwcontrol_pid
+	rtl_kill_wlan_pid
+	rm -f $TOP_VAR_DIR/*.fifo
+	if [ $START = 0 ]; then
+		return;
+	fi
+	
+#	rtl_check_wlan_band
+	rtl_start_wlan
+	rtl_start_wps
+	rtl_start_iwcontrol
+}
+
+rtl_wlanapp
diff --git a/ap/app/Script/wifi_script/realtek/wps_init.sh b/ap/app/Script/wifi_script/realtek/wps_init.sh
new file mode 100644
index 0000000..922935e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wps_init.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter wps init.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/wps_init1.sh b/ap/app/Script/wifi_script/realtek/wps_init1.sh
new file mode 100644
index 0000000..8f2c8b2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/wps_init1.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh b/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh
new file mode 100755
index 0000000..7638d87
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek/zte_qrcode_create.sh
@@ -0,0 +1,162 @@
+#!/bin/sh 
+## 
+# $Id: zte_qrcode_create.sh,v 0.0.0.1 2013.05.06 liuweipeng Exp $ 
+# 
+# usage: zte_qrcode_create.sh
+# 
+
+#wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_ssid_wifikey.png'
+#wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/ssid_wifikey.bmp'
+
+#multi_wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_multi_ssid_wifikey.png'
+#multi_wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/multi_ssid_wifikey.bmp'
+
+#local_domain_qrcode_name='/usr/zte_web/web/img/qrcode_local_domaind.png'
+#local_domain_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/local_domaind.bmp'
+
+ROOT=`nv get wifi_root_dir`
+
+wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey.png"
+wifi_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey.bmp"
+
+multi_wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_multi_ssid_wifikey.png"
+multi_wifi_ssid_qrcode_name_bmp="$ROOT/wifi/multi_ssid_wifikey.bmp"
+
+local_domain_qrcode_name="$ROOT/wifi/qrcode_local_domaind.png"
+local_domain_qrcode_name_bmp="$ROOT/wifi/local_domaind.bmp"
+
+#target_web_dir="$ROOT/securefs/web/img/"
+
+#if [ "$ROOT" = "" ]; then
+#    target_web_dir="/etc_ro/web/img/"
+#else
+#    target_web_dir="$ROOT/etc/web/img/"
+#fi
+
+echo "wifi_ssid_qrcode_name=$wifi_ssid_qrcode_name"
+echo "wifi_ssid_qrcode_name_bmp=$wifi_ssid_qrcode_name_bmp"
+############zte qrcode create shell entry#################
+
+case $1 in 
+ "wifi_create") 
+   
+ 	echo "enter the wifi_create function"
+	
+	rm -rf  $wifi_ssid_qrcode_name
+	rm -rf  $wifi_ssid_qrcode_name_bmp
+	
+	#wifi_ssid_name=`zte_nvc_apps read SSID1`	 # wifi ssid 
+	#wifi_auth_mode=`zte_nvc_apps read AuthMode`  # wifi auth mode 
+	#wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type
+	#wifi_password=`zte_nvc_apps read WPAPSK1`  #wifi password
+    	wifi_ssid_name=`nv get SSID1`	 # wifi ssid 
+	wifi_auth_mode=`nv get AuthMode`    # wifi auth mode
+	wifi_encry_type=`nv get EncrypType`  # wifi encry type
+	auth_wpa=`echo $wifi_auth_mode | sed  -n '/WPA/p'`
+	auth_wpa_1=`echo $wifi_auth_mode | sed  -n '/WPA3/p'`
+	if [ -n "$auth_wpa" ];then  # wpa
+		wifi_password=`nv get WPAPSK1`     # wifi password
+		if [ -n "$auth_wpa_1" ];then
+			wifi_T="SAE"
+		else
+			wifi_T="WPA"
+		fi
+		qrcode_text='WIFI:T:'$wifi_T';S:'$wifi_ssid_name';P:'$wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then
+		defaultKeyID=`nv get DefaultKeyID`
+		if [ "$defaultKeyID" = "0" ];then
+			wifi_password=`nv get Key1Str1`
+		elif [ "$defaultKeyID" = "1" ];then
+			wifi_password=`nv get Key2Str1`
+		elif [ "$defaultKeyID" = "2" ];then
+			wifi_password=`nv get Key3Str1`
+		elif [ "$defaultKeyID" = "3" ];then
+			wifi_password=`nv get Key4Str1`
+		else
+			wifi_password=`nv get Key1Str1`
+		fi
+		qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$wifi_encry_type" = "NONE" ];then
+		qrcode_text='WIFI:S:'$wifi_ssid_name';'
+		echo "qrcode_text = $qrcode_text"	
+	fi
+	
+	qrencode -o $wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp -O $wifi_ssid_qrcode_name_bmp $wifi_ssid_qrcode_name 
+	
+#	cp $wifi_ssid_qrcode_name $target_web_dir
+	
+	;;
+ 
+ "multi_wifi_create") 
+	echo "enter the multi_wifi_create function"
+	
+	rm -rf  $multi_wifi_ssid_qrcode_name_bmp
+	rm -rf  $multi_wifi_ssid_qrcode_name
+	
+	#multi_wifi_ssid_name=`zte_nvc_apps read m_SSID`	  # multi wifi ssid 
+	#multi_wifi_auth_mode=`zte_nvc_apps read m_AuthMode`  #multi wifi auth mode 
+	#multi_wifi_encry_type=`zte_nvc_apps read m_EncrypType` #multi wifi encry type
+	#multi_wifi_password=`zte_nvc_apps read m_WPAPSK1`  #multi wifi password
+	multi_wifi_ssid_name=`nv get m_SSID`	 # wifi ssid 
+	multi_wifi_auth_mode=`nv get m_AuthMode`    # wifi auth mode
+	multi_wifi_encry_type=`nv get m_EncrypType`   # wifi encry type
+	multi_wifi_password=`nv get m_WPAPSK1`      # wifi password
+	auth_wpa=`echo $multi_wifi_auth_mode | sed  -n '/WPA/p'`
+	auth_wpa_1=`echo $multi_wifi_auth_mode | sed  -n '/WPA3/p'`
+	if [ -n "$auth_wpa" ];then  # wpa
+		if [ -n "$auth_wpa_1" ];then
+			wifi_T="SAE"
+		else
+			wifi_T="WPA"
+		fi
+		qrcode_text='WIFI:T:'$wifi_T';S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	##elif [ "$multi_wifi_encry_type" = "WEP" ];then
+	elif [ "$multi_wifi_encry_type" = "WEP" -o "$multi_wifi_auth_mode" = "SHARED" -o "$multi_wifi_auth_mode" = "WEPAUTO" ];then
+	    multi_defaultKeyID=`nv get m_DefaultKeyID`
+		if [ "$multi_defaultKeyID" = "0" ];then
+			multi_wifi_password=`nv get m_Key1Str1`
+		elif [ "$multi_defaultKeyID" = "1" ];then
+			multi_wifi_password=`nv get m_Key2Str1`
+		elif [ "$multi_defaultKeyID" = "2" ];then
+			multi_wifi_password=`nv get m_Key3Str1`
+		elif [ "$multi_defaultKeyID" = "3" ];then
+			multi_wifi_password=`nv get m_Key4Str1`
+		else
+			multi_wifi_password=`nv get m_Key1Str1`
+		fi		  	 	 
+		qrcode_text='WIFI:T:WEP;S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$multi_wifi_encry_type" = "NONE" ];then
+		qrcode_text='WIFI:S:'$multi_wifi_ssid_name';'
+		echo "qrcode_text = $qrcode_text"	
+	fi
+	
+	qrencode -o $multi_wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp  -O $multi_wifi_ssid_qrcode_name_bmp $multi_wifi_ssid_qrcode_name
+	
+#	cp $multi_wifi_ssid_qrcode_name $target_web_dir
+	;;
+	
+ "local_domain_create") 
+	echo "enter the local_url_create function"
+	
+	rm -rf  $local_domain_qrcode_name_bmp
+	
+	local_domain_url=`zte_nvc_apps read LocalDomain`	  #local domain name
+	local_domain_username=`zte_nvc_apps read admin_user`  #local domain username
+	local_domain_passwd=`zte_nvc_apps read admin_Password` #local domain password	
+ 
+	qrcode_text='http://'$local_domain_url
+	echo "qrcode_text = $qrcode_text"	
+		
+	qrencode -o $local_domain_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp  -O $local_domain_qrcode_name_bmp  $local_domain_qrcode_name
+	
+	local_domain_qrcode_name
+ 
+	;;
+esac
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh b/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh
new file mode 100755
index 0000000..3fecf65
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/bridge.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				echo "$CONFIG_DIR/wlan_disabled = $WLAN_DISABLED_VALUE " >> $LOG
+				
+				ISUP=`$IFCONFIG $ARG | grep UP`
+				if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up					
+					if [ $? != 0 ]; then
+						echo "$IFCONFIG $ARG up failed "  >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+				
+					if [ "$ARG" != "wlan0" -a "$ARG" != "wlan0-vxd" ]; then
+						HAS_BEEN_ADDED=`$BR_UTIL show | grep $ARG`
+						if [ ! -z "$HAS_BEEN_ADDED" ]; then
+							echo "$ARG  has been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+						else
+							echo "$ARG  has not been added to $BR_UTIL :: $HAS_BEEN_ADDED"  >> $LOG
+							echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+							$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+							
+							if [ $? != 0 ]; then
+								echo "Failed: $BR_UTIL addif $BR_INTF $ARG"  >> $LOG
+								exit $ERROR_ADD_IF_FAIL;
+							fi
+					
+						fi
+						
+
+						#IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+						#$IFCONFIG $ARG $IP_ADDR
+						$IFCONFIG $ARG 0.0.0.0
+					fi
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh b/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh
new file mode 100755
index 0000000..0167595
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/bridge1.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# script file to start bridge
+#
+# Usage: bridge.sh br_interface lan1_interface wlan_interface[1]..wlan_interface[N]
+#
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $0 br_interface lan1_interface wlan_interface ..."  >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+#CUR_PATH=`pwd`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+LAN_PREFIX=eth
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+SLEEP=sleep
+## test for to RESTART_BR be 1
+RESTART_BR=0
+RESTART_LAN=0
+RESTART_WLAN=1
+
+#set PARA for $i can't pass to function
+BR_INTF=$1
+PARA2=$2
+PARA3=$3
+PARA_ALL=$*
+
+BR_NOT_EXIST=0
+
+rtl_shutdown_net_if() {
+	if [ $BR_NOT_EXIST != 0 ]; then
+		return;
+	fi
+	
+	# shutdown network interface (ethernet, wlan)
+	for ARG in $PARA_ALL ; do
+		case $ARG in
+		$LAN_PREFIX*)
+			if [ $RESTART_LAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		$WLAN_PREFIX*)
+			if [ $RESTART_WLAN != 0 ]; then
+				$IFCONFIG $ARG down	
+				$BR_UTIL delif $BR_INTF $ARG 2> /dev/null
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+}
+
+rtl_enable_net_if() {
+	# Enable network interface (Ethernet, wlan, WDS, bridge)
+	if [ $RESTART_BR != 0 ]; then
+		echo 'Setup bridge...'  >> $LOG
+		if [ $BR_NOT_EXIST != 0 ]; then
+			$BR_UTIL addbr $BR_INTF
+			if [ $? != 0 ]; then
+				echo "Failed: $BR_UTIL addbr $BR_INTF"
+				exit $ERROR_ADD_BR_FAIL;
+			fi
+		fi
+		#$BR_UTIL setfd $BR_INTF 0
+		#$BR_UTIL stp $BR_INTF 0
+	fi
+	#IP_ADDR=`cat $CONFIG_ROOT_DIR/ip_addr`
+	#SUBNET_MASK=`cat $CONFIG_ROOT_DIR/net_mask`
+	#$IFCONFIG $BR_INTF $IP_ADDR netmask $SUBNET_MASK
+	
+	#Add lan port to bridge interface
+	if [ $RESTART_LAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$LAN_PREFIX*)
+				$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+				$IFCONFIG $ARG  0.0.0.0
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+	
+	if [ $RESTART_WLAN != 0 ]; then
+		for ARG in $PARA_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				CONFIG_DIR=$CONFIG_ROOT_DIR/$ARG
+				WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+				if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+				
+				
+					echo "$IFCONFIG $ARG up"  >> $LOG
+					$IFCONFIG $ARG up
+					if [ $? != 0 ]; then
+						echo "Failed: $IFCONFIG $ARG up" >> $LOG
+						exit $ERROR_NET_IF_UP_FAIL;
+					fi
+				
+					echo "$BR_UTIL addif $BR_INTF $ARG" >> $LOG
+					$BR_UTIL addif $BR_INTF $ARG 2> /dev/null
+					if [ $? != 0 ]; then
+						echo "Failed: $BR_UTIL addif $BR_INTF $ARG" >> $LOG
+						exit $ERROR_ADD_IF_FAIL;
+					fi
+				#	IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+				#	$IFCONFIG $ARG $IP_ADDR
+
+					#$SLEEP 1
+				fi
+				;;
+			*)
+				;;
+			esac
+		done
+	fi
+}
+#end of rtl_enable_net_if
+
+rtl_bridge() {
+	BR_NOT_EXIST=`$IFCONFIG $BR_INTF > /dev/null 2>&1; echo $?`
+	if [ "$PARA3" != "null" ]; then
+		#rtl_shutdown_net_if
+		rtl_enable_net_if
+	fi
+}
+
+
+rtl_bridge
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh b/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh
new file mode 100755
index 0000000..82049f4
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/default_setting.sh
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+## error code
+
+
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+
+if [ $# -lt 1 ]; then echo "Usage: $0 iface"; exit 1; fi
+ROOT=`nv get wifi_root_dir`
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_ROOT_DIR" ]; then
+    mkdir -p $CONFIG_ROOT_DIR
+fi
+
+if [ ! -d "$CONFIG_DIR" ]; then
+    mkdir -p $CONFIG_DIR
+fi
+
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_script_dir" ]; then
+	echo "/sbin" > $CONFIG_ROOT_DIR/wifi_script_dir
+fi
+if [ ! -f "$CONFIG_ROOT_DIR/wifi_bin_dir" ]; then
+	echo "/bin" > $CONFIG_ROOT_DIR/wifi_bin_dir
+fi
+
+WLAN_PREFIX=wlan
+
+case $1 in
+$WLAN_PREFIX[0-9]*)
+	EXT=${1#$WLAN_PREFIX[0-9]}
+	echo $EXT
+	;;
+*)
+	echo "invalid WLAN interface!($1)"
+	exit $ERROR_INVALID_PARAMETERS
+	;;
+esac
+
+echo "1" > $CONFIG_DIR/board_ver
+echo "00017301FA10" > $CONFIG_DIR/nic0_addr
+echo "00017301FA19" > $CONFIG_DIR/nic1_addr
+echo "00017301FA10" > $CONFIG_DIR/wlan0_addr
+echo "00017301FA11" > $CONFIG_DIR/wlan1_addr
+echo "00017301FA12" > $CONFIG_DIR/wlan2_addr
+echo "00017301FA13" > $CONFIG_DIR/wlan3_addr
+echo "00017301FA14" > $CONFIG_DIR/wlan4_addr
+echo "00017301FA15" > $CONFIG_DIR/wlan5_addr
+echo "00017301FA16" > $CONFIG_DIR/wlan6_addr
+echo "00017301FA17" > $CONFIG_DIR/wlan7_addr
+
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_cck_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_a
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_ht40_1s_b
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht40_2s
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ht20
+echo "0000000000000000000000000000" > $CONFIG_DIR/tx_power_diff_ofdm
+echo "3" > $CONFIG_DIR/reg_domain
+echo "0" > $CONFIG_DIR/11n_xcap
+echo "0" > $CONFIG_DIR/led_type
+echo "0" > $CONFIG_DIR/tssi_1
+echo "0" > $CONFIG_DIR/tssi_2
+echo "0" > $CONFIG_DIR/11n_ther
+echo "0" > $CONFIG_DIR/trswitch
+
+#wlan_mode: 0: AP, 1: Clienr(network_type=0)/AD-Hoc(network_type=1) 
+echo "0" >  $CONFIG_DIR/wlan_mode
+echo "0" >  $CONFIG_DIR/wlan_disabled
+echo "family-test$EXT" > $CONFIG_DIR/ssid
+echo "3" > $CONFIG_DIR/MIMO_TR_mode
+
+#channel: default channel
+echo "1" > $CONFIG_DIR/channel
+#ch_hi: Available highest channel
+echo "0" > $CONFIG_DIR/ch_hi
+#ch_low: Available lowest channel
+echo "0" > $CONFIG_DIR/ch_low
+#band: 64: 11AC, 8: 11N, 4: 11A, 2: 11G, 1: 11B; ex. 11 = 8 + 2 + 1 => BGN mode
+echo "11" > $CONFIG_DIR/band
+#basic_rate: 15=0x0f -> bit0-bit11 as 1,2,5.5,11,6,9,12,18,24,36,48,54
+echo "15" > $CONFIG_DIR/basic_rates
+echo "4095" > $CONFIG_DIR/supported_rate
+echo "1" > $CONFIG_DIR/rate_adaptive_enabled
+echo "0" > $CONFIG_DIR/fix_rate
+echo "2347" > $CONFIG_DIR/rts_threshold
+echo "2346" > $CONFIG_DIR/frag_threshold
+echo "30000" >  $CONFIG_DIR/inactivity_time	#unit:10ms
+echo "100" > $CONFIG_DIR/beacon_interval
+echo "1" > $CONFIG_DIR/dtim_period
+echo "0" > $CONFIG_DIR/preamble_type
+echo "0" > $CONFIG_DIR/hidden_ssid
+echo "0" > $CONFIG_DIR/supported_sta_num
+echo "1" > $CONFIG_DIR/protection_disabled
+echo "0" > $CONFIG_DIR/macclone_enable
+echo "0" > $CONFIG_DIR/iapp_enable
+echo "2" > $CONFIG_DIR/wifi_specific
+echo "0" > $CONFIG_DIR/vap_enable
+echo "0" > $CONFIG_DIR/group_id
+echo "0" > $CONFIG_DIR/block_relay
+echo "1" > $CONFIG_DIR/wmm_enabled
+echo "0" > $CONFIG_DIR/guest_access
+
+echo "0" > $CONFIG_DIR/wds_enable
+echo "0" > $CONFIG_DIR/wds_pure
+
+echo "0" > $CONFIG_DIR/macac_enabled
+echo "0" > $CONFIG_DIR/macac_num
+#echo "001122334455" > $CONFIG_DIR/macac_addr1
+#echo "001234567890" > $CONFIG_DIR/macac_addr2
+
+echo "0" > $CONFIG_DIR/countrycode_enable
+echo "US" > $CONFIG_DIR/countrycode
+
+echo "0" > $CONFIG_DIR/wapiType
+echo "1234567890" > $CONFIG_DIR/wapiPsk
+echo "a" > $CONFIG_DIR/wapiPsklen
+echo "2" > $CONFIG_DIR/auth_type
+echo "0" > $CONFIG_DIR/encrypt
+echo "2" > $CONFIG_DIR/wpa_auth
+echo "87654321" > $CONFIG_DIR/wpa_psk
+echo "2" > $CONFIG_DIR/wpa_cipher
+echo "2" > $CONFIG_DIR/wpa2_cipher
+echo "0" > $CONFIG_DIR/psk_enable
+echo "86400" > $CONFIG_DIR/gk_rekey
+echo "0" > $CONFIG_DIR/psk_format
+
+echo "0" > $CONFIG_DIR/wep
+echo "0" > $CONFIG_DIR/wep_default_key
+echo "1" > $CONFIG_DIR/wep_key_type
+echo "0987654321" > $CONFIG_DIR/wepkey1_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey2_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey3_64_hex
+echo "0987654321" > $CONFIG_DIR/wepkey4_64_hex
+echo "3534333231" > $CONFIG_DIR/wepkey1_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey2_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey3_64_asc
+echo "3534333231" > $CONFIG_DIR/wepkey4_64_asc
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey1_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey2_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey3_128_hex
+echo "12345678901234567890123456" > $CONFIG_DIR/wepkey4_128_hex
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey1_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey2_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey3_128_asc
+echo "31323334353637383930313233" > $CONFIG_DIR/wepkey4_128_asc
+#network_type: 0 - Client mode, 1 - AD-Hoc mode
+echo "0" > $CONFIG_DIR/network_type
+echo "" > $CONFIG_DIR/default_ssid
+echo "0" > $CONFIG_DIR/power_scale
+
+# channel_bonding: BW: 0 - 20M mode, 1 - 40M, 2 - 80M mode
+echo "0" > $CONFIG_DIR/channel_bonding
+#control_sideband: BW: 0 - lower 2nd channel offset , 1 - higher 2nd channel offset
+echo "0" > $CONFIG_DIR/control_sideband
+echo "1" > $CONFIG_DIR/aggregation
+echo "1" > $CONFIG_DIR/short_gi
+echo "0" > $CONFIG_DIR/stbc_enabled
+echo "0" > $CONFIG_DIR/coexist_enabled
+
+echo "0" > $CONFIG_DIR/enable_1x
+echo "0.0.0.0" > $CONFIG_DIR/rs_ip
+echo "1812" > $CONFIG_DIR/rs_port
+echo "" > $CONFIG_DIR/rs_password
+echo "3" > $CONFIG_DIR/rs_maxretry
+echo "5" > $CONFIG_DIR/rs_interval_time
+echo "0" > $CONFIG_DIR/mac_auth_enabled
+echo "0" > $CONFIG_DIR/enable_supp_nonwpa
+echo "0" > $CONFIG_DIR/supp_nonwpa
+echo "0" > $CONFIG_DIR/wpa2_pre_auth
+
+echo "0" > $CONFIG_DIR/account_rs_enabled
+echo "0.0.0.0" > $CONFIG_DIR/account_rs_ip
+echo "0" > $CONFIG_DIR/account_rs_port
+echo "" > $CONFIG_DIR/account_rs_password
+echo "0" > $CONFIG_DIR/account_rs_update_enabled
+echo "0" > $CONFIG_DIR/account_rs_update_delay
+echo "0" > $CONFIG_DIR/account_rs_maxretry
+echo "0" > $CONFIG_DIR/account_rs_interval_time
+
+echo "0" > $CONFIG_DIR/wsc_disabled
+echo "3" > $CONFIG_DIR/wsc_method
+echo "0" > $CONFIG_DIR/wsc_configured
+echo "1" > $CONFIG_DIR/wsc_auth
+echo "1" > $CONFIG_DIR/wsc_enc
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "1" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+echo "" > $CONFIG_DIR/wsc_ssid
+echo "" > $CONFIG_DIR/wsc_psk
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+echo "27006672" > $CONFIG_DIR/wsc_pin
+
+echo "0.0.0.0" > $CONFIG_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_DIR/net_mask
+
+echo "192.168.1.250" > $CONFIG_ROOT_DIR/ip_addr
+echo "255.255.255.0" > $CONFIG_ROOT_DIR/net_mask
+echo "RTL8192CD" > $CONFIG_ROOT_DIR/device_name
+echo "0" > $CONFIG_ROOT_DIR/band2g5g_select
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/init.sh b/ap/app/Script/wifi_script/realtek_wpa2/init.sh
new file mode 100755
index 0000000..8ac898a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/init.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-vxd"
+VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-vxd"
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE="$ROOT_WLAN-vxd"
+#VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $VIRTUAL_WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	VIRTUAL_WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_VIRTUAL_INTERFACE=$NUM
+	
+	
+
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+#		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+#		ISUP=`$IFCONFIG $WLAN >> $LOG | grep UP`
+		
+#		if [ "$WLAN_DISABLED_VALUE" = 0  -a  "$ISUP" = "" ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+#		else
+#			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE, ISUP=$ISUP" >> $LOG
+#		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start success"  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/init1.sh b/ap/app/Script/wifi_script/realtek_wpa2/init1.sh
new file mode 100755
index 0000000..91e37fc
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/init1.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: init.sh {gw | ap} {all | bridge | wan}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+#CUR_PATH=`pwd`
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+LOG1=$ROOT/wifi/realtek/slog1
+LOG_LIMIT=128 #128K 
+#if [ -e "$LOG"]; then
+	LOG_SIZE=`du $LOG | cut -f1`
+	if [ $LOG_SIZE -ge $LOG_LIMIT ]; then    
+		mv $LOG $LOG1
+	fi
+#else
+#	touch $LOG
+#fi
+
+SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+
+if [ -z "$SCRIPT_DIR" ] || [ -z "$BIN_DIR" ]; then
+	wifi_startup_fail_nvset
+	exit $ERROR_NULL_FILE;
+fi
+if [ ! -d "$SCRIPT_DIR" ]; then
+	echo "ERROR: $SCRIPT_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+if [ ! -d "$BIN_DIR" ]; then
+	echo "ERROR: $BIN_DIR specify the path NOT exist." >> $LOG
+	wifi_startup_fail_nvset
+	exit $ERROR_NO_SUCH_DIRECTORY;
+fi
+
+#PATH=$PATH:$BIN_DIR
+#export PATH
+
+START_BRIDGE=$SCRIPT_DIR/bridge1.sh
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+START_WLAN=$SCRIPT_DIR/wlan_8192c1.sh
+
+WLAN_PREFIX=wlan
+
+# the following fields must manually set depends on system configuration. Not support auto config.
+ROOT_WLAN=wlan0
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+WLAN_INTERFACE=$ROOT_WLAN
+NUM_INTERFACE=0
+#VIRTUAL_WLAN_INTERFACE="$ROOT_WLAN-va0 $ROOT_WLAN-va1 $ROOT_WLAN-va2 $ROOT_WLAN-va3"
+VIRTUAL_WLAN_INTERFACE=""
+NUM_VIRTUAL_INTERFACE=0
+VXD_INTERFACE=""
+ALL_WLAN_INTERFACE="$WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $VXD_INTERFACE"
+
+BR_UTIL=brctl
+IFCONFIG=ifconfig
+IWPRIV=iwpriv
+FLASH_PROG=flash
+
+export SCRIPT_DIR
+export BIN_DIR
+export WLAN_PREFIX
+export ROOT_WLAN
+export BR_UTIL
+
+
+wifi_startup_fail_nvset() {
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo "wlan0 start failed "  >> $LOG
+	echo " "  >> $LOG
+}
+rtl_get_available_wlan() {
+	NUM=0
+	VALID_WLAN_INTERFACE=""
+	for WLAN in $WLAN_INTERFACE ; do
+		NOT_EXIST=`$IFCONFIG $WLAN > /dev/null 2>&1; echo $?`
+		if [ $NOT_EXIST = 0 ]; then
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			if [ ! -d "$CONFIG_DIR" ]; then
+				echo "$CONFIG_DIR: No such directory"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERROR_NO_CONFIG_FILE
+			fi
+			
+			if [ -z "$VALID_WLAN_INTERFACE" ]; then
+				VALID_WLAN_INTERFACE="$WLAN"
+			else
+				VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+			fi
+			NUM=`expr $NUM + 1`
+		fi
+	done
+	
+	if [ "$NUM" = "0" ]; then
+		echo "$WLAN_INTERFACE: No such device"  >> $LOG
+		wifi_startup_fail_nvset
+		exit $ERROR_NO_SUCH_DEVICE;
+	fi
+	WLAN_INTERFACE=$VALID_WLAN_INTERFACE
+	NUM_INTERFACE=$NUM
+	
+	ALL_WLAN_INTERFACE="$WLAN_INTERFACE"
+}
+
+BR_INTERFACE=br0
+BR_LAN1_INTERFACE=eth0
+
+ENABLE_BR=1
+
+
+# Generate WPS PIN number
+rtl_generate_wps_pin() {
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		GET_VALUE=`cat $CONFIG_DIR/wsc_pin`
+		if [ "$GET_VALUE" = "00000000" ]; then
+			##echo "27006672" > $CONFIG_DIR/wsc_pin
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN
+			$BIN_DIR/$FLASH_PROG gen-pin $WLAN-vxd
+		fi
+	done
+}
+
+rtl_set_mac_addr() {
+	# Set Ethernet 0 MAC address
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/nic0_addr`
+	ELAN_MAC_ADDR=$GET_VALUE
+	$IFCONFIG $BR_LAN1_INTERFACE down
+	$IFCONFIG $BR_LAN1_INTERFACE hw ether $ELAN_MAC_ADDR
+}
+
+# Usage: rtl_has_enable_vap wlan_interface
+rtl_has_enable_vap() {
+	for INTF in $VIRTUAL_WLAN_INTERFACE ; do
+		case $INTF in
+		$1-va[0-9])
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$INTF
+			WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+			if [ "$WLAN_DISABLED_VALUE" = "0" ]; then
+				return 1
+			fi
+			;;
+		*)
+			;;
+		esac
+	done
+	
+	return 0
+}
+
+# Start WLAN interface
+rtl_start_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		echo "Initialize $WLAN interface" >> $LOG
+		$IFCONFIG $WLAN down
+		
+		case $WLAN in
+		$WLAN_PREFIX[0-9])		#ROOT_INTERFACE
+			NO_VAP=`$IFCONFIG $WLAN-va0 > /dev/null 2>&1; echo $?`
+			if [ $NO_VAP = 0 ]; then
+				rtl_has_enable_vap $WLAN
+				HAS_VAP=`echo $?`
+				$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP
+				echo "$IWPRIV $WLAN set_mib vap_enable=$HAS_VAP" >> $LOG
+			fi
+			;;
+		$WLAN_PREFIX[0-9]-vxd) ## station interface
+#			echo "$IWPRIV $WLAN copy_mib" >> $LOG
+#			$IWPRIV $WLAN copy_mib
+#			WPA_SUPPLICAT=`ps | grep wpa_supplicant | grep -v grep`
+#			echo "SUPPLICAT=$WPA_SUPPLICAT"  >> $LOG
+			;;
+		*)
+			;;
+		esac
+		
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<${START_WLAN##*/} $WLAN>>>" >> $LOG
+			$START_WLAN $WLAN
+			ERR=`echo $?`
+			if [ $ERR != 0 ]; then
+				echo "$START_WLAN $WLAN  failed"  >> $LOG
+				wifi_startup_fail_nvset
+				exit $ERR;
+			fi
+		else
+			echo "$WLAN WLAN_DISABLED_VALUE=$WLAN_DISABLED_VALUE" >> $LOG
+		fi
+	done
+}
+
+# Enable WLAN interface
+rtl_enable_wlan_if() {
+	for WLAN in $ALL_WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		WLAN_DISABLED_VALUE=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$WLAN_DISABLED_VALUE" = 0 ]; then
+			echo "<<<ENABLE $WLAN>>>"
+			IP_ADDR=`cat $CONFIG_DIR/ip_addr`
+			$IFCONFIG $WLAN $IP_ADDR
+			$IFCONFIG $WLAN up
+			if [ $? != 0 ]; then
+				wifi_startup_fail_nvset
+				echo "ERROR ifconfig $WLAN up fail" >> $LOG
+ 				exit $ERROR_NET_IF_UP_FAIL;
+			fi
+		fi
+	done
+}
+
+rtl_start_no_gw() {
+	echo "<<<${START_BRIDGE##*/} $BR_INTERFACE $BR_LAN1_INTERFACE $WLAN_INTERFACE>>>"  >> $LOG
+	$START_BRIDGE $BR_INTERFACE  $WLAN_INTERFACE
+	ERR=`echo $?`
+	if [ $ERR != 0 ]; then
+		wifi_startup_fail_nvset
+		exit $ERR;
+	fi
+	#CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+	#GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	#echo "222 GET_WPA_PSK is "$GET_WPA_PSK
+	#echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>"
+	#$START_WLAN_APP start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE
+	#ERR=`echo $?`
+	#if [ $ERR != 0 ]; then
+	#	exit $ERR;
+	#fi
+}
+
+
+rtl_init() {
+	date +[%H:%M:%S]init1.shstarttttttttttttttttt >> $LOG
+	killall webs 2> /dev/null
+	$BIN_DIR/webs -x
+	
+	echo "realtek rtl_get_available_wlan" >> $LOG
+	rtl_get_available_wlan
+##	rtl_set_mac_addr
+
+
+
+	echo "realtek rtl_start_wlan_if" >> $LOG
+	rtl_start_wlan_if
+	
+#NO_EXIST=1
+	NO_EXIST=`$BR_UTIL > /dev/null 2>&1; echo $?`
+	if [ "$NO_EXIST" = "127" ]; then
+		echo "$BR_UTIL: NOT exist."  >> $LOG
+		rtl_enable_wlan_if
+	else
+		#rtl_generate_wps_pin
+		echo "realtek rtl_start_no_gw"  >> $LOG
+		rtl_start_no_gw
+	fi
+	
+    #iwpriv wlan0 stopps 1
+    #iwpriv wlan0 set_mib ps_level=0	
+	
+	  
+	date +[%H:%M:%S]init1.shenddddddddddddddddddd >> $LOG
+	echo " "  >> $LOG
+	echo " "  >> $LOG
+}
+
+rtl_init
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh
new file mode 100755
index 0000000..13c7e4b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter kill_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh
new file mode 100755
index 0000000..485b63f
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/kill_wps1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: kill_wps.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter kill_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+BR_INTERFACE="br0"
+echo "<<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP kill $WLAN_INTERFACE $VIRTUAL_WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh b/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh
new file mode 100755
index 0000000..dbe02cf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/para_set.sh
@@ -0,0 +1,363 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+	
+	$IFCONFIG $1-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+fi
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+echo "set RF parameters" >> $LOG
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+		$SET_VA0 set_mib deny_legacy=3
+		$SET_VA1 set_mib deny_legacy=3			
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1		
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+		$SET_VA0 set_mib deny_legacy=1
+		$SET_VA1 set_mib deny_legacy=1			
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+		$SET_VA0 set_mib deny_legacy=12
+		$SET_VA1 set_mib deny_legacy=12			
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+		$SET_VA0 set_mib deny_legacy=4
+		$SET_VA1 set_mib deny_legacy=4		
+	else
+		$SET_WLAN set_mib deny_legacy=0
+		$SET_VA0 set_mib deny_legacy=0
+		$SET_VA1 set_mib deny_legacy=0
+	fi
+	$SET_WLAN set_mib band=$GET_BAND
+	$SET_VA0 set_mib band=$GET_BAND
+	$SET_VA1 set_mib band=$GET_BAND
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+else
+## for va0 va1 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	fi
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+if [ $IS_ROOT_WLAN = 1 ]; then
+	$IFCONFIG $1-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+
+	MSSID=`nv get m_ssid_enable`	
+
+	if [ $MSSID = 1 ]; then
+		$IFCONFIG $1-va1 up
+		if [ $? != 0 ]; then
+			exit $ERROR_NO_SUCH_DEVICE
+		fi
+	fi
+fi
+
+date +[%H:%M:%S]paraset_$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh b/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh
new file mode 100755
index 0000000..e70a0ad
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/para_set1.sh
@@ -0,0 +1,318 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+date +[%H:%M:%S]paraset_$1_start >> $LOG
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+
+
+# set channel
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+
+# set wifi coverage	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+# for country code
+	COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+	if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+		$SET_WLAN set_mib countrycode=$GET_VALUE
+
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+		$SET_WLAN set_mib countrystr=$GET_VALUE
+	fi
+	
+	
+#set band	  bgn
+	GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+	GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+	if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+		GET_BAND=3
+	fi
+	if [ "$GET_BAND" = '8' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=3
+	elif [ "$GET_BAND" = '2' ]; then
+		GET_BAND=3
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '10' ]; then
+		GET_BAND=11
+		$SET_WLAN set_mib deny_legacy=1
+	elif [ "$GET_BAND" = '64' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=12
+	elif [ "$GET_BAND" = '72' ]; then
+		GET_BAND=76
+		$SET_WLAN set_mib deny_legacy=4
+	else
+		$SET_WLAN set_mib deny_legacy=0
+	fi
+	
+	$SET_WLAN set_mib band=$GET_BAND	
+
+
+###Set 11n parameter
+		if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+			if [ $IS_ROOT_WLAN = 1 ]; then
+				GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+				$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+				GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+				if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+					$SET_WLAN set_mib 2ndchoffset=0
+				else
+					if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=1
+					fi
+					if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+						 $SET_WLAN set_mib 2ndchoffset=2
+					fi
+				fi
+			fi # [ $IS_ROOT_WLAN = 1 ]
+
+		GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+		$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+		fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+	
+
+## for wlan0 set ssid 
+echo "set basic ap parameters" >> $LOG
+	GET_VALUE=`cat $CONFIG_DIR/ssid`
+	$SET_WLAN set_mib ssid="$GET_VALUE"
+	
+	GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+	$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+	GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+	$SET_WLAN set_mib stanum=$GET_VALUE
+
+	# for ap isolation 
+	# need to confirm which is for ap isolation
+	#GET_VALUE=`cat $CONFIG_DIR/group_id`
+	#$SET_WLAN set_mib groupID=$GET_VALUE
+
+	# set block relay
+	GET_VALUE=`cat $CONFIG_DIR/block_relay`
+	$SET_WLAN set_mib block_relay=$GET_VALUE
+
+
+	GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+	AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+	GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+	if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+		# shared-key and not WEP enabled, force to open-system
+		AUTH_TYPE=0
+	fi
+	$SET_WLAN set_mib authtype=$AUTH_TYPE
+	if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+		$SET_WLAN set_mib encmode=0
+	elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+		### WEP mode ##
+		GET_WEP=`cat $CONFIG_DIR/wep`
+		GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+		GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+		
+		if [ "$GET_WEP" = '1' ]; then
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+			fi
+		
+			$SET_WLAN set_mib encmode=1
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		else
+			if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+			else
+				GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+				GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+				GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+				GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+			fi
+			$SET_WLAN set_mib encmode=5
+			$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+			$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+			$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+			$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+			$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+		fi
+	else
+			## WPA mode ##
+		$SET_WLAN set_mib encmode=2
+	fi
+
+
+	## Set 802.1x flag ##
+	_ENABLE_1X=0
+	if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+		GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+		GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+		if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+			_ENABLE_1X=1
+		fi
+	else
+		_ENABLE_1X=1
+	fi
+	$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	
+
+	echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+	GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+	#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+	if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+		if [ $GET_WPA_AUTH = 2 ]; then
+			if [ $GET_WLAN_ENCRYPT = 2 ]; then
+				ENABLE=1
+			elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+				ENABLE=2
+			elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+				ENABLE=3
+			else
+				echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+			$SET_WLAN set_mib psk_enable=$ENABLE
+		else
+			$SET_WLAN set_mib psk_enable=0
+		fi
+
+		if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+			if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+		if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+			GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+			if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+				CIPHER=2
+			elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+				CIPHER=8
+			elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+				CIPHER=10
+			else
+				echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+				exit $ERROR_INVALID_PARAMETERS;
+			fi
+		fi
+		$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+		GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+		$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	fi
+
+
+
+
+$IFCONFIG $1 up
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+
+
+
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh
new file mode 100755
index 0000000..d42f57c
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter trigger_wps.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh
new file mode 100755
index 0000000..c020f1a
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/trigger_wps1.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: trigger_wps.sh 
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+
+ID=`nv get wifi_wps_index`
+echo "enter trigger_wps1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+
+
+WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+
+echo "enter trigger_wps1.sh WPS_MODE=$WPS_MODE >>>>>>>>" >> $LOG
+
+if [ "$WPS_MODE" = "2" ]; then
+	echo "wscd -sig_pbc $WLAN_INTERFACE" >> $LOG
+	wscd -sig_pbc $WLAN_INTERFACE
+else
+	PIN=`cat $CONFIG_DIR/wsc_pin`
+	echo "iwpriv $WLAN_INTERFACE set_mib pin=$PIN" >> $LOG
+	iwpriv $WLAN_INTERFACE set_mib pin=$PIN
+fi
+
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh
new file mode 100755
index 0000000..0c669b8
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c.sh
@@ -0,0 +1,595 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+## first start up, must be single ap, wlan0 used 12345678ffbb , then to apsta, or mssid
+## ap to apsta: wlan0 need reset mac
+## ap to mssid: wlan0 no need reset mac
+## apsta to mssid: wlan0 need reset mac
+## apsta to ap: wlan0 need reset mac
+## mssid to apsta: wlan0 need reset mac
+## mssid to ap: wlan0 no need reset mac
+##
+
+## if mssid wlan0 use fixded mac, if vxd up, wlan0 use wlan0_addr
+
+if [ "1" = "2" ];then
+
+	MSSID=`nv get m_ssid_enable`
+	APSTA=`nv get wifi_sta_connection`
+
+	if [ "$1" = "wlan0" ];then
+		if [ "$APSTA" = "0" -a "$MSSID" = "0" ];then
+	### single ap	
+			GET_VALUE=12345678ffbb
+	### multissid		
+		elif ["$MSSID" = "1" ];then
+			GET_VALUE=12345678ffbb
+	### apsta		
+		elif [ "$APSTA" = "1" ];then
+			GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		fi
+		$IFCONFIG $1 hw ether $GET_VALUE
+	else
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		$IFCONFIG $1 hw ether $GET_VALUE
+	fi
+	echo "$IFCONFIG $1 hw ether $GET_VALUE NOT GO here><><>" >> $LOG
+
+else
+
+	if [ "$1" = "wlan0" ];then
+##wlan0 use fixed addr	
+		GET_VALUE=12345678ffbb
+		
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+		#$IFCONFIG $1 hw ether $GET_VALUE
+	else
+	
+		if [ "$1" = "wlan0-vxd" ];then
+			echo "$IWPRIV $1 copy_mib" >> $LOG
+			$IWPRIV $1 copy_mib
+		fi
+	
+		GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+		#$IFCONFIG $1 hw ether $GET_VALUE
+		iwpriv $1 set_mib hwaddr=$GET_VALUE
+	fi
+fi
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+#	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+#	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+#		$SET_WLAN set_mib ch_low=5
+		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+	GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+	$SET_WLAN set_mib countrystr=$GET_VALUE
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+#IEEE80211W_ENABLE=`$SET_WLAN get_mib dot11IEEE80211W 2> /dev/null`
+#if [ ! -z "$IEEE80211W_ENABLE" ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+#	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+#fi
+##########
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh
new file mode 100755
index 0000000..924212e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_8192c1.sh
@@ -0,0 +1,547 @@
+#!/bin/sh
+#
+# script file to start WLAN
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+
+IWPRIV=iwpriv
+wifi_lte_intr=`nv get wifi_lte_intr`
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+ROOT=`nv get wifi_root_dir`
+
+LOG=$ROOT/wifi/realtek/slog
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/$1
+echo "$1 config para" >> $LOG
+if [ ! -d "$CONFIG_DIR" ]; then
+	echo "$CONFIG_DIR: No such directory" >> $LOG
+	exit $ERROR_NO_CONFIG_FILE
+fi
+
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+#echo $SCRIPT_DIR
+#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
+### delete -va0 get wlan0
+	ROOT_WLAN=${1%%-*}  
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+IS_ROOT_WLAN=0
+if [ "$1" = "$ROOT_WLAN" ]; then
+	IS_ROOT_WLAN=1
+fi
+echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+
+## Disable WLAN MAC driver and shutdown interface first ##
+$IFCONFIG $1 down
+if [ $? != 0 ]; then
+	exit $ERROR_NO_SUCH_DEVICE
+fi
+
+GET_VALUE=
+GET_VALUE_TMP=
+GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+
+echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
+echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
+
+
+##$SET_WLAN set_mib vap_enable=0
+$SET_WLAN set_mib wsc_enable=0
+
+## kill wlan application daemon ##
+
+##$START_WLAN_APP kill $1
+
+## Set parameters to driver ##
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
+$SET_WLAN set_mib regdomain=$GET_VALUE
+
+NUM=0
+case $1 in
+$ROOT_WLAN-va*)
+	NUM=${1#$ROOT_WLAN-va}
+	#NUM=$((NUM + 1))
+	NUM=`expr $NUM + 1`	
+	;;
+esac
+
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
+iwpriv $1 set_mib hwaddr=$GET_VALUE
+
+echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
+
+if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	## client mode 0: infrastructure  1:Ad-hoc
+	
+	hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
+	
+	echo wlan0-vxd hwaddr=$hwaddr >> $LOG
+	
+	GET_VALUE=`cat $CONFIG_DIR/network_type`
+	if  [ "$GET_VALUE" = '0' ]; then
+		$SET_WLAN set_mib opmode=8
+	else
+		$SET_WLAN set_mib opmode=32
+		GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
+		$SET_WLAN set_mib defssid="$GET_VALUE_TMP"
+	fi
+	echo "wlan0-vxd do not set para, exit directly" >> $LOG
+	exit $ERROR_SUCCESS
+else
+	## AP mode
+	$SET_WLAN set_mib opmode=16
+fi
+##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
+
+##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
+##		$SET_WLAN set_mib wds_pure=1
+##else
+##		$SET_WLAN set_mib wds_pure=0
+##fi
+
+echo "set RF parameters" >> $LOG
+# set RF parameters
+if [ $IS_ROOT_WLAN = 1 ]; then
+	GET_VALUE=`cat $CONFIG_DIR/channel`
+	$SET_WLAN set_mib channel=$GET_VALUE
+##autochannel can use wifi_lte_intr
+	if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
+		echo "wifi_lte_intr=$wifi_lte_intr  $SET_WLAN set_mib ch_low=5" >> $LOG	
+		$SET_WLAN set_mib ch_low=5
+#		$SET_WLAN set_mib disable_acs_ch=15
+	else
+		GET_VALUE=`cat $CONFIG_DIR/ch_low`
+		$SET_WLAN set_mib ch_low=$GET_VALUE
+	fi
+	
+	GET_VALUE=`cat $CONFIG_DIR/ch_hi`
+	$SET_WLAN set_mib ch_hi=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/led_type`
+	$SET_WLAN set_mib led_type=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
+	$SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
+	
+	#GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
+	#GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
+	#GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
+	#GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
+
+	#GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
+	#GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
+	#GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
+
+	#$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
+	#$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
+	#$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
+	#$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
+	#$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
+	#$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
+	#$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
+	
+	GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
+	#echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
+	$SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
+	
+	GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
+	$SET_WLAN set_mib tssi1=$GET_11N_TSSI1
+	GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
+	$SET_WLAN set_mib tssi2=$GET_11N_TSSI2
+	
+	#GET_VALUE=`cat $CONFIG_DIR/11n_ther`
+	#$SET_WLAN set_mib ther=$GET_VALUE
+	
+	GET_VALUE=`cat $CONFIG_DIR/trswitch`
+	$SET_WLAN set_mib trswitch=$GET_VALUE
+
+	#GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
+	#$SET_WLAN set_mib xcap=$GET_VALUE
+	
+	#GET_VALUE=`cat $CONFIG_DIR/rfe_type`
+	#$SET_WLAN set_mib rfe_type=$GET_VALUE
+	
+	#exit $ERROR_SUCCESS
+	
+#	iwpriv wlan0 efuse_set SD=3
+#	iwpriv wlan0 efuse_sync
+#	iwpriv wlan0 set_mib func_off=1
+
+fi # [ $IS_ROOT_WLAN = 1 ]
+	
+GET_VALUE=`cat $CONFIG_DIR/basic_rates`
+$SET_WLAN set_mib basicrates=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_rate`
+$SET_WLAN set_mib oprates=$GET_VALUE
+	
+GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
+if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
+	$SET_WLAN set_mib autorate=0
+	GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
+	$SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
+else
+	$SET_WLAN set_mib autorate=1
+fi
+
+GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
+$SET_WLAN set_mib rtsthres=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
+$SET_WLAN set_mib fragthres=$GET_VALUE
+	
+GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
+$SET_WLAN set_mib expired_time=$GET_VALUE
+GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
+$SET_WLAN set_mib bcnint=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
+$SET_WLAN set_mib dtimperiod=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/preamble_type`
+$SET_WLAN set_mib preamble=$GET_VALUE
+GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
+$SET_WLAN set_mib hiddenAP=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
+$SET_WLAN set_mib stanum=$GET_VALUE
+
+GET_VALUE=`cat $CONFIG_DIR/ssid`
+$SET_WLAN set_mib ssid="$GET_VALUE"
+
+GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
+$SET_WLAN set_mib aclmode=$GET_VALUE
+$SET_WLAN set_mib aclnum=0
+#ACL_NUM=`cat $CONFIG_DIR/macac_num`
+#_counter=1
+#while [ $_counter -le $ACL_NUM ]; do
+#	GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
+	#$SET_WLAN set_mib acladdr=$GET_VALUE
+#	echo "----add_acl_table is "$GET_VALUE
+	#$SET_WLAN add_acl_table $GET_VALUE
+#	_counter=$((_counter + 1))
+#done
+
+GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
+AUTH_TYPE=$GET_WLAN_AUTH_TYPE
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
+	# shared-key and not WEP enabled, force to open-system
+	AUTH_TYPE=0
+fi
+$SET_WLAN set_mib authtype=$AUTH_TYPE
+if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
+	$SET_WLAN set_mib encmode=0
+elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
+	### WEP mode ##
+	GET_WEP=`cat $CONFIG_DIR/wep`
+	GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
+	GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
+	
+	if [ "$GET_WEP" = '1' ]; then
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
+		fi
+	
+		$SET_WLAN set_mib encmode=1
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	else
+		if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
+		else
+			GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
+			GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
+			GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
+			GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
+		fi
+		$SET_WLAN set_mib encmode=5
+		$SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
+		$SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
+		$SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
+		$SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
+		$SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
+	fi
+else
+        ## WPA mode ##
+	$SET_WLAN set_mib encmode=2
+fi
+##$SET_WLAN set_mib wds_enable=0
+##$SET_WLAN set_mib wds_encrypt=0
+## Set 802.1x flag ##
+_ENABLE_1X=0
+if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
+	GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+	GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+	if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+		_ENABLE_1X=1
+	fi
+else
+	_ENABLE_1X=1
+fi
+$SET_WLAN set_mib 802_1x=$_ENABLE_1X
+	#set band
+GET_BAND=`cat $ROOT_CONFIG_DIR/band`
+GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
+if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] &&  [ "$GET_BAND" = '2' ] ; then
+	GET_BAND=3
+fi
+if [ "$GET_BAND" = '8' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=3
+elif [ "$GET_BAND" = '2' ]; then
+	GET_BAND=3
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '10' ]; then
+	GET_BAND=11
+	$SET_WLAN set_mib deny_legacy=1
+elif [ "$GET_BAND" = '64' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=12
+elif [ "$GET_BAND" = '72' ]; then
+	GET_BAND=76
+	$SET_WLAN set_mib deny_legacy=4
+else
+	$SET_WLAN set_mib deny_legacy=0
+fi
+$SET_WLAN set_mib band=$GET_BAND
+
+
+echo "Set 11n parameter"  >> $LOG
+###Set 11n parameter
+	if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
+	if [ $IS_ROOT_WLAN = 1 ]; then
+		GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
+		$SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
+
+		GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
+
+		if [ "$GET_CHANNEL_BONDING" = 0 ]; then
+			$SET_WLAN set_mib 2ndchoffset=0
+		else
+			if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=1
+			fi
+			if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
+				 $SET_WLAN set_mib 2ndchoffset=2
+			fi
+		fi
+	fi # [ $IS_ROOT_WLAN = 1 ]
+
+	GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
+	$SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
+	$SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
+
+	GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
+
+	if [ "$GET_AGGREGATION" = 0 ]; then
+		$SET_WLAN set_mib ampdu=$GET_AGGREGATION
+		$SET_WLAN set_mib amsdu=$GET_AGGREGATION
+	elif [ "$GET_AGGREGATION" = 1 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=0
+	elif [ "$GET_AGGREGATION" = 2 ]; then
+		$SET_WLAN set_mib ampdu=0
+		$SET_WLAN set_mib amsdu=1
+	elif [ "$GET_AGGREGATION" = 3 ]; then
+		$SET_WLAN set_mib ampdu=1
+		$SET_WLAN set_mib amsdu=1
+	fi
+
+	GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
+	$SET_WLAN set_mib stbc=$GET_STBC_ENABLED
+	GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
+	$SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
+	fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
+##########
+
+#set nat2.5 disable when client and mac clone is set
+GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
+if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
+	$SET_WLAN set_mib nat25_disable=1
+	$SET_WLAN set_mib macclone_enable=1
+else
+	$SET_WLAN set_mib nat25_disable=0
+	$SET_WLAN set_mib macclone_enable=0
+fi
+
+# set 11g protection mode
+GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
+if  [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
+	$SET_WLAN set_mib disable_protection=1
+else
+	$SET_WLAN set_mib disable_protection=0
+fi
+
+# for ap isolation
+GET_VALUE=`cat $CONFIG_DIR/group_id`
+$SET_WLAN set_mib groupID=$GET_VALUE
+
+# set block relay
+GET_VALUE=`cat $CONFIG_DIR/block_relay`
+$SET_WLAN set_mib block_relay=$GET_VALUE
+	
+	
+# set WiFi specific mode
+GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
+$SET_WLAN set_mib wifi_specific=$GET_VALUE
+
+# for WMM
+GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
+$SET_WLAN set_mib qos_enable=$GET_VALUE
+
+# for guest access
+GET_VALUE=`cat $CONFIG_DIR/guest_access`
+$SET_WLAN set_mib guest_access=$GET_VALUE
+
+
+
+# for country code
+#COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
+if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
+#	$SET_WLAN set_mib countrycode=$GET_VALUE
+
+GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
+#	$SET_WLAN set_mib countrystr=$GET_VALUE
+
+
+fi
+
+echo "wpa relative settings"  >> $LOG
+#
+# following settings is used when driver WPA module is included
+#
+
+GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
+#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
+if [ $GET_WLAN_ENCRYPT -ge 2 ]  && [ $GET_WLAN_ENCRYPT -lt 7 ]; then
+	if [ $GET_WPA_AUTH = 2 ]; then
+		if [ $GET_WLAN_ENCRYPT = 2 ]; then
+			ENABLE=1
+		elif [ $GET_WLAN_ENCRYPT = 4 ]; then
+			ENABLE=2
+		elif [ $GET_WLAN_ENCRYPT = 6 ]; then
+			ENABLE=3
+		else
+			echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+		$SET_WLAN set_mib psk_enable=$ENABLE
+	else
+		$SET_WLAN set_mib psk_enable=0
+	fi
+
+	if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
+		if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa_cipher=$CIPHER
+
+	if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+		GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
+		if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
+			CIPHER=2
+		elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
+			CIPHER=8
+		elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
+			CIPHER=10
+		else
+			echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
+			exit $ERROR_INVALID_PARAMETERS;
+		fi
+	fi
+	$SET_WLAN set_mib wpa2_cipher=$CIPHER
+
+	GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
+	$SET_WLAN set_mib passphrase=$GET_WPA_PSK
+
+	
+	GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
+	$SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
+fi
+# Set 11w parameter #
+#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	if [ $GET_WPA2_11W = 0 ]; then
+#		GET_WPA2_SHA256=0
+#	elif [ $GET_WPA2_11W = 1 ]; then
+#		if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
+#			GET_WPA2_SHA256=0
+#		fi
+#	elif [ $GET_WPA2_11W = 2 ]; then
+#		GET_WPA2_SHA256=1
+#	else
+#		echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
+#		exit $ERROR_INVALID_PARAMETERS;
+#	fi
+#else
+#	GET_WPA2_11W=0
+#	GET_WPA2_SHA256=0
+#fi
+#IEEE80211W_ENABLE=`$SET_WLAN get_mib dot11IEEE80211W 2> /dev/null`
+#if [ ! -z "$IEEE80211W_ENABLE" ]; then
+#	GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
+#	GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
+#	$SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
+#	$SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
+#fi
+##########
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh
new file mode 100755
index 0000000..9dbff1b
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlan_basic_deal.sh
@@ -0,0 +1,180 @@
+#!/bin/sh
+#
+# script file to down up WLAN quickly
+#
+
+
+## error code
+ERROR_SUCCESS=0
+ERROR_INVALID_PARAMETERS=1
+ERROR_NO_SUCH_DEVICE=2
+ERROR_NO_CONFIG_FILE=3
+ERROR_NO_SUCH_FILE=4
+ERROR_NO_SUCH_DIRECTORY=5
+ERROR_NULL_FILE=6
+ERROR_NET_IF_UP_FAIL=7
+ERROR_ADD_BR_FAIL=8
+ERROR_ADD_IF_FAIL=9
+
+
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+IWPRIV=iwpriv
+BR_UTIL=brctl
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 wlan_interface" >> $LOG
+	exit $ERROR_INVALID_PARAMETERS;
+fi
+
+SET_WLAN="iwpriv $1"
+SET_WLAN_PARAM="$SET_WLAN set_mib"
+IFCONFIG=ifconfig
+SET_VA0="iwpriv wlan0-va0"
+SET_VA1="iwpriv wlan0-va1"
+
+
+
+
+br0_add_va1()
+{
+	HAS_BEEN_ADDED=`$BR_UTIL show | grep va1`
+	if [ -z "$HAS_BEEN_ADDED" ]; then
+		echo "$BR_UTIL addif br0 wlan0-va1"  >> $LOG
+		$BR_UTIL addif br0 wlan0-va1 2> /dev/null
+		
+		if [ $? != 0 ]; then
+			echo "Failed: $BR_UTIL addif br0 wlan0-va1"  >> $LOG
+			exit $ERROR_ADD_IF_FAIL;
+		fi
+
+	fi
+}
+
+ifconfig_wlan0_up()
+{
+	ifconfig wlan0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_down()
+{
+	ifconfig wlan0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_up()
+{
+	ifconfig wlan0-va0 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va0_down()
+{
+	ifconfig wlan0-va0 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_up()
+{
+	ifconfig wlan0-va1 up
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+ifconfig_wlan0_va1_down()
+{
+	ifconfig wlan0-va1 down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+ifconfig_wlan0_vxd_down()
+{
+	ifconfig wlan0-vxd down
+	if [ $? != 0 ]; then
+		exit $ERROR_NO_SUCH_DEVICE
+	fi
+}
+
+basic_open_va0()
+{
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+}				
+
+basic_open_va0_va1()
+{
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num`
+    iwpriv wlan0-va1  set_mib  stanum=`nv get  m_MAX_Access_num`
+	ifconfig_wlan0_up
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_open_va1()
+{
+	ifconfig_wlan0_va0_down
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib stanum=`nv get m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+basic_close_va1()
+{
+	iwpriv	wlan0-va1  clear_acl_table
+	ifconfig_wlan0_va1_down
+	
+	ifconfig_wlan0_va0_down	
+	iwpriv wlan0-va0 set_mib stanum=`nv get MAX_Access_num` 
+	ifconfig_wlan0_va0_up
+}
+
+basic_closesta_openmssid()
+{
+	ifconfig_wlan0_va0_down 
+	ifconfig_wlan0_vxd_down
+	iwpriv wlan0-va0 set_mib  stanum=`nv get  MAX_Access_num` 
+	iwpriv wlan0-va1 set_mib  stanum=`nv get  m_MAX_Access_num` 
+	ifconfig_wlan0_va0_up 
+	ifconfig_wlan0_va1_up
+	br0_add_va1
+}
+
+
+main()
+{
+	if [ "$1" == "open_va0" ]; then
+		basic_open_va0
+	elif  [ "$1" == "open_va1" ]; then
+		basic_open_va1
+	elif [ "$1" == "close_va1" ]; then
+		basic_close_va1
+	elif [ "$1" == "open_va0_va1"  ]; then
+		basic_open_va0_va1
+	elif  [  "$1" == "close_sta_open_va1" ] ; then
+		basic_closesta_openmssid
+	else
+		echo "$1 para wrong"  >> $LOG
+		exit $ERROR_INVALID_PARAMETERS;
+	fi
+
+}
+
+date +[%H:%M:%S]$1_start >> $LOG
+main $1
+date +[%H:%M:%S]$1_end >> $LOG
+exit $ERROR_SUCCESS
\ No newline at end of file
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh b/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh
new file mode 100755
index 0000000..3848dbf
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wlanapp_8192c.sh
@@ -0,0 +1,464 @@
+#!/bin/sh
+#
+# script file to start wlan applications (IAPP, Auth, Autoconf) daemon
+#
+# Usage: wlanapp.sh [start|kill] wlan_interface...br_interface
+#
+
+## error code
+ERROR_WSCD_START_FAIL=8
+
+if [ $# -lt 2 ] || [ $1 != 'start' -a $1 != 'kill' ] ; then 
+	echo "Usage: $0 [start|kill] wlan_interface...br_interface" >> $LOG
+	exit 1 
+fi
+#CUR_PATH=`pwd`
+#TOP_VAR_DIR="/etc_ro"
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+TOP_VAR_DIR="$ROOT/wifi/realtek"
+TOP_ETC_DIR="/etc_ro/realtek/ath"
+TOP_TMP_DIR="$ROOT/tmp"
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+if [ ! -d "$TOP_TMP_DIR" ]; then
+    mkdir $TOP_TMP_DIR
+fi
+
+if [ -z "$BIN_DIR" ]; then
+	BIN_DIR=`cat $CONFIG_ROOT_DIR/wifi_bin_dir`
+fi
+
+if [ -z "$WLAN_PREFIX" ]; then
+	WLAN_PREFIX=wlan
+fi
+#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
+#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
+
+if [ -z "$ROOT_WLAN" ]; then
+#	ROOT_WLAN=${2:0:$WLAN_NAME_LEN}
+	ROOT_WLAN=${2%%-*}
+fi
+ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
+
+GET_VALUE=
+GET_VALUE_TMP=
+KILLALL=killall
+FLASH_PROG=flash
+SLEEP=sleep
+
+START=1
+PARAM_NUM=$#
+PARAM_ALL=$*
+PARAM1=$1
+PARAM_BR=
+WLAN_INTERFACE=
+
+WLAN0_MODE=
+WLAN0_DISABLED=
+WLAN0_WSC_DISABLED=
+
+WLAN1_MODE=0
+WLAN1_DISABLED=1
+WLAN1_WSC_DISABLED=1
+both_band_ap=0
+
+rtl_check_wlan_band(){
+
+	WLAN0_MODE=`cat $CONFIG_ROOT_DIR/wlan0/wlan_mode`
+	WLAN0_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wlan_disabled`
+	WLAN0_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan0/wsc_disabled`
+
+	if [ -d "$CONFIG_ROOT_DIR/wlan1" ] ; then
+		WLAN1_MODE=`cat $CONFIG_ROOT_DIR/wlan1/wlan_mode`
+		WLAN1_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wlan_disabled`
+		WLAN1_WSC_DISABLED=`cat $CONFIG_ROOT_DIR/wlan1/wsc_disabled`
+	fi
+
+	if [ "$WLAN0_MODE" = "0" -o "$WLAN0_MODE" = "3" ] && [ "$WLAN1_MODE" = "0" -o "$WLAN1_MODE" = "3" ] && [ "$WLAN0_DISABLED" = "0" ] && [ "$WLAN1_DISABLED" = "0" ] && [ "$WLAN0_WSC_DISABLED" = "0" ] && [ "$WLAN1_WSC_DISABLED" = "0" ]; then
+		both_band_ap = 1
+	fi
+}
+
+rtl_check_wlan_if() {
+
+	echo "wlanapp_8192c.sh --rtl_check_wlan_if" >> $LOG
+
+	if [ $PARAM_NUM -ge 1 ]; then
+		for ARG in $PARAM_ALL ; do
+			case $ARG in
+			$WLAN_PREFIX*)
+				if [ -z "$WLAN_INTERFACE" ]; then
+					WLAN_INTERFACE="$ARG"
+				else
+					WLAN_INTERFACE="$WLAN_INTERFACE $ARG"
+				fi
+				;;
+			*)
+				PARAM_BR=$ARG
+				;;
+			esac
+		done
+	fi
+}
+	
+DEBUG_EASYCONF=
+VXD_INTERFACE=
+
+
+## kill 802.1x, autoconf and IAPP daemon ##
+rtl_kill_iwcontrol_pid() { 
+	PIDFILE="$TOP_VAR_DIR/run/iwcontrol.pid"
+	echo "wlanapp_8192c.sh --rtl_kill_iwcontrol_pid"  >> $LOG
+	if [ -f $PIDFILE ] ; then
+		PID=`cat $PIDFILE`
+		echo "IWCONTROL_PID=$PID"  >> $LOG
+		if [ "$PID" != "0" ]; then
+			kill -9 $PID 2>/dev/null
+		fi
+		rm -f $PIDFILE
+	fi
+}
+
+
+rtl_kill_wlan_pid() {
+
+	echo "wlanapp_8192c.sh --rtl_kill_wlan_pid"  >>  $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN.pid
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "AUTH_PID=$PID"
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE
+			
+			PIDFILE=$TOP_VAR_DIR/run/auth-$WLAN-vxd.pid 
+			if [ -f $PIDFILE ] ; then		
+				PID=`cat $PIDFILE`
+				if [ "$PID" != "0" ]; then
+					kill -9 $PID 2>/dev/null
+				fi
+				rm -f $PIDFILE       		
+			fi
+		fi
+		
+		# for WPS ---------------------------------->>
+		PIDFILE=$TOP_VAR_DIR/run/wscd-$WLAN.pid
+		if [ "$both_band_ap" = "1" ]; then
+			PIDFILE=$TOP_VAR_DIR/run/wscd-wlan0-wlan1.pid
+		fi
+		
+		if [ -f $PIDFILE ] ; then
+			PID=`cat $PIDFILE`
+			echo "WSCD_PID=$PID"  >> $LOG
+			if [ "$PID" != "0" ]; then
+				kill -9 $PID 2>/dev/null
+			fi
+			rm -f $PIDFILE   
+		fi 
+	done
+	#<<----------------------------------- for WPS
+}
+
+## start 802.1x daemon ##
+DEAMON_CREATED=0
+VALID_WLAN_INTERFACE=
+
+
+rtl_start_wlan() {
+	echo "rtl_start_wlan WLAN_INTERFACE is "$WLAN_INTERFACE >> $LOG
+	for WLAN in $WLAN_INTERFACE ; do
+		CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+		echo "rtl_start_wlan start-1------------ CONFIG_DIR is "$CONFIG_DIR  >> $LOG
+		GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+		if [ "$GET_VALUE_WLAN_DISABLED" != 0 ]; then
+			continue
+		fi
+		
+		GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+		GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+		GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+		
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		VAP_AUTH_ENABLE=0
+		ROOT_AUTH_ENABLE=0
+		
+		_ENABLE_1X=0
+		_USE_RS=0
+
+		if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+			GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+			GET_MAC_AUTH_ENABLED=`cat $ROOT_CONFIG_DIR/mac_auth_enabled`
+			if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+				_ENABLE_1X=1
+				_USE_RS=1
+			fi
+		else
+			_ENABLE_1X=1
+			if  [ "$GET_WLAN_WPA_AUTH_TYPE" = 1 ]; then
+				_USE_RS=1
+			fi		
+		fi
+
+		echo "_ENABLE_1X= $_ENABLE_1X" >> $LOG	
+		ROLE=
+		if [ "$_ENABLE_1X" != 0 ]; then	
+			echo "$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN" >> $LOG
+			$BIN_DIR/$FLASH_PROG wpa $WLAN $TOP_VAR_DIR/wpa-$WLAN.conf $WLAN
+			if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
+				GET_VALUE=`cat $CONFIG_DIR/network_type`
+				if [ "$GET_VALUE" = '0' ]; then
+					ROLE=client-infra
+				else
+					ROLE=client-adhoc			
+				fi
+			else
+				ROLE=auth
+			fi
+
+			VAP_NOT_IN_PURE_AP_MODE=0		
+		
+			
+			if [ "$GET_VALUE_WLAN_MODE" = '0' ] && [ "$VAP_NOT_IN_PURE_AP_MODE" = '0' ]; then
+				if  [ "$GET_WLAN_WPA_AUTH_TYPE" != 2 ] || [ "$_USE_RS" != 0 ]; then
+					echo "$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf" >> $LOG
+					$BIN_DIR/auth $WLAN $PARAM_BR $ROLE $TOP_VAR_DIR/wpa-$WLAN.conf
+					
+					DEAMON_CREATED=1
+					ROOT_AUTH_ENABLE=1
+				fi
+		
+			fi
+		fi
+		
+		if [ "$EXT" = "vxd" ]; then	
+			if [ "$ROLE" != "auth" ] || [ "$ROLE" = "auth" -a "$_USE_RS" != 0 ]; then
+				VXD_INTERFACE=$WLAN
+			fi
+		else
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			#|| [ $GET_WSC_DISABLE = 0 ]
+			if [ $ROOT_AUTH_ENABLE = 1 ] || [ $GET_WSC_DISABLE = 0 ]; then
+				if [ -z "$VALID_WLAN_INTERFACE" ]; then
+					VALID_WLAN_INTERFACE="$WLAN"
+				else
+					VALID_WLAN_INTERFACE="$VALID_WLAN_INTERFACE $WLAN"
+				fi
+			fi
+		fi
+		
+	done
+
+}
+
+#end of start wlan
+
+
+# for WPS ------------------------------------------------->>
+rtl_start_wps() {
+
+
+	if [ ! -e $BIN_DIR/wscd ]; then
+		echo "wscd not exist $BIN_DIR is " $BIN_DIR  >> $LOG
+		return;
+	fi
+	echo "rtl_start_wps  WLAN is " $WLAN >> $LOG
+	echo "VALID_WLAN_INTERFACE is " $VALID_WLAN_INTERFACE  >> $LOG
+	
+	
+	for WLAN in $VALID_WLAN_INTERFACE ; do
+		EXT=${WLAN#$WLAN_PREFIX[0-9]}
+		EXT=${EXT#-}
+		echo  "EXT=$EXT" >> $LOG
+		if [ "$EXT" = "" ] || [ "$EXT" = "va0" ] || [ "$EXT" = "va1" ] || [ "$EXT" = "vxd" ]; then
+			
+			USE_IWCONTROL=1
+			DEBUG_ON=0
+			_ENABLE_1X=0
+			WSC=1
+			CONFIG_DIR=$CONFIG_ROOT_DIR/$WLAN
+			CONF_FILE=$TOP_VAR_DIR/wsc-$WLAN.conf
+			FiFO_File=$TOP_VAR_DIR/wscd-$WLAN.fifo
+			
+			echo "rtl_start_wps  CONFIG_DIR is " $CONFIG_DIR  >> $LOG
+			
+			GET_WSC_DISABLE=`cat $CONFIG_DIR/wsc_disabled`
+			GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
+			GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
+			GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+			GET_WLAN_WPA_AUTH_TYPE=`cat $CONFIG_DIR/wpa_auth`
+
+			if [ "$GET_WLAN_ENCRYPT" -lt 2 ]; then
+				GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
+				GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
+				if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
+					_ENABLE_1X=1
+				fi
+			else
+				_ENABLE_1X=1
+			fi
+			echo "_ENABLE_1X is " $_ENABLE_1X  >> $LOG
+			if [ "$EXT" = "vxd" ]; then
+				GET_VALUE_WLAN_CURR_MODE=`cat $CONFIG_DIR/wlan_mode`
+				if [ $GET_VALUE_WLAN_CURR_MODE = 1 ]; then
+					GET_WSC_DISABLE = 1
+				fi
+			fi
+			
+			if [ $GET_WSC_DISABLE != 0 ]; then
+				echo "GET_WSC_DISABLE is " $GET_WSC_DISABLE   >> $LOG
+				WSC=0
+			else
+				if  [ "$GET_VALUE_WLAN_DISABLED" != 0 ] || [ "$GET_VALUE_WLAN_MODE" = 2 ]; then
+					echo "GET_VALUE_WLAN_DISABLED is "$GET_VALUE_WLAN_DISABLED  >> $LOG
+					echo "GET_VALUE_WLAN_MODE is "$GET_VALUE_WLAN_MODE  >> $LOG
+					WSC=0
+				else  
+					if [ $GET_VALUE_WLAN_MODE = 1 ]; then	
+						GET_VALUE=`cat $CONFIG_DIR/network_type`
+						if [ "$GET_VALUE" != 0 ]; then
+							echo "network_type is "$GET_VALUE  >> $LOG
+							WSC=0
+						fi
+					fi
+					if [ $GET_VALUE_WLAN_MODE = 0 ]; then	
+						if [ $GET_WLAN_ENCRYPT -lt 2 ] && [ $_ENABLE_1X != 0 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "_ENABLE_1X is "$_ENABLE_1X  >> $LOG
+							WSC=0
+						fi			
+						if [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_WPA_AUTH_TYPE = 1 ]; then
+							echo "GET_WLAN_ENCRYPT is "$GET_WLAN_ENCRYPT  >> $LOG
+							echo "GET_WLAN_WPA_AUTH_TYPE is "$GET_WLAN_WPA_AUTH_TYPE  >> $LOG
+							WSC=0
+						fi			
+					fi
+				fi
+			fi
+			echo "-----------------WSC is "$WSC  >> $LOG 
+			if [ $WSC = 1 ]; then
+				if [ ! -f $TOP_VAR_DIR/wps/simplecfgservice.xml ]; then
+					if [ -e $TOP_VAR_DIR/wps ]; then
+						rm $TOP_VAR_DIR/wps -rf
+					fi
+					mkdir $TOP_VAR_DIR/wps
+					#cp $TOP_ETC_DIR/simplecfg*.xml $TOP_VAR_DIR/wps
+					cat $TOP_ETC_DIR/simplecfgservice.xml > $TOP_VAR_DIR/wps/simplecfgservice.xml
+				fi
+
+				if [ $GET_VALUE_WLAN_MODE = 1 ]; then			
+					UPNP=0
+					_CMD="-mode 2"
+				else		
+					GET_WSC_UPNP_ENABLED=`cat $CONFIG_DIR/wsc_upnp_enabled`
+					UPNP=$GET_WSC_UPNP_ENABLED
+					_CMD="-start"
+				fi
+				WPS_MODE=`cat $CONFIG_DIR/wsc_method`
+				if [ "$WPS_MODE" = "1" ]; then
+					_CMD="$_CMD -method 1"
+				fi
+				echo " UPNP is " $UPNP >> $LOG
+				if [ $UPNP = 1 ]; then
+					route del -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+					route add -net 239.255.255.250 netmask 255.255.255.255 dev "$PARAM_BR"
+				fi
+		
+				if [ "$both_band_ap" = "1" ]; then
+					_CMD="$_CMD -both_band_ap"	
+				fi
+				echo "$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN"  >> $LOG
+				$BIN_DIR/$FLASH_PROG upd-wsc-conf $TOP_ETC_DIR/wscd.conf $CONF_FILE $WLAN
+				
+				_CMD="$_CMD -c $CONF_FILE -w $WLAN"
+		
+				if [ $DEBUG_ON = 1 ]; then
+					_CMD="$_CMD -debug"	
+				fi	
+				if [ $USE_IWCONTROL = 1 ]; then
+					_CMD="$_CMD -fi $FiFO_File"
+					DEAMON_CREATED=1
+					echo "DEAMON_CREATED=1" >> $LOG
+				fi
+		
+				if [ -f "$TOP_VAR_DIR/wps_start_pbc" ]; then		
+					_CMD="$_CMD -start_pbc"
+					rm -f $TOP_VAR_DIR/wps_start_pbc
+				fi
+
+				if [ -f "$TOP_VAR_DIR/wps_start_pin" ]; then		
+					_CMD="$_CMD -start"
+					rm -f $TOP_VAR_DIR/wps_start_pin
+				fi	
+				if [ -f "$TOP_VAR_DIR/wps_local_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_local_pin`		
+					_CMD="$_CMD -local_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_local_pin
+				fi
+				if [ -f "$TOP_VAR_DIR/wps_peer_pin" ]; then		
+					PIN=`cat $TOP_VAR_DIR/wps_peer_pin`		
+					_CMD="$_CMD -peer_pin $PIN"
+					rm -f $TOP_VAR_DIR/wps_peer_pin
+				fi				
+				WSC_CMD=$_CMD
+				echo "$BIN_DIR/wscd $WSC_CMD -daemon" >> $LOG
+				$BIN_DIR/wscd $WSC_CMD -daemon
+				echo "<<<<<<<<<<wscd >>>>>>>>>>> over" >> $LOG
+				WAIT=5
+				while [ $USE_IWCONTROL != 0 -a $WAIT != 0 ]		
+				do	
+					if [ -e $FiFO_File ]; then
+						break;
+					else
+						$SLEEP 1
+						WAIT=`expr $WAIT - 1`
+						#WAIT=$((WAIT - 1))
+					fi
+				done
+				if [ $WAIT = 0 ]; then
+					exit $ERROR_WSCD_START_FAIL;
+				fi
+			fi
+		fi
+	done
+}
+#<<--------------------------------------------------- for WPS
+
+rtl_start_iwcontrol() {
+	echo "rtl_start_iwcontrol"  >> $LOG
+	if [ $DEAMON_CREATED = 1 ]; then
+		echo "$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL"  >> $LOG
+		$BIN_DIR/iwcontrol $VALID_WLAN_INTERFACE $VXD_INTERFACE $POLL
+	fi
+}
+
+rtl_wlanapp() {
+
+	echo "rtl_wlanapp"  >> $LOG
+
+	if [ $PARAM1 = 'kill' ]; then
+		START=0
+	fi
+	rtl_check_wlan_if
+	if [ -z "$WLAN_INTERFACE" ]; then
+		echo "Error in $0, no wlan interface is given!"  >> $LOG
+		exit 0
+	fi
+	rtl_kill_iwcontrol_pid
+	rtl_kill_wlan_pid
+	rm -f $TOP_VAR_DIR/*.fifo
+	if [ $START = 0 ]; then
+		return;
+	fi
+	
+#	rtl_check_wlan_band
+	rtl_start_wlan
+	rtl_start_wps
+	rtl_start_iwcontrol
+}
+
+rtl_wlanapp
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh b/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh
new file mode 100755
index 0000000..922935e
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wps_init.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+ID=`expr $ID - 1`
+echo "enter wps init.sh ID=$ID >>>>>>>>" >> $LOG
+
+if [ "$ID" = "0" ];then
+#CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+#WLAN_INTERFACE="wlan0"
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+else
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0-va$ID
+WLAN_INTERFACE="wlan0-va$ID"
+fi
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh b/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh
new file mode 100755
index 0000000..8f2c8b2
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/wps_init1.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# script file to start network
+#
+# Usage: wps_init.sh {pbc | pin} {PINNUM}
+#
+
+##if [ $# -lt 2 ]; then echo "Usage: $0 {gw | ap} {all | bridge | wan}"; exit 1 ; fi
+ROOT=`nv get wifi_root_dir`
+LOG=$ROOT/wifi/realtek/slog
+
+CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
+
+ID=`nv get wifi_wps_index`
+echo "enter wps init1.sh wifi_wps_index=$ID >>>>>>>>" >> $LOG
+
+CONFIG_DIR=$CONFIG_ROOT_DIR/wlan0
+WLAN_INTERFACE="wlan0"
+ 
+echo "enter wps init.sh $CONFIG_DIR >>>>>>>>" >> $LOG
+if [ -z "$SCRIPT_DIR" ]; then
+	SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
+fi
+START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_configured
+echo "0" > $CONFIG_DIR/wsc_disabled
+if [ $1 = "pbc" ]; then
+	echo "2" > $CONFIG_DIR/wsc_method
+else
+	echo "1" > $CONFIG_DIR/wsc_method
+	echo $2 > $CONFIG_DIR/wsc_pin
+fi
+
+echo "<<<<<wps init $1 $2 >>>>>>>>" >> $LOG
+
+
+GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
+if [ "$GET_WLAN_ENCRYPT" = "2" ]; then #WPAPSK
+	echo "2" > $CONFIG_DIR/wsc_auth
+	GET_WLAN_AUTH=`cat $CONFIG_DIR/wpa_cipher`
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "4" ]; then #WPA2PSK
+	echo "32" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else             #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+elif [ "$GET_WLAN_ENCRYPT" = "6" ]; then #WPAPSKWPA2PSK
+	echo "34" > $CONFIG_DIR/wsc_auth
+	if [ "$GET_WLAN_AUTH" = "1" ]; then #TKIP
+		echo "4" > $CONFIG_DIR/wsc_enc
+	elif [ "$GET_WLAN_AUTH" = "2" ]; then #AES
+		echo "8" > $CONFIG_DIR/wsc_enc
+	else  #TKIPAES
+		echo "12" > $CONFIG_DIR/wsc_enc
+	fi
+	GET_PSK=`cat $CONFIG_DIR/wpa_psk`
+	echo $GET_PSK > $CONFIG_DIR/wsc_psk
+else									 #open
+	echo "1" > $CONFIG_DIR/wsc_auth
+	echo "1" > $CONFIG_DIR/wsc_enc
+fi
+
+	
+echo "0" > $CONFIG_DIR/wsc_manual_enabled
+echo "0" > $CONFIG_DIR/wsc_upnp_enabled
+echo "1" > $CONFIG_DIR/wsc_registrar_enabled
+ESSID=`cat $CONFIG_DIR/ssid`
+echo $ESSID > $CONFIG_DIR/wsc_ssid
+echo "0" > $CONFIG_DIR/wsc_configbyextreg
+
+echo -e "\n test to check if loop here\n" >> $LOG
+
+BR_INTERFACE="br0"
+echo -e "\n <<<${START_WLAN_APP##*/} start $WLAN_INTERFACE $BR_INTERFACE>>>" >> $LOG
+$START_WLAN_APP start $WLAN_INTERFACE $BR_INTERFACE 
+ERR=`echo $?`
+if [ $ERR != 0 ]; then
+	exit $ERR;
+fi
diff --git a/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh b/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh
new file mode 100755
index 0000000..06345b7
--- /dev/null
+++ b/ap/app/Script/wifi_script/realtek_wpa2/zte_qrcode_create.sh
@@ -0,0 +1,152 @@
+#!/bin/sh 
+## 
+# $Id: zte_qrcode_create.sh,v 0.0.0.1 2013.05.06 liuweipeng Exp $ 
+# 
+# usage: zte_qrcode_create.sh
+# 
+
+#wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_ssid_wifikey.png'
+#wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/ssid_wifikey.bmp'
+
+#multi_wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_multi_ssid_wifikey.png'
+#multi_wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/multi_ssid_wifikey.bmp'
+
+#local_domain_qrcode_name='/usr/zte_web/web/img/qrcode_local_domaind.png'
+#local_domain_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/local_domaind.bmp'
+
+ROOT=`nv get wifi_root_dir`
+
+wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey.png"
+wifi_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey.bmp"
+
+multi_wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_multi_ssid_wifikey.png"
+multi_wifi_ssid_qrcode_name_bmp="$ROOT/wifi/multi_ssid_wifikey.bmp"
+
+local_domain_qrcode_name="$ROOT/wifi/qrcode_local_domaind.png"
+local_domain_qrcode_name_bmp="$ROOT/wifi/local_domaind.bmp"
+
+#target_web_dir="$ROOT/securefs/web/img/"
+
+#if [ "$ROOT" = "" ]; then
+#    target_web_dir="/etc_ro/web/img/"
+#else
+#    target_web_dir="$ROOT/etc/web/img/"
+#fi
+
+echo "wifi_ssid_qrcode_name=$wifi_ssid_qrcode_name"
+echo "wifi_ssid_qrcode_name_bmp=$wifi_ssid_qrcode_name_bmp"
+############zte qrcode create shell entry#################
+
+case $1 in 
+ "wifi_create") 
+   
+ 	echo "enter the wifi_create function"
+	
+	rm -rf  $wifi_ssid_qrcode_name
+	rm -rf  $wifi_ssid_qrcode_name_bmp
+	
+	#wifi_ssid_name=`zte_nvc_apps read SSID1`	 # wifi ssid 
+	#wifi_auth_mode=`zte_nvc_apps read AuthMode`  # wifi auth mode 
+	#wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type
+	#wifi_password=`zte_nvc_apps read WPAPSK1`  #wifi password
+    	wifi_ssid_name=`nv get SSID1`	 # wifi ssid 
+	wifi_auth_mode=`nv get AuthMode`    # wifi auth mode
+	wifi_encry_type=`nv get EncrypType`  # wifi encry type
+	auth_wpa=`echo $wifi_auth_mode | sed  -n '/WPA/p'`
+	
+	if [ -n "$auth_wpa" ];then  # wpa
+		wifi_password=`nv get WPAPSK1`     # wifi password
+		qrcode_text='WIFI:T:WPA;S:'$wifi_ssid_name';P:'$wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then
+		defaultKeyID=`nv get DefaultKeyID`
+		if [ "$defaultKeyID" = "0" ];then
+			wifi_password=`nv get Key1Str1`
+		elif [ "$defaultKeyID" = "1" ];then
+			wifi_password=`nv get Key2Str1`
+		elif [ "$defaultKeyID" = "2" ];then
+			wifi_password=`nv get Key3Str1`
+		elif [ "$defaultKeyID" = "3" ];then
+			wifi_password=`nv get Key4Str1`
+		else
+			wifi_password=`nv get Key1Str1`
+		fi
+		qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$wifi_encry_type" = "NONE" ];then
+		qrcode_text='WIFI:S:'$wifi_ssid_name';'
+		echo "qrcode_text = $qrcode_text"	
+	fi
+	
+	qrencode -o $wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp -O $wifi_ssid_qrcode_name_bmp $wifi_ssid_qrcode_name 
+	
+#	cp $wifi_ssid_qrcode_name $target_web_dir
+	
+	;;
+ 
+ "multi_wifi_create") 
+	echo "enter the multi_wifi_create function"
+	
+	rm -rf  $multi_wifi_ssid_qrcode_name_bmp
+	rm -rf  $multi_wifi_ssid_qrcode_name
+	
+	#multi_wifi_ssid_name=`zte_nvc_apps read m_SSID`	  # multi wifi ssid 
+	#multi_wifi_auth_mode=`zte_nvc_apps read m_AuthMode`  #multi wifi auth mode 
+	#multi_wifi_encry_type=`zte_nvc_apps read m_EncrypType` #multi wifi encry type
+	#multi_wifi_password=`zte_nvc_apps read m_WPAPSK1`  #multi wifi password
+	multi_wifi_ssid_name=`nv get m_SSID`	 # wifi ssid 
+	multi_wifi_auth_mode=`nv get m_AuthMode`    # wifi auth mode
+	multi_wifi_encry_type=`nv get m_EncrypType`   # wifi encry type
+	multi_wifi_password=`nv get m_WPAPSK1`      # wifi password
+	auth_wpa=`echo $multi_wifi_auth_mode | sed  -n '/WPA/p'`
+	
+	if [ -n "$auth_wpa" ];then  # wpa
+		qrcode_text='WIFI:T:WPA;S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	##elif [ "$multi_wifi_encry_type" = "WEP" ];then
+	elif [ "$multi_wifi_encry_type" = "WEP" -o "$multi_wifi_auth_mode" = "SHARED" -o "$multi_wifi_auth_mode" = "WEPAUTO" ];then
+	    multi_defaultKeyID=`nv get m_DefaultKeyID`
+		if [ "$multi_defaultKeyID" = "0" ];then
+			multi_wifi_password=`nv get m_Key1Str1`
+		elif [ "$multi_defaultKeyID" = "1" ];then
+			multi_wifi_password=`nv get m_Key2Str1`
+		elif [ "$multi_defaultKeyID" = "2" ];then
+			multi_wifi_password=`nv get m_Key3Str1`
+		elif [ "$multi_defaultKeyID" = "3" ];then
+			multi_wifi_password=`nv get m_Key4Str1`
+		else
+			multi_wifi_password=`nv get m_Key1Str1`
+		fi		  	 	 
+		qrcode_text='WIFI:T:WEP;S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';'
+		echo "qrcode_text = $qrcode_text"
+	elif [ "$multi_wifi_encry_type" = "NONE" ];then
+		qrcode_text='WIFI:S:'$multi_wifi_ssid_name';'
+		echo "qrcode_text = $qrcode_text"	
+	fi
+	
+	qrencode -o $multi_wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp  -O $multi_wifi_ssid_qrcode_name_bmp $multi_wifi_ssid_qrcode_name
+	
+#	cp $multi_wifi_ssid_qrcode_name $target_web_dir
+	;;
+	
+ "local_domain_create") 
+	echo "enter the local_url_create function"
+	
+	rm -rf  $local_domain_qrcode_name_bmp
+	
+	local_domain_url=`zte_nvc_apps read LocalDomain`	  #local domain name
+	local_domain_username=`zte_nvc_apps read admin_user`  #local domain username
+	local_domain_passwd=`zte_nvc_apps read admin_Password` #local domain password	
+ 
+	qrcode_text='http://'$local_domain_url
+	echo "qrcode_text = $qrcode_text"	
+		
+	qrencode -o $local_domain_qrcode_name -m 10 -s 2 "$qrcode_text"
+	png2bmp  -O $local_domain_qrcode_name_bmp  $local_domain_qrcode_name
+	
+	local_domain_qrcode_name
+ 
+	;;
+esac
\ No newline at end of file