Fix dbus method return value
[platform/core/connectivity/net-config.git] / src / wifi-firmware.c
index 34fe649..2195913 100755 (executable)
@@ -80,7 +80,7 @@ static int __netconfig_sta_firmware_stop(void)
 
 static int __netconfig_p2p_firmware_start(void)
 {
-       if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
                return -ENODEV;
 
        int rv = 0;
@@ -104,7 +104,7 @@ static int __netconfig_p2p_firmware_start(void)
 
 static int __netconfig_p2p_firmware_stop(void)
 {
-       if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
                return -ENODEV;
 
        int rv = 0;
@@ -126,7 +126,7 @@ static int __netconfig_p2p_firmware_stop(void)
 
 static int __netconfig_softap_firmware_start(void)
 {
-       if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING))
                return -ENODEV;
 
        int rv = 0;
@@ -147,7 +147,7 @@ static int __netconfig_softap_firmware_start(void)
 
 static int __netconfig_softap_firmware_stop(void)
 {
-       if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING))
                return -ENODEV;
 
        int rv = 0;
@@ -211,13 +211,6 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable)
        static enum netconfig_wifi_firmware current_driver = NETCONFIG_WIFI_OFF;
        enum netconfig_wifi_firmware alias = type;
 
-#if defined WLAN_CONCURRENT_MODE
-       int flight_mode = 0;
-
-       if (type == NETCONFIG_WIFI_P2P)
-               alias = NETCONFIG_WIFI_STA;
-#endif
-
        DBG("Wi-Fi current firmware %d (type: %d %s)", current_driver, type,
                                                        enable == TRUE ? "enable" : "disable");
 
@@ -226,21 +219,6 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable)
                        return -EALREADY;
                } else if (current_driver == alias) {
 
-#if defined WLAN_CONCURRENT_MODE
-                       netconfig_vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
-                       if (flight_mode == 0 && type == NETCONFIG_WIFI_STA &&
-                                       netconfig_is_wifi_direct_on() == TRUE) {
-                               netconfig_interface_down(WIFI_IFNAME);
-
-                               return -EALREADY;
-                       }
-
-                       if (type == NETCONFIG_WIFI_P2P && wifi_state_get_technology_state() > NETCONFIG_WIFI_TECH_OFF) {
-                               netconfig_interface_down(WLAN_P2P_IFACE_NAME);
-
-                               return -EALREADY;
-                       }
-#endif
                        err = __netconfig_wifi_firmware_stop(type);
                        if (err < 0 && err != -EALREADY)
                                return err;
@@ -254,17 +232,8 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable)
        }
 
        if (current_driver > NETCONFIG_WIFI_OFF) {
-               if (current_driver == alias) {
-
-#if defined WLAN_CONCURRENT_MODE
-                       if (type == NETCONFIG_WIFI_STA)
-                               netconfig_interface_up(WIFI_IFNAME);
-                       else if (netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)
-                                       && type == NETCONFIG_WIFI_P2P)
-                               netconfig_interface_up(WLAN_P2P_IFACE_NAME);
-#endif
+               if (current_driver == alias)
                        return -EALREADY;
-               }
 
                return -EIO;
        }
@@ -282,7 +251,7 @@ gboolean handle_start(WifiFirmware *firmware, GDBusMethodInvocation *context, co
 {
        int err;
 
-       g_return_val_if_fail(firmware != NULL, FALSE);
+       g_return_val_if_fail(firmware != NULL, TRUE);
 
        DBG("Wi-Fi firmware start %s", device != NULL ? device : "null");
 
@@ -305,7 +274,7 @@ gboolean handle_start(WifiFirmware *firmware, GDBusMethodInvocation *context, co
                } else
                        netconfig_error_wifi_driver_failed(context);
 
-               return FALSE;
+               return TRUE;
        }
 
        wifi_firmware_complete_start(firmware, context);
@@ -316,7 +285,7 @@ gboolean handle_stop(WifiFirmware *firmware, GDBusMethodInvocation *context, con
 {
        int err;
 
-       g_return_val_if_fail(firmware != NULL, FALSE);
+       g_return_val_if_fail(firmware != NULL, TRUE);
 
        DBG("Wi-Fi firmware stop %s", device != NULL ? device : "null");
 
@@ -333,7 +302,7 @@ gboolean handle_stop(WifiFirmware *firmware, GDBusMethodInvocation *context, con
                else
                        netconfig_error_wifi_driver_failed(context);
 
-               return FALSE;
+               return TRUE;
        }
 
        wifi_firmware_complete_stop(firmware, context);