From: GiWoong Kim Date: Tue, 30 Jul 2013 03:09:10 +0000 (+0900) Subject: skin: define startup argument for input device X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~863 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba7567e0ca4faf7907851821c6afab53baebfbf1;p=sdk%2Femulator%2Fqemu.git skin: define startup argument for input device mouse & touchscreen Change-Id: I76a274d7f76bd326b1c1de02589e099b337f7491 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index ea7144454b..0a303eae35 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -1,7 +1,7 @@ /* * Emulator * - * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * SeokYeon Hwang @@ -57,14 +57,14 @@ int get_emul_skin_enable(void) return _emul_info.skin_enable; } -/* lcd screen size */ +/* display screen size */ void set_emul_lcd_size(int width, int height) { _emul_info.lcd_size_w = width; _emul_info.lcd_size_h = height; - INFO("emulator graphic resolution = %dx%d\n", - _emul_info.lcd_size_w, _emul_info.lcd_size_h); + INFO("emulator graphic resolution : %dx%d\n", + _emul_info.lcd_size_w, _emul_info.lcd_size_h); } int get_emul_lcd_width(void) @@ -83,7 +83,7 @@ void set_emul_sdl_bpp(int bpp) _emul_info.sdl_bpp = bpp; if (_emul_info.sdl_bpp != 32) { - INFO("?? sdl bpp = %d\n", _emul_info.sdl_bpp); + INFO("sdl bpp : %d\n", _emul_info.sdl_bpp); } } @@ -92,6 +92,36 @@ int get_emul_sdl_bpp(void) return _emul_info.sdl_bpp; } +/* mouse device */ +void set_emul_input_mouse_enable(bool on) +{ + _emul_info.input_mouse_enable = on; + + if (_emul_info.input_mouse_enable == true) { + INFO("set_emul_input_mouse_enable\n"); + } +} + +bool is_emul_input_mouse_enable(void) +{ + return _emul_info.input_mouse_enable; +} + +/* touchscreen device */ +void set_emul_input_touch_enable(bool on) +{ + _emul_info.input_touch_enable = on; + + if (_emul_info.input_touch_enable == true) { + INFO("set_emul_input_touch_enable\n"); + } +} + +bool is_emul_input_touch_enable(void) +{ + return _emul_info.input_touch_enable; +} + /* maximum number of touch point */ void set_emul_max_touch_point(int cnt) { @@ -135,12 +165,12 @@ void set_emulator_condition(int state) void set_emul_win_scale(double scale_factor) { if (scale_factor < 0.0 || scale_factor > 1.0) { - INFO("scale_factor is out of range = %f\n", scale_factor); + INFO("scale_factor is out of range : %f\n", scale_factor); scale_factor = 1.0; } _emul_state.scale_factor = scale_factor; - INFO("emulator window scale_factor = %f\n", _emul_state.scale_factor); + INFO("emulator window scale_factor : %f\n", _emul_state.scale_factor); } double get_emul_win_scale(void) @@ -151,13 +181,14 @@ double get_emul_win_scale(void) /* emulator rotation */ void set_emul_rotation(short rotation_type) { - if (rotation_type < ROTATION_PORTRAIT || rotation_type > ROTATION_REVERSE_LANDSCAPE) { - INFO("rotation type is out of range = %d\n", rotation_type); + if (rotation_type < ROTATION_PORTRAIT || + rotation_type > ROTATION_REVERSE_LANDSCAPE) { + INFO("rotation type is out of range : %d\n", rotation_type); rotation_type = ROTATION_PORTRAIT; } _emul_state.rotation_type = rotation_type; - INFO("emulator rotation type = %d\n", _emul_state.rotation_type); + INFO("emulator rotation type : %d\n", _emul_state.rotation_type); } short get_emul_rotation(void) diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index efb123230e..ab7a5668de 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -1,7 +1,7 @@ /* * Emulator * - * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * SeokYeon Hwang @@ -79,6 +79,8 @@ typedef struct EmulatorConfigInfo { int lcd_size_w; int lcd_size_h; int sdl_bpp; + bool input_mouse_enable; + bool input_touch_enable; int max_touch_point; int vm_base_port; /* add here */ @@ -100,6 +102,8 @@ void set_emul_skin_enable(int enable); void set_emul_lcd_size(int width, int height); void set_emul_win_scale(double scale); void set_emul_sdl_bpp(int bpp); +void set_emul_input_mouse_enable(bool on); +void set_emul_input_touch_enable(bool on); void set_emul_max_touch_point(int cnt); void set_emul_vm_base_port(int port); @@ -114,6 +118,8 @@ int get_emul_lcd_width(void); int get_emul_lcd_height(void); double get_emul_win_scale(void); int get_emul_sdl_bpp(void); +bool is_emul_input_mouse_enable(void); +bool is_emul_input_touch_enable(void); int get_emul_max_touch_point(void); int get_emul_vm_base_port(void); diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 0dc6d4c6ba..7e3905d776 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -78,8 +78,9 @@ MULTI_DEBUG_CHANNEL(qemu, main); #define SDB_PORT_PREFIX "sdb_port=" #define LOGS_SUFFIX "/logs/" #define LOGFILE "emulator.log" -#define LCD_WIDTH_PREFIX "width=" -#define LCD_HEIGHT_PREFIX "height=" +#define DISPLAY_WIDTH_PREFIX "width=" +#define DISPLAY_HEIGHT_PREFIX "height=" +#define INPUT_TOUCH_PARAMETER "virtio-touchscreen-pci" #define MIDBUF 128 #define LEN_MARU_KERNEL_CMDLINE 512 @@ -265,10 +266,10 @@ static void extract_qemu_info(int qemu_argc, char **qemu_argv) for (i = 0; i < qemu_argc; ++i) { if (strstr(qemu_argv[i], IMAGE_PATH_PREFIX) != NULL) { set_image_and_log_path(qemu_argv[i]); - break; + } else if (strstr(qemu_argv[i], INPUT_TOUCH_PARAMETER) != NULL) { + set_emul_input_touch_enable(true); } } - } static void extract_skin_info(int skin_argc, char **skin_argv) @@ -277,16 +278,16 @@ static void extract_skin_info(int skin_argc, char **skin_argv) int w = 0, h = 0; for (i = 0; i < skin_argc; ++i) { - if (strstr(skin_argv[i], LCD_WIDTH_PREFIX) != NULL) { - char *width_arg = skin_argv[i] + strlen(LCD_WIDTH_PREFIX); + if (strstr(skin_argv[i], DISPLAY_WIDTH_PREFIX) != NULL) { + char *width_arg = skin_argv[i] + strlen(DISPLAY_WIDTH_PREFIX); w = atoi(width_arg); - INFO("lcd width option = %d\n", w); - } else if (strstr(skin_argv[i], LCD_HEIGHT_PREFIX) != NULL) { - char *height_arg = skin_argv[i] + strlen(LCD_HEIGHT_PREFIX); + INFO("display width option : %d\n", w); + } else if (strstr(skin_argv[i], DISPLAY_HEIGHT_PREFIX) != NULL) { + char *height_arg = skin_argv[i] + strlen(DISPLAY_HEIGHT_PREFIX); h = atoi(height_arg); - INFO("lcd height option = %d\n", h); + INFO("display height option : %d\n", h); } if (w != 0 && h != 0) { diff --git a/tizen/src/maru_finger.c b/tizen/src/maru_finger.c index 84b4e77811..2879a018d7 100644 --- a/tizen/src/maru_finger.c +++ b/tizen/src/maru_finger.c @@ -177,7 +177,7 @@ void init_multi_touch_state(void) mts->finger_cnt_max = MAX_FINGER_CNT; set_emul_max_touch_point(mts->finger_cnt_max); } - INFO("maxTouchPoint=%d\n", get_emul_max_touch_point()); + INFO("maxTouchPoint : %d\n", get_emul_max_touch_point()); mts->finger_cnt = 0; diff --git a/tizen/src/osutil-linux.c b/tizen/src/osutil-linux.c index 1cc50f7061..8d8656c306 100644 --- a/tizen/src/osutil-linux.c +++ b/tizen/src/osutil-linux.c @@ -182,7 +182,7 @@ void print_system_info_os(void) } /* pci device description */ - INFO("* PCI devices :\n"); + INFO("* Host PCI devices :\n"); char lspci_cmd[MAXLEN] = "lspci >> "; strcat(lspci_cmd, log_path); diff --git a/tizen/src/skin/maruskin_client.c b/tizen/src/skin/maruskin_client.c index f68c145015..98b5d242b0 100644 --- a/tizen/src/skin/maruskin_client.c +++ b/tizen/src/skin/maruskin_client.c @@ -65,9 +65,12 @@ MULTI_DEBUG_CHANNEL(qemu, skin_client); #define OPT_NET_BASE_PORT "net.baseport" #define OPT_DISPLAY_SHM "display.shm" #define OPT_INPUT_MOUSE "input.mouse" -#define OPT_INPUT_TOUCHSCREEN "input.touch" +#define OPT_INPUT_TOUCH "input.touch" #define OPT_MAX_TOUCHPOINT "input.touch.maxpoint" +#define OPT_BOOLEAN_TRUE "true" +#define OPT_BOOLEAN_FALSE "false" + extern char tizen_target_path[]; static int skin_argc; @@ -77,16 +80,17 @@ static char** skin_argv; static char* JAVA_EXEFILE_PATH = NULL; #endif -static void* run_skin_client(void* arg) +static void *run_skin_client(void *arg) { - char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, }; + gchar *cmd = NULL; char argv[JAVA_MAX_COMMAND_LENGTH] = { 0, }; INFO("run skin client\n"); int i; for (i = 0; i < skin_argc; ++i) { + strncat(argv, "\"", 1); strncat(argv, skin_argv[i], strlen(skin_argv[i])); - strncat(argv, " ", 1); + strncat(argv, "\" ", 2); INFO("[skin args %d] %s\n", i, skin_argv[i]); } @@ -105,13 +109,28 @@ static void* run_skin_client(void* arg) sprintf(buf_uid, "%d", uid); sprintf(buf_tizen_base_port, "%d", get_emul_vm_base_port()); + /* display */ char buf_display_shm[8] = { 0, }; #ifdef CONFIG_USE_SHM - strcpy(buf_display_shm, "true"); /* maru_shm */ + strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */ #else - strcpy(buf_display_shm, "false"); /* maru_sdl */ + strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */ #endif + /* input */ + char buf_input_mouse[8] = { 0, }; + if (is_emul_input_mouse_enable() == true) { + strcpy(buf_input_mouse, OPT_BOOLEAN_TRUE); + } else { + strcpy(buf_input_mouse, OPT_BOOLEAN_FALSE); + } + char buf_input_touch[8] = { 0, }; + if (is_emul_input_touch_enable() == true) { + strcpy(buf_input_touch, OPT_BOOLEAN_TRUE); + } else { + strcpy(buf_input_touch, OPT_BOOLEAN_FALSE); + } + #ifdef CONFIG_WIN32 /* find java path in 64bit windows */ JAVA_EXEFILE_PATH = malloc(JAVA_MAX_COMMAND_LENGTH); @@ -136,7 +155,7 @@ static void* run_skin_client(void* arg) INFO("bin directory : %s\n", bin_dir); int maxtouchpoint = get_emul_max_touch_point(); - int len_maxtouchpoint; + int len_maxtouchpoint = 0; if (maxtouchpoint > 9) { len_maxtouchpoint = 2; } else { @@ -144,7 +163,7 @@ static void* run_skin_client(void* arg) } /* calculate buffer length */ - int len = strlen(JAVA_EXEFILE_PATH) + SPACE_LEN + + int cmd_len = strlen(JAVA_EXEFILE_PATH) + SPACE_LEN + strlen(JAVA_EXEOPTION) + SPACE_LEN + strlen(JAVA_LIBRARY_PATH) + EQUAL_LEN + #ifdef CONFIG_WIN32 @@ -165,22 +184,28 @@ static void* run_skin_client(void* arg) strlen(buf_tizen_base_port) + SPACE_LEN + strlen(OPT_DISPLAY_SHM) + EQUAL_LEN + strlen(buf_display_shm) + SPACE_LEN + + strlen(OPT_INPUT_TOUCH) + EQUAL_LEN + + strlen(buf_input_touch) + SPACE_LEN + strlen(OPT_MAX_TOUCHPOINT) + EQUAL_LEN + len_maxtouchpoint + SPACE_LEN + 1 + strlen(argv); - if (len > JAVA_MAX_COMMAND_LENGTH) { + INFO("skin command length : %d\n", cmd_len); + cmd = g_malloc0(cmd_len); + + /*if (len > JAVA_MAX_COMMAND_LENGTH) { INFO("swt command length is too long! (%d)\n", len); len = JAVA_MAX_COMMAND_LENGTH; - } + }*/ - snprintf(cmd, len, "%s %s %s=\"%s\" \ + snprintf(cmd, cmd_len, "%s %s %s=\"%s\" \ \"%s%s\" \ %s=%d \ %s=%d \ %s=\"%s\" \ %s=%d \ %s=%s \ +%s=%s \ %s=%d \ %s", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAVA_LIBRARY_PATH, @@ -194,6 +219,7 @@ static void* run_skin_client(void* arg) OPT_VM_PATH, vm_path, OPT_NET_BASE_PORT, get_emul_vm_base_port(), OPT_DISPLAY_SHM, buf_display_shm, + OPT_INPUT_TOUCH, buf_input_touch, OPT_MAX_TOUCHPOINT, maxtouchpoint, argv); @@ -284,6 +310,8 @@ static void* run_skin_client(void* arg) #endif + g_free(cmd); + return NULL; } @@ -334,7 +362,7 @@ int start_skin_client(int argc, char* argv[]) int start_simple_client(char* msg) { int ret = 0; - char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, }; + gchar *cmd = NULL; INFO("run simple client\n"); @@ -362,7 +390,7 @@ int start_simple_client(char* msg) INFO("bin directory : %s\n", bin_dir); /* calculate buffer length */ - int len = strlen(JAVA_EXEFILE_PATH) + SPACE_LEN + + int cmd_len = strlen(JAVA_EXEFILE_PATH) + SPACE_LEN + strlen(JAVA_EXEOPTION) + SPACE_LEN + strlen(JAVA_LIBRARY_PATH) + EQUAL_LEN + #ifdef CONFIG_WIN32 @@ -376,11 +404,10 @@ int start_simple_client(char* msg) strlen(JAVA_SIMPLEMODE_OPTION) + EQUAL_LEN + QUOTATION_LEN + strlen(msg) + 1; - if (len > JAVA_MAX_COMMAND_LENGTH) { - len = JAVA_MAX_COMMAND_LENGTH; - } + INFO("skin command length : %d\n", cmd_len); + cmd = g_malloc0(cmd_len); - snprintf(cmd, len, "%s %s %s=\"%s\" \"%s%s\" %s=\"%s\"", + snprintf(cmd, cmd_len, "%s %s %s=\"%s\" \"%s%s\" %s=\"%s\"", #ifdef CONFIG_WIN32 JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAVA_LIBRARY_PATH, bin_dir_win, #else @@ -402,5 +429,7 @@ int start_simple_client(char* msg) INFO("child return value : %d\n", ret); + g_free(cmd); + return 1; } diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index abb33af562..b48db6114b 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -86,8 +86,8 @@ void start_display(uint64 handle_id, int lcd_size_width, int lcd_size_height, double scale_factor, short rotation_type) { - INFO("start_display handle_id:%ld, lcd size:%dx%d, \ - scale_factor:%f, rotation_type:%d\n", + INFO("start_display handle_id:%ld, display size:%dx%d, \ +scale_factor:%f, rotation_type:%d\n", (long) handle_id, lcd_size_width, lcd_size_height, scale_factor, rotation_type);