initial
[wilink8-wlan/wl18xx-target-scripts.git] / sta / sta_start.sh
1 #!/system/bin/sh
3 INSMOD=/system/bin/insmod
4 IFCONFIG=/system/bin/ifconfig
5 WPA_SUPPLICANT=/system/bin/wpa_supplicant
7 SUPPLICANT_CONF=/data/misc/wifi/wpa_supplicant.conf
9 WLAN_IF=wlan0
10 WLAN_IP=192.168.1.20
11 WLAN_NETMASK=255.255.255.0
13 SERVICE_SUPPLICANT=wpa_supplicant
14 SERVICE_HOSTAPD=hostapd_bin
16 SUPP_STAT=`getprop init.svc.$SERVICE_SUPPLICANT`
17 echo "wpa_supplicant state: $SUPP_STAT"
18 if [ "$SUPP_STAT" == "running" ] ; then echo "supplicant is in running state, exiting..." ; exit 0 ; fi
20 HOSTAPD_STAT=`getprop init.svc.$SERVICE_HOSTAPD`
21 echo "hostapd state: $HOSTAPD_STAT"
22 if [ "$HOSTAPD_STAT" == "running" ] ; then echo "hostapd is in running state, exiting..." ; exit 0 ; fi
24 echo "loading driver"
25 $INSMOD /system/lib/modules/wl12xx_sdio.ko
26 sleep 1
28 echo "enable interface"
29 $IFCONFIG $WLAN_IF up $WLAN_IP netmask $WLAN_NETMASK
30 sleep 1
31 $IFCONFIG $WLAN_IF
33 if [ ! -f $SUPPLICANT_CONF ] ; then \
34         cp /etc/wifi/wpa_supplicant.conf $SUPPLICANT_CONF ; \
35 fi
36 chmod 777 $SUPPLICANT_CONF
38 echo "loading supplicant"
39 setprop ctl.start "$SERVICE_SUPPLICANT:-i$WLAN_IF -c$SUPPLICANT_CONF"
40 #$WPA_SUPPLICANT -i$WLAN_IF -c$SUPPLICANT_CONF &
41 sleep 1