eth_num=`ifconfig -a | grep eth`
if [ "$eth_num" = "" ]; then
	ethdev="eth0"
else
	ethdev="eth1"
fi

mounted=`mount | grep usbfs`
if [ "$mounted" = "" ]; then
mount -t usbfs usbfs /proc/bus/usb/
fi

is_usbtoeth=`cat /proc/bus/usb/devices | grep AX88179`

echo "is_usbtoeth =$is_usbtoeth="
if [ "$is_usbtoeth" = "" ]; then
	echo "========> run blackbox app"
	mpblackbox.sh
else
	echo "========> run focus app"
	insmod /usr/mod/ax88179_178a.ko
	
	if [ -f /mnt/mmc/config.ini ]; then
		hw_addr=`cat /mnt/mmc/config.ini | grep hw_addr | awk -F## '{print $2}'`
		ip_addr=`cat /mnt/mmc/config.ini | grep ip_addr | awk -F## '{print $2}'`
		netmask=`cat /mnt/mmc/config.ini | grep netmask | awk -F## '{print $2}'`
		gw_addr=`cat /mnt/mmc/config.ini | grep gw_addr | awk -F## '{print $2}'`
		echo "hw_addr = $hw_addr"
		echo "ip_addr = $ip_addr"
		echo "netmask = $netmask"
		echo "gw_addr = $gw_addr"
		ifconfig $ethdev hw ether $hw_addr; ifconfig $ethdev $ip_addr netmask $netmask; route add default gw $gw_addr $ethdev;
	else
		ifconfig $ethdev hw ether 00:ee:de:21:02:42; ifconfig $ethdev 192.168.0.111 netmask 255.255.255.0; route add default gw 192.168.0.1 $ethdev;
	fi

	focus_app 0 1 1920 1080 $ethdev&
fi
