additional comment
[wilink8-wlan/wl18xx-target-scripts.git] / mr / p2p_add.sh
1 #!/system/bin/sh
2 # System Test ; Script version = 1.3
3 # Change in 1.1 : Added support for band A.
4 # Change in 1.2 : p2p_supplicant.conf renamed into p2p.conf
5 # Change in 1.3 : WLAN_NETMASK parameter changed from 255.255.255.02 to 255.255.255.00
7 if [ "$1" == "" -o "$2" == "" ] ; then 
8         echo "Please insert parameters <IP> [MAC]" 
9         echo "MAC is optional" 
10         echo "ie: p2p_add.sh 10.2.47.6 08:00:28:13:33:38" 
11         exit 0 
12 fi
14 INSMOD=/system/bin/insmod
15 IFCONFIG=/system/xbin/busybox/ifconfig
16 HOSTAPD=/system/bin/hostapd
17 IW=/system/bin/iw
18 WPA_CLI=/system/bin/wpa_cli
19 HOSTAPD_CONF=/data/misc/wifi/hostapd.conf
20 P2P_CONF=/data/misc/wifi/p2p.conf
21 SOCKET_PATH=/data/misc/wifi
23 SERVICE_SUPPLICANT=wpa_supplicant
24 SERVICE_HOSTAPD=hostapd_bin
26 WLAN_IF_SUT=wlan0
27 WLAN_IF_aGO=p2p_wlan0
28 WLAN_IP=$1
29 WLAN_NETMASK=255.255.255.0
30 MAC=$2
31 PHY=`ls /sys/class/ieee80211/`
34 echo "creating new interface"
35 $IW $PHY interface add $WLAN_IF_aGO type managed
36 sleep 1
38 if [ "$MAC" != "" ] ; then
39         echo "setting new mac" 
40         $IFCONFIG $WLAN_IF_aGO hw ether $MAC 
41 fi
43 echo "enable interface"
44 $IFCONFIG $WLAN_IF_aGO up $WLAN_IP netmask $WLAN_NETMASK
45 sleep 1
47 if [ ! -f $P2P_CONF ] ; then 
48         touch $P2P_CONF
49         echo "update_config=1" >> $P2P_CONF
50         echo "ctrl_interface=/data/misc/wifi" >> $P2P_CONF
51         echo "ap_scan=1" >> $P2P_CONF
52         echo "fast_reauth=1" >> $P2P_CONF
53         echo "device_name=Blaze" >> $P2P_CONF
54         echo "manufacturer=TexasInstruments" >> $P2P_CONF
55         echo "model_name=TI_Connectivity_module" >> $P2P_CONF
56         echo "model_number=wl12xx" >> $P2P_CONF
57         echo "serial_number=12345" >> $P2P_CONF
58 fi
59 chmod 777 $P2P_CONF 
61 echo "loading p2p supplicant"
62 $SERVICE_SUPPLICANT -Dnl80211 -i $WLAN_IF_aGO -c $P2P_CONF -d &
63 sleep 1