[net-config]: Fix WiFi Activation issue 23/44923/2 accepted/tizen/mobile/20150731.102653 accepted/tizen/tv/20150731.102813 accepted/tizen/wearable/20150731.102937 submit/tizen/20150731.060932
authorManeesh Jain <maneesh.jain@samsung.com>
Wed, 29 Jul 2015 11:38:40 +0000 (17:08 +0530)
committerManeesh Jain <maneesh.jain@samsung.com>
Wed, 29 Jul 2015 11:46:07 +0000 (17:16 +0530)
Description: wpas v2.4 does not start using service file.
Due to this reason, wifi was not getting activated.
This patch start the wpa supplicant while activating
the wifi.

Change-Id: I33ac84d5f3956130d31779bc06dc3bb699526e45
Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
packaging/net-config.spec
src/wifi-power.c

index d033364..e33bfc6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       net-config
 Summary:    TIZEN Network Configuration Module
-Version:    0.1.90_35
+Version:    0.1.90_36
 Release:    1
 Group:      System/Network
 License:    Apache-2.0
index 3818709..fc1abc2 100755 (executable)
@@ -42,6 +42,7 @@
 
 
 #define WLAN_DRIVER_SCRIPT "/usr/bin/wlan.sh"
+#define WLAN_SUPPLICANT_SCRIPT         "/usr/sbin/wpa_supp.sh"
 
 static gboolean power_in_progress = FALSE;
 static gboolean fm_waiting = FALSE;
@@ -112,6 +113,33 @@ static gboolean __netconfig_wifi_disable_technology(void)
        return reply;
 }
 
+static int __netconfig_wifi_supplicant(gboolean enable)
+{
+       int rv = 0;
+       const char *path = WLAN_SUPPLICANT_SCRIPT;
+       char *const args_enable[] = { "/usr/sbin/wpa_supp.sh", "start", NULL };
+       char *const args_disable[] = { "/usr/sbin/wpa_supp.sh", "stop", NULL };
+       char *const envs[] = { NULL };
+       static gboolean enabled = FALSE;
+
+       if (enabled == enable)
+               return -EALREADY;
+
+       if (enable == TRUE)
+               rv = netconfig_execute_file(path, args_enable, envs);
+       else
+               rv = netconfig_execute_file(path, args_disable, envs);
+       if (rv < 0)
+               return -EIO;
+
+       DBG("wpa_supplicant %s", enable == TRUE ? "started" : "stopped");
+
+       enabled = enable;
+
+       return 0;
+}
+
+
 static gboolean __netconfig_wifi_load_driver(void)
 {
        gboolean rv = FALSE;
@@ -129,8 +157,16 @@ static gboolean __netconfig_wifi_load_driver(void)
                DBG("Failed to load wireless device driver");
                return FALSE;
        }
+#else
+       /*start the Supplicant Daemon*/
+       int err = 0;
+       err = __netconfig_wifi_supplicant(TRUE);
+       if (err < 0 && err != -EALREADY)
+               return err;
+
 #endif
 
+
        DBG("Successfully loaded wireless device driver");
        return TRUE;
 }
@@ -152,8 +188,16 @@ gboolean netconfig_wifi_remove_driver(void)
                DBG("Failed to remove wireless device driver");
                return FALSE;
        }
+#else
+       /*Stop the Supplicant Daemon*/
+       int err = 0;
+       err = __netconfig_wifi_supplicant(FALSE);
+       if (err < 0 && err != -EALREADY)
+               return err;
+
 #endif
 
+
        DBG("Successfully removed wireless device driver");
        return TRUE;
 }
@@ -231,6 +275,7 @@ static gboolean __netconfig_wifi_direct_power_off(void)
 
 static int __netconfig_wifi_try_to_load_driver(void)
 {
+
        if (netconfig_is_wifi_allowed() != TRUE)
                return -EPERM;