mr scripts: dos2unix on some files
[wilink8-wlan/wl18xx-target-scripts.git] / mr / p2p_add.sh
1 #!/system/bin/sh
3 if [ "$1" == "" -o "$2" == "" ] ; then 
4         echo "Please insert parameters <IP> [MAC]" 
5         echo "MAC is optional" 
6         echo "ie: p2p_add.sh 10.2.47.6 08:00:28:13:33:38" 
7         exit 0 
8 fi
10 INSMOD=/system/bin/insmod
11 IFCONFIG=/system/xbin/busybox/ifconfig
12 HOSTAPD=/system/bin/hostapd
13 IW=/system/bin/iw
14 WPA_CLI=/system/bin/wpa_cli
15 HOSTAPD_CONF=/data/misc/wifi/hostapd.conf
16 P2P_CONF=/data/misc/wifi/p2p_supplicant.conf
17 SOCKET_PATH=/data/misc/wifi
19 SERVICE_SUPPLICANT=wpa_supplicant
20 SERVICE_HOSTAPD=hostapd_bin
22 WLAN_IF_SUT=wlan0
23 WLAN_IF_aGO=p2p_wlan0
24 WLAN_IP=$1
25 WLAN_NETMASK=255.255.255.02
26 MAC=$2
27 PHY=`ls /sys/class/ieee80211/`
30 echo "creating new interface"
31 $IW $PHY interface add $WLAN_IF_aGO type managed
32 sleep 1
34 if [ "$MAC" != "" ] ; then
35         echo "setting new mac" 
36         $IFCONFIG $WLAN_IF_aGO hw ether $MAC 
37 fi
39 echo "enable interface"
40 $IFCONFIG $WLAN_IF_aGO up $WLAN_IP netmask $WLAN_NETMASK
41 sleep 1
43 if [ ! -f $P2P_CONF ] ; then 
44         cp /etc/wifi/p2p_supplicant.conf $P2P_CONF 
45 fi
46 chmod 777 $P2P_CONF 
48 echo "loading p2p supplicant"
49 $SERVICE_SUPPLICANT -Dnl80211 -i $WLAN_IF_aGO -c $P2P_CONF -d &
50 sleep 1