Changed File permissions 755 => 644.
[platform/core/connectivity/wifi-direct-manager.git] / files / p2p_supp.sh.in
1 #!/bin/sh
2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3
4 PROGRAM="@SBIN_DIR@/wpa_supplicant"
5
6 start()
7 {
8         HARDWARE_MODEL=`@BIN_DIR@/grep Hardware /proc/cpuinfo | @BIN_DIR@/awk "{print \\$3}"`
9         @BIN_DIR@/echo "Hardware Model=${HARDWARE_MODEL}"
10
11         if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
12                 echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
13         else
14                 echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
15                 @BIN_DIR@/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
16         fi
17         ## For Hawk-P Platform, Hardware model is Samsung
18         if [ $HARDWARE_MODEL = "Samsung" ];then
19                 @SBIN_DIR@/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c@TZ_SYS_ETC@/p2p_supp.conf -g@TZ_SYS_RUN@/wpa_global  -f/var/log/wpa_supplicant.log
20          else
21                 @SBIN_DIR@/wpa_supplicant -t -B -C@TZ_SYS_RUN@/wpa_supplicant -ddd -Dnl80211 -iwlan0 -c@TZ_SYS_ETC@/p2p_supp.conf -f/var/log/wpa_supplicant.log
22         fi
23  }
24
25 start_p2p0()
26 {
27         if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
28                 echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
29         else
30                 echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
31                  @BIN_DIR@/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
32         fi
33         @SBIN_DIR@/wpa_supplicant -t -B -ddd -Dnl80211 -ip2p0 -c@TZ_SYS_ETC@/p2p_supp.conf -f/var/log/wpa_supplicant.log
34 }
35
36 start_dbus()
37 {
38         program=${PROGRAM}
39         run=`@BIN_DIR@/ps -eo comm| @BIN_DIR@/grep ${program}`
40         if [ "X${run}" == "X" ]; then
41                 echo "${program} is not running"
42                 if [ -e @TZ_SYS_ETC@/p2p_supp.conf ]; then
43                         echo "File exist: @TZ_SYS_ETC@/p2p_supp.conf"
44                 else
45                         echo "File not exist. Reinstall: @TZ_SYS_ETC@/p2p_supp.conf"
46                          @BIN_DIR@/cp @TZ_SYS_RO_ETC@/wifi-direct/p2p_supp.conf @TZ_SYS_ETC@/
47                 fi
48                 @SBIN_DIR@/wpa_supplicant -t -B -u -ddd -K -f/var/log/wpa_supplicant.log
49         else
50                 echo "${program} is already running"
51         fi
52 }
53
54 stop()
55 {
56         @BIN_DIR@/pkill -x wpa_supplicant
57 }
58
59 case $1 in
60 "start")
61 start
62 ;;
63 "start_p2p0")
64 start_p2p0
65 ;;
66 "start_dbus")
67 start_dbus
68 ;;
69 "stop")
70 stop
71 ;;
72 *)
73 /bin/echo p2p_supp.sh [start] [start_p2p0] [start_dbus] [stop]
74 exit 1
75 ;;
76 esac