Fixed the issue that sdb client is blocked for poweroff shell command.
authorKim Gunsoo <gunsoo83.kim@samsung.com>
Thu, 23 Jun 2016 05:20:32 +0000 (14:20 +0900)
committerGunSoo Kim <gunsoo83.kim@samsung.com>
Thu, 23 Jun 2016 05:35:59 +0000 (14:35 +0900)
- When you run the poweroff shell command, Emulator is finished.
  However, since the shell routine of sdb client will try to
  get the capabiltiy information after the death of Emulator,
  take hang.
- Change the capability to get in advance.

Change-Id: I6877f344d4d1a795f30c6870c3873c22e2283125
Signed-off-by: Kim Gunsoo <gunsoo83.kim@samsung.com>
src/command_function.c
src/commandline.c
src/commandline.h

index 491e16ad35f2b46c30c2a2802fb0eb2014742123..9b38aebcc8b111a7d10e1c60304292cb3ec888ad 100644 (file)
@@ -648,7 +648,9 @@ static int shell_connect_args(int argc, char ** argv)
 
 int shell(int argc, char ** argv) {
     int fd = -1;
+    int sync_winsz_support = SYNCWINSZ_UNSUPPORTED;
 
+    sync_winsz_support = check_syncwinsz_support();
     if(argc < 2) {
         fd = shell_connect();
     } else {
@@ -659,7 +661,7 @@ int shell(int argc, char ** argv) {
         return 1;
     }
 
-    sdb_execute_shell(fd, SDB_STDIN_ON);
+    sdb_execute_shell(fd, SDB_STDIN_ON, sync_winsz_support);
     sdb_close(fd);
 
     return 0;
index 4752751981cddfb18318769478de95961b2cd9e8..d92f12744e615fd6b96478dcf3f89350ab6de846 100755 (executable)
@@ -456,7 +456,7 @@ int match_capability_key_value(char* cap, char* key, char* value) {
     return matched;
 }
 
-static int check_syncwinsz_support() {
+int check_syncwinsz_support() {
     char full_cmd[16] = {0,};
     char cap_buffer[CAPBUF_SIZE] = {0,};
     uint16_t len = 0;
@@ -490,16 +490,16 @@ static int check_syncwinsz_support() {
     return supported;
 }
 
-static void stdin_info_init(int fd)
+static void stdin_info_init(int fd, int enable_sync_winsz)
 {
     g_stdin_info.stdin_fd = INPUT_FD;
     g_stdin_info.remote_fd = fd;
-    g_stdin_info.enable_sync_winsz = check_syncwinsz_support();
+    g_stdin_info.enable_sync_winsz = enable_sync_winsz;
 }
 
-void sdb_execute_shell(int fd, int stdin_on)
+void sdb_execute_shell(int fd, int stdin_on, int enable_sync_winsz)
 {
-    stdin_info_init(fd);
+    stdin_info_init(fd, enable_sync_winsz);
 
     if (stdin_on == SDB_STDIN_ON) {
         sdb_thread_t thr;
index 72f78abfec71058a0613a218939dd35141d5b95e..8f5784eddda2b673d8ba8c009c166cc80c2ea3ea 100644 (file)
@@ -67,7 +67,8 @@ void read_and_dump(int fd);
 int interactive_shell();
 int is_support_eshell(struct sdb_version *pversion);
 int get_screensize(int* lines, int* columns);
-void sdb_execute_shell(int fd, int stdin_on);
+void sdb_execute_shell(int fd, int stdin_on, int enable_sync_winsz);
+int check_syncwinsz_support(void);
 int get_server_port();
 int get_platform_version(struct sdb_version *pversion);
 int __sdb_command(const char* cmd);