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