Replace HAL interface with hal-api-wifi
[platform/core/connectivity/net-config.git] / src / main.c
index cd6aa31..c4b7565 100755 (executable)
@@ -42,6 +42,7 @@
 #include "network-statistics.h"
 #include "network-dump.h"
 #include "ethernet.h"
+#include "wifi-firmware.h"
 
 static GMainLoop *main_loop = NULL;
 
@@ -86,6 +87,8 @@ int main(int argc, char *argv[])
 {
        int ret;
        int check_ethernet_monitor_timer = 0;
+       char *ifname = NULL;
+       char *wifi_def_mac = NULL;
 
        umask(0077);
 
@@ -109,6 +112,18 @@ int main(int argc, char *argv[])
        g_type_init();
 #endif
 
+       /* Backward compatibility:
+        * Execute only when the old style hal architecture is not running
+        */
+       if (!wifi_check_systemd_service()) {
+               ifname = netconfig_get_default_ifname_from_file();
+
+               if (ifname && netconfig_wifi_firmware_get_mac(ifname, &wifi_def_mac) == 0)
+                       wifi_set_default_mac(wifi_def_mac);
+
+               g_free(ifname);
+       }
+
        main_loop = g_main_loop_new(NULL, FALSE);
        if (main_loop == NULL) {
                ERR("Couldn't create GMainLoop\n");
@@ -139,7 +154,10 @@ int main(int argc, char *argv[])
        check_dump_state_and_start();
 #endif
 
-       if (TIZEN_WLAN_BOARD_SPRD)
+       /* Backward compatibility:
+        * Execute only when the old style hal architecture is running
+        */
+       if (TIZEN_WLAN_BOARD_SPRD && wifi_check_systemd_service())
                wifi_firmware_download();
 
        /*In case no emulator, set the ETH0 Mac address*/