From: Munkyu Im Date: Tue, 16 Aug 2016 10:37:49 +0000 (+0900) Subject: net: modify sdb connection X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~29^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c36aa7bbda111ee3820026ae75d66cf485804c87;p=sdk%2Femulator%2Fqemu.git net: modify sdb connection - change the sleeping time efficiently. - disable stderr from log by using redirection. Change-Id: I542fe588ed468293f724acf8f1679c17f2c9f878 Signed-off-by: Munkyu Im --- diff --git a/tizen/src/util/net_helper.c b/tizen/src/util/net_helper.c index b7be35f82a..ff6c5c4fb7 100644 --- a/tizen/src/util/net_helper.c +++ b/tizen/src/util/net_helper.c @@ -50,7 +50,6 @@ DECLARE_DEBUG_CHANNEL(net_helper); #define BUF_SIZE 64 #define MAX_TRIAL 20 #define MAX_USER_NAME_LEN 36 -#define SLEEP_WAIT_SDB 500 /* ms */ int emul_vm_base_socket; static bool sdb_daemon_is_initialized = false; @@ -398,7 +397,8 @@ static void *get_user_home_path(void *args) { FILE *fp; char user_name[MAX_USER_NAME_LEN] = { 0, } ; - int index = 0; + int trial = 0; + int sleep_time = 500; // msec #ifndef CONFIG_WIN32 const char *sdb_path = "../../../../../tools/sdb"; #else @@ -411,12 +411,17 @@ static void *get_user_home_path(void *args) if (get_platform_default_home()) { return NULL; } - - char *cmd_root_off = g_strdup_printf("\"%s%s\" -s emulator-%d root off", +#ifndef CONFIG_WIN32 + char *cmd_root_off = g_strdup_printf("\"%s%s\" -s emulator-%d root off 2> /dev/null", bin_dir, sdb_path, get_vm_device_serial_number()); - char *cmd_get_home = g_strdup_printf("\"%s%s\" -s emulator-%d shell id -un", + char *cmd_get_home = g_strdup_printf("\"%s%s\" -s emulator-%d shell id -un 2> /dev/null", bin_dir, sdb_path, get_vm_device_serial_number()); - +#else + char *cmd_root_off = g_strdup_printf("\"%s%s\" -s emulator-%d root off 2> NUL", + bin_dir, sdb_path, get_vm_device_serial_number()); + char *cmd_get_home = g_strdup_printf("\"%s%s\" -s emulator-%d shell id -un 2> NUL", + bin_dir, sdb_path, get_vm_device_serial_number()); +#endif //FIXME: (sdb) cannot check sdb root status fp = popen(cmd_root_off, "r"); if (fp == NULL) { @@ -426,12 +431,16 @@ static void *get_user_home_path(void *args) } g_free(cmd_root_off); pclose(fp); - - while (index++ != MAX_TRIAL) { + while (true) { + if (trial >= MAX_TRIAL) { + sleep_time = 2000; + } else { + trial++; + } #ifdef CONFIG_WIN32 - Sleep(SLEEP_WAIT_SDB); + Sleep(sleep_time); #else - usleep(SLEEP_WAIT_SDB * 1000); + usleep(sleep_time * 1000); #endif fp = popen(cmd_get_home, "r"); if (fp == NULL) { @@ -446,7 +455,6 @@ static void *get_user_home_path(void *args) set_platform_default_home(path); g_free(path); pclose(fp); - break; } }