#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;
{
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
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) {
}
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) {
set_platform_default_home(path);
g_free(path);
pclose(fp);
-
break;
}
}