+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 <s.seo@samsung.com> Thu, 17 May 2012 17:55:47 +0900
+
net-config (0.1.82) unstable; urgency=low
* Check NULL: Wi-Fi technology state
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
*
*/
-#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <net/if.h>
+#include <sys/utsname.h>
#include <vconf.h>
#include <vconf-keys.h>
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)
#include "log.h"
#include "neterror.h"
+#include "emulator.h"
#include "network-state.h"
#define NETCONFIG_NETWORK_STATE_PATH "/net/netconfig/network"
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);
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);
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;