summaryrefslogtreecommitdiff
path: root/scripts/rndis.sh
blob: 6a390e6e8a01b0edc4e976862df0ce4a22201b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DEFAULT_IP_ADDR="192.168.129.3"

#########################################################################################
# TM1, TW2 : not configfs and have no ifname
# TW3 : configfs and ifname value is "rndis0"
# XU3 : configfs and ifname value is "usb0"
if [ -e /sys/kernel/config/usb_gadget/hal-gadget/functions/rndis.default/ifname ]
then
	IFNAME=`cat /sys/kernel/config/usb_gadget/hal-gadget/functions/rndis.default/ifname`
else
	IFNAME="usb0"
fi

#########################################################################################
VCONF=`vconftool get db/dnet/rndis_ip`
if [ $? -ne 0 ]
then
	IP_ADDR=$DEFAULT_IP_ADDR
else
	IP_ADDR=`echo $VCONF | awk -F' ' '{print $4}'`
fi

#########################################################################################
if [ x$1 == "xstart" ]
then
	echo "rndis network inteface =" $IFNAME
	echo "rndis ip address =" $IP_ADDR

	/sbin/ifconfig $IFNAME $IP_ADDR up
else
	/sbin/ifconfig $IFNAME down
fi