From: Danny Jeongseok Seo Date: Thu, 19 Jul 2012 04:33:07 +0000 (+0900) Subject: Revise Emulator support X-Git-Tag: 2.0_alpha~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab2bd2bad70ee30bfa820fcc64042fc74f498d31;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Revise Emulator support --- diff --git a/debian/changelog b/debian/changelog index c516927..308e9f7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +net-config (0.1.83) unstable; urgency=low + + * Revise emulator support + * Git: slp/pkgs/n/net-config + * Tag: net-config_0.1.83 + + -- Danny Jeongseok Seo Thu, 17 May 2012 17:55:47 +0900 + net-config (0.1.82) unstable; urgency=low * Check NULL: Wi-Fi technology state diff --git a/packaging/net-config.spec b/packaging/net-config.spec index 3c4bba2..a72d288 100644 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -2,7 +2,7 @@ Name: net-config Summary: TIZEN Network Configuration Module -Version: 0.1.82 +Version: 0.1.83 Release: 1 Group: System/Network License: Apache License Version 2.0 diff --git a/src/emulator.c b/src/emulator.c index 3a1ed7e..1dda48b 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -19,13 +19,12 @@ * */ -#include -#include #include #include #include #include #include +#include #include #include @@ -36,39 +35,18 @@ static gboolean netconfig_is_emulated = FALSE; static gboolean __netconfig_emulator_test_emulation_env(void) { - /* TODO: this module contains exact keyword of Emulator virtual CPU. - * It will be revised with emulator "uname" system information. - */ - const char CPUINFO[] = "/proc/cpuinfo"; - const char EMUL_VIRTUAL_CPU[] = "QEMU Virtual CPU"; - const int BUF_LEN_MAX = 255; - char buf[BUF_LEN_MAX]; - char *model_name = NULL; - gboolean ret = FALSE; - FILE* fp = NULL; + struct utsname buf; + const char *EMUL_UTSNAME_MACHINE_SUFFIX = "emulated"; DBG("Test emulation environment"); - if ((fp = fopen(CPUINFO, "r")) == NULL) { - ERR("Failed to open %s", CPUINFO); - return FALSE; - } - - while (fgets(buf, BUF_LEN_MAX, fp)) { - if (g_ascii_strncasecmp(buf, "model name", 10) != 0) - continue; - - model_name = g_strstr_len(buf, BUF_LEN_MAX-1, EMUL_VIRTUAL_CPU); - - if (model_name != NULL) - ret = TRUE; - - break; - } + uname(&buf); - fclose(fp); + if (buf.machine != NULL && + g_str_has_suffix(buf.machine, EMUL_UTSNAME_MACHINE_SUFFIX) == TRUE) + return TRUE; - return ret; + return FALSE; } static void __netconfig_emulator_set_ip(void) diff --git a/src/network-state.c b/src/network-state.c index 7986f9b..4a81a5d 100644 --- a/src/network-state.c +++ b/src/network-state.c @@ -25,6 +25,7 @@ #include "log.h" #include "neterror.h" +#include "emulator.h" #include "network-state.h" #define NETCONFIG_NETWORK_STATE_PATH "/net/netconfig/network" @@ -163,6 +164,9 @@ gboolean netconfig_iface_network_state_update_default_connection_info( DBG("connection type (%s), connection state(%s), ip_addr(%s), proxy_addr(%s)", connection_type, connection_state, ip_addr, proxy_addr); + if (netconfig_emulator_is_emulated() == TRUE) + return FALSE; + vconf_get_int(VCONFKEY_NETWORK_WIFI_STATE, &wifi_state); vconf_get_int(VCONFKEY_NETWORK_STATUS, &previous_network_status); @@ -179,6 +183,8 @@ gboolean netconfig_iface_network_state_update_default_connection_info( vconf_set_str(VCONFKEY_NETWORK_PROXY, ""); vconf_set_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, 0); + + DBG("Successfully clear IP and PROXY up"); } else if (g_str_equal(connection_state, "ready") == TRUE || g_str_equal(connection_state, "online") == TRUE) { ip = vconf_get_str(VCONFKEY_NETWORK_IP); @@ -212,6 +218,8 @@ gboolean netconfig_iface_network_state_update_default_connection_info( vconf_set_str(VCONFKEY_NETWORK_PROXY, proxy_addr); vconf_set_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, 1); + + DBG("Successfully update default network configuration"); } return TRUE;