From: Kim Gunsoo Date: Tue, 17 Nov 2015 06:23:21 +0000 (+0900) Subject: Remove unnecessary console msg in shell protocol with 2.3.1. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbf12e8f5ae5d4b26496767ef506ccdc722a598a;p=sdk%2Ftools%2Fsdb.git Remove unnecessary console msg in shell protocol with 2.3.1. - Since the shell festure uses a different protocol depending on the platform version, the console message due to compatibility problems are no longer output. Change-Id: I447d797852f715bd6798daf6b4355e8d5262a888 Signed-off-by: Kim Gunsoo --- diff --git a/src/command_function.c b/src/command_function.c index ad45421..6fb7c45 100644 --- a/src/command_function.c +++ b/src/command_function.c @@ -660,40 +660,29 @@ static int is_support_debug_option(void){ return is_support; } -#define INFOBUF_MAXLEN 64 -typedef struct platform_info { - char platform_info_version[INFOBUF_MAXLEN]; - char model_name[INFOBUF_MAXLEN]; // Emulator - char platform_name[INFOBUF_MAXLEN]; // Tizen - char platform_version[INFOBUF_MAXLEN]; // 2.2.1 - char profile_name[INFOBUF_MAXLEN]; // 2.2.1 -} pinfo; - static int is_support_whitespace_pkgname(void){ int is_support = 0; - struct platform_info pinfo; - - const char* GET_SYSTEM_INFO_CMD = "sysinfo:"; - int fd = sdb_connect(GET_SYSTEM_INFO_CMD); + int version = 0; + int major = 0; + int minor = 0; + int patch = 0; - if(fd < 0) { + version = get_platform_version(); + if(!version) { // default : not support whitespace for package file name. return 0; } - if (readx(fd, &pinfo, sizeof(struct platform_info)) == 0) { - int major = 0; - int minor = 0; - int patch = 0; - if (sscanf(pinfo.platform_version, "%d.%d.%d", &major, &minor, &patch) == 3) { - // version number at least 2.4.0 - if (major >= 3 || (major >= 2 && minor >=4)) { - is_support = 1; - } - } + major = MK_PLATFORM_MAJOR(version); + minor = MK_PLATFORM_MINOR(version); + patch = MK_PLATFORM_PATCH(version); + + D("Platform version : %d.%d.%d\n", major, minor, patch); + // version number at least 2.4.0 + if (major >= 3 || (major >= 2 && minor >=4)) { + is_support = 1; } - sdb_close(fd); return is_support; } diff --git a/src/commandline.c b/src/commandline.c index 104f203..304fef4 100755 --- a/src/commandline.c +++ b/src/commandline.c @@ -56,6 +56,46 @@ static int ishell_fd = -1; static int enable_sync_winsz = 0; static void sync_winsz(void); +#define INFOBUF_MAXLEN 64 +typedef struct platform_info { + char platform_info_version[INFOBUF_MAXLEN]; + char model_name[INFOBUF_MAXLEN]; // Emulator + char platform_name[INFOBUF_MAXLEN]; // Tizen + char platform_version[INFOBUF_MAXLEN]; // 2.2.1 + char profile_name[INFOBUF_MAXLEN]; // 2.2.1 +} pinfo; + +int get_platform_version(void) { + struct platform_info pinfo; + + const char* GET_SYSTEM_INFO_CMD = "sysinfo:"; + int fd = sdb_connect(GET_SYSTEM_INFO_CMD); + int version = 0; + + if(fd < 0) { + return 0; + } + + if (readx(fd, &pinfo, sizeof(struct platform_info)) == 0) { + int major = 0; + int minor = 0; + int patch = 0; + if (sscanf(pinfo.platform_version, "%d.%d.%d", &major, &minor, &patch) == 3) { + if (major < 1024 && minor < 1024 && patch < 1024) { + version |= (major << 20); + version |= (minor << 10); + version |= patch; + } else { + LOG_ERROR("Unexpected version : %d.%d.%d\n", major, minor, patch); + } + } + } + D("Platform version : %s(%x)\n", pinfo.platform_version, version); + + sdb_close(fd); + return version; +} + #ifdef HAVE_TERMIO_H static __inline__ void stdin_raw_init(int fd, struct termios* tio_save); @@ -441,17 +481,33 @@ int interactive_shell() char eshell[32] = "eshell:"; int lines, columns; int fd = -1; - - if(get_screensize(&lines, &columns) == 0) { - snprintf(eshell+7, sizeof(eshell)-7, "%d:%d", lines, columns); - D("interactive shell : eshell command=%s\n", eshell); - fd = sdb_connect(eshell); - if(fd < 0) { - fprintf(stdout, "failed environment shell, so it will retry shell command.\n"); + int major = 0; + int minor = 0; + int patch = 0; + int version = 0; + + version = get_platform_version(); + major = MK_PLATFORM_MAJOR(version); + minor = MK_PLATFORM_MINOR(version); + patch = MK_PLATFORM_PATCH(version); + + // eshell to support from the 2.4.0 version. + if (major >= 3 || (major >= 2 && minor >=4)) { + if(get_screensize(&lines, &columns) == 0) { + snprintf(eshell+7, sizeof(eshell)-7, "%d:%d", lines, columns); + D("interactive shell : eshell command=%s\n", eshell); + fd = sdb_connect(eshell); + if(fd < 0) { + fprintf(stdout, "failed environment shell, so it will retry shell command.\n"); + return 1; + } } - } - if(fd < 0) { + if(check_syncwinsz_support() == 1) { + D("Support sync window size with remote\n"); + enable_sync_winsz = 1; + } + } else { fd = sdb_connect("shell:"); if(fd < 0) { return 1; @@ -461,10 +517,6 @@ int interactive_shell() int* fd_p = malloc(sizeof(int)); *fd_p = fd; ishell_fd = fd; - if(check_syncwinsz_support() == 1) { - D("Support sync window size with remote\n"); - enable_sync_winsz = 1; - } #ifdef HAVE_TERMIO_H void** args = (void**)malloc(sizeof(void*)*2); diff --git a/src/commandline.h b/src/commandline.h index 0962070..6f62268 100644 --- a/src/commandline.h +++ b/src/commandline.h @@ -43,11 +43,16 @@ #define INPUT_FD 0 #endif +#define MK_PLATFORM_MAJOR(ver) ((version & 0x3ff00000) >> 20) +#define MK_PLATFORM_MINOR(ver) ((version & 0xffc00) >> 10) +#define MK_PLATFORM_PATCH(ver) ((version & 0x3ff)) + int send_shellcommand(char* buf); int process_cmdline(int argc, char** argv); void read_and_dump(int fd); int interactive_shell(); int get_server_port(); +int get_platform_version(); int __sdb_command(const char* cmd); #endif /* COMMANDLINE_H_ */