/*
* 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 <syeon.hwang@samsung.com>
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)
_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);
}
}
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)
{
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)
/* 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)
/*
* 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 <syeon.hwang@samsung.com>
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 */
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);
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);
#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
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)
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) {
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;
}
/* pci device description */
- INFO("* PCI devices :\n");
+ INFO("* Host PCI devices :\n");
char lspci_cmd[MAXLEN] = "lspci >> ";
strcat(lspci_cmd, log_path);
#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;
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]);
}
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);
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 {
}
/* 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
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,
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);
#endif
+ g_free(cmd);
+
return NULL;
}
int start_simple_client(char* msg)
{
int ret = 0;
- char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
+ gchar *cmd = NULL;
INFO("run simple client\n");
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
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
INFO("child return value : %d\n", ret);
+ g_free(cmd);
+
return 1;
}
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);