qemu: protobuf location is moved to distrib/protobuf and getting port for ecp dynamic...
authorJinhyung Choi <jinhyung2.choi@samsung.com>
Wed, 31 Jul 2013 10:47:27 +0000 (19:47 +0900)
committerJinhyung Choi <jinhyung2.choi@samsung.com>
Wed, 31 Jul 2013 10:47:27 +0000 (19:47 +0900)
Signed-off-by: Jinhyung Choi <jinhyung2.choi@samsung.com>
13 files changed:
tizen/distrib/protobuf/protobuf-c-private.h [moved from tizen/src/protobuf-c-private.h with 100% similarity]
tizen/distrib/protobuf/protobuf-c.c [moved from tizen/src/protobuf-c.c with 100% similarity]
tizen/distrib/protobuf/protobuf-c.h [moved from tizen/src/protobuf-c.h with 100% similarity]
tizen/src/Makefile.tizen
tizen/src/ecs.c
tizen/src/ecs.h
tizen/src/ecs_msg.c
tizen/src/emulator.c
tizen/src/genmsg/ecs.pb-c.h
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_operation.h
tizen/src/skin/maruskin_server.c

index 2e524c4..812b730 100644 (file)
@@ -2,10 +2,11 @@
 # for TIZEN-maru board
 
 
-$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/tizen/src/genmsg:$(SRC_PATH)/hw:$(SRC_PATH)/tizen/src:$(SRC_PATH)/tizen/src/hw:$(SRC_PATH)/tizen/src/skin:$(SRC_PATH)/tizen/src/SDL_gfx)
+$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/tizen/src/genmsg:$(SRC_PATH)/tizen/distrib/protobuf:$(SRC_PATH)/hw:$(SRC_PATH)/tizen/src:$(SRC_PATH)/tizen/src/hw:$(SRC_PATH)/tizen/src/skin:$(SRC_PATH)/tizen/src/SDL_gfx)
 
 QEMU_CFLAGS += -I$(SRC_PATH)/hw -I$(SRC_PATH)/tizen/src
 QEMU_CFLAGS += -I$(SRC_PATH)/tizen/src/genmsg
+QEMU_CFLAGS += -I$(SRC_PATH)/tizen/distrib/protobuf
 QEMU_CFLAGS += -I$(SRC_PATH)/tizen/distrib/libav/$(ARCH)/include
 QEMU_CFLAGS += -L$(SRC_PATH)/tizen/distrib/libav/$(ARCH)/lib
 QEMU_CFLAGS += -L$(HOME)/install/lib
index 5c7292d..609a969 100644 (file)
@@ -65,6 +65,9 @@ clients = QTAILQ_HEAD_INITIALIZER(clients);
 
 static ECS_State *current_ecs;
 
+static int port;
+static int port_setting = -1;
+
 static pthread_mutex_t mutex_clilist = PTHREAD_MUTEX_INITIALIZER;
 
 static inline void start_logging(void) {
@@ -695,7 +698,7 @@ void read_val_str(const char* data, char* ret_val, int len) {
        memcpy(ret_val, data, len);
 }
 
-void make_header(QDict* obj, type_length length, type_group group,
+void ecs_make_header(QDict* obj, type_length length, type_group group,
                type_action action) {
        qdict_put(obj, "length", qint_from_int((int64_t )length));
        qdict_put(obj, "group", qint_from_int((int64_t )group));
@@ -1218,10 +1221,12 @@ static void alive_checker(void *opaque) {
 
 static int socket_initialize(ECS_State *cs, QemuOpts *opts) {
        int fd = -1;
+       Error *local_err = NULL;
 
-       fd = inet_listen_opts(opts, 0, NULL);
-       if (0 > fd) {
-               LOG("listen fd failed %d", fd);
+       fd = inet_listen_opts(opts, 0, &local_err);
+       if (0 > fd || error_is_set(&local_err)) {
+               qerror_report_err(local_err);
+               error_free(local_err);
                return -1;
        }
 
@@ -1300,8 +1305,7 @@ static int ecs_loop(ECS_State *cs)
 }
 #endif
 
-int get_ecs_port(void) {
-       int port = HOST_LISTEN_PORT;
+static int check_port(int port) {
        int try = EMULATOR_SERVER_NUM;
 
        for (; try > 0; try--) {
@@ -1314,14 +1318,22 @@ int get_ecs_port(void) {
        return -1;
 }
 
+int get_ecs_port(void) {
+       if (port_setting < 0) {
+               LOG("ecs port is not determined yet.");
+               return 0;
+       }
+       return port;
+}
+
 static void* ecs_initialize(void* args) {
        int ret = 1;
+       int index;
        ECS_State *cs = NULL;
        QemuOpts *opts = NULL;
        Error *local_err = NULL;
        Monitor* mon = NULL;
        char host_port[16];
-       int port = -1;
 
        start_logging();
        LOG("ecs starts initializing.");
@@ -1333,15 +1345,13 @@ static void* ecs_initialize(void* args) {
                return NULL;
        }
 
-       port = (int) args;
+       port = check_port(HOST_LISTEN_PORT);
        if (port < 0) {
                LOG("None of port is available.");
                return NULL;
        }
-       sprintf(host_port, "%d", port);
 
        qemu_opt_set(opts, "host", HOST_LISTEN_ADDR);
-       qemu_opt_set(opts, "port", host_port);
 
        cs = g_malloc0(sizeof(ECS_State));
        if (NULL == cs) {
@@ -1349,12 +1359,32 @@ static void* ecs_initialize(void* args) {
                return NULL;
        }
 
-       ret = socket_initialize(cs, opts);
+       for (index = 0; index < EMULATOR_SERVER_NUM; index ++) {
+               sprintf(host_port, "%d", port);
+               qemu_opt_set(opts, "port", host_port);
+               ret = socket_initialize(cs, opts);
+               if (0 > ret) {
+                       LOG("socket initialization failed with port %d. next trial", port);
+                       port ++;
+
+                       port = check_port(port);
+                       if (port < 0) {
+                               LOG("None of port is available.");
+                               break;
+                       }
+               } else {
+                       break;
+               }
+       }
+
        if (0 > ret) {
-               LOG("socket initialization failed.");
-               return NULL;
+               LOG("socket resource is full.");
+               port = -1;
+               return ret;
        }
 
+       port_setting = 1;
+
        mon = monitor_create();
        if (NULL == mon) {
                LOG("monitor initialization failed.");
@@ -1373,6 +1403,7 @@ static void* ecs_initialize(void* args) {
        current_ecs = cs;
        cs->ecs_running = 1;
 
+       LOG("ecs_loop entered.");
        while (cs->ecs_running) {
                ret = ecs_loop(cs);
                if (0 > ret) {
@@ -1396,10 +1427,10 @@ int stop_ecs(void) {
        return 0;
 }
 
-int start_ecs(int port) {
+int start_ecs(void) {
        pthread_t thread_id;
 
-       if (0 != pthread_create(&thread_id, NULL, ecs_initialize, (void*) port)) {
+       if (0 != pthread_create(&thread_id, NULL, ecs_initialize, NULL)) {
                LOG("pthread creation failed.");
                return -1;
        }
index 84ff260..2d426ca 100644 (file)
@@ -32,7 +32,7 @@
 #define ECS_OPTS_NAME                  "ecs"
 #define HOST_LISTEN_ADDR               "127.0.0.1"
 #define HOST_LISTEN_PORT               27000
-#define EMULATOR_SERVER_NUM            3
+#define EMULATOR_SERVER_NUM            10
 
 #define COMMANDS_TYPE                  "type"
 #define COMMANDS_DATA                  "data"
@@ -127,7 +127,7 @@ typedef struct ECS_Client {
 } ECS_Client;
 
 
-int start_ecs(int port);
+int start_ecs(void);
 int stop_ecs(void);
 int get_ecs_port(void);
 
@@ -154,7 +154,7 @@ bool send_to_all_client(const char* data, const int len);
 void send_to_client(int fd, const char* data, const int len) ;
 
 
-void make_header(QDict* obj, type_length length, type_group group, type_action action);
+void ecs_make_header(QDict* obj, type_length length, type_group group, type_action action);
 
 void read_val_short(const char* data, unsigned short* ret_val);
 void read_val_char(const char* data, unsigned char* ret_val);
index 7cf47f0..cd33916 100644 (file)
@@ -255,7 +255,7 @@ bool ntf_to_injector(const char* data, const int len) {
     }
 
        QDict* obj_header = qdict_new();
-       make_header(obj_header, length, group, action);
+       ecs_make_header(obj_header, length, group, action);
 
        QDict* objData = qdict_new();
        qobject_incref(QOBJECT(obj_header));
index 1db3f9e..8ed63b5 100644 (file)
@@ -90,7 +90,6 @@ gchar bin_path[PATH_MAX] = { 0, };
 gchar log_path[PATH_MAX] = { 0, };
 
 int tizen_base_port;
-int tizen_ecs_port;
 char tizen_target_path[PATH_MAX];
 char tizen_target_img_path[PATH_MAX];
 
@@ -361,11 +360,9 @@ static void prepare_basic_features(void)
 
     tizen_base_port = get_sdb_base_port();
 
-       tizen_ecs_port = get_ecs_port();
-
     qemu_add_opts(&qemu_ecs_opts);
 
-       start_ecs(tizen_ecs_port);
+       start_ecs();
 
     get_host_proxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
     /* using "DNS" provided by default QEMU */
index 33f0878..6659266 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef PROTOBUF_C_ecs_2eproto__INCLUDED
 #define PROTOBUF_C_ecs_2eproto__INCLUDED
 
-#include "../protobuf-c.h"
+#include "../../distrib/protobuf/protobuf-c.h"
 
 PROTOBUF_C_BEGIN_DECLS
 
index 6ab7e52..1eb1939 100644 (file)
@@ -62,6 +62,7 @@ import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
 import org.tizen.emulator.skin.comm.ICommunicator.MouseButtonType;
@@ -125,16 +126,10 @@ public class EmulatorSkin {
        }
 
        public enum SkinBasicColor {
-               BLUE(0, 174, 239),
-               YELLOW(246, 226, 0),
-               LIME(0, 246, 12),
-               VIOLET(168, 43, 255),
-               ORANGE(246, 110, 0),
-               MAGENTA(245, 48, 233),
-               PURPLE(94, 73, 255),
-               GREEN(179, 246, 0),
-               RED(245, 48, 48),
-               CYON(29, 223, 221);
+               BLUE(0, 174, 239), YELLOW(246, 226, 0), LIME(0, 246, 12), VIOLET(168,
+                               43, 255), ORANGE(246, 110, 0), MAGENTA(245, 48, 233), PURPLE(
+                               94, 73, 255), GREEN(179, 246, 0), RED(245, 48, 48), CYON(29,
+                               223, 221);
 
                private int channelRed;
                private int channelGreen;
@@ -151,8 +146,8 @@ public class EmulatorSkin {
                }
        }
 
-       private static Logger logger =
-                       SkinLogger.getSkinLogger(EmulatorSkin.class).getLogger();
+       private static Logger logger = SkinLogger.getSkinLogger(EmulatorSkin.class)
+                       .getLogger();
 
        protected EmulatorConfig config;
        protected Shell shell;
@@ -194,9 +189,11 @@ public class EmulatorSkin {
 
        /**
         * @brief constructor
-        * @param config : configuration of emulator skin
-        * @param isOnTop : always on top flag
-       */
+        * @param config
+        *            : configuration of emulator skin
+        * @param isOnTop
+        *            : always on top flag
+        */
        protected EmulatorSkin(EmulatorConfig config, SkinInformation skinInfo,
                        int displayCanvasStyle, boolean isOnTop) {
                this.config = config;
@@ -228,19 +225,20 @@ public class EmulatorSkin {
        }
 
        private void setColorVM() {
-               int portNumber =
-                               config.getArgInt(ArgsConstants.VM_BASE_PORT) % 100;
+               int portNumber = config.getArgInt(ArgsConstants.VM_BASE_PORT) % 100;
 
                if (portNumber >= 26200) {
                        int red = (int) (Math.random() * 256);
                        int green = (int) (Math.random() * 256);
                        int blue = (int) (Math.random() * 256);
-                       this.colorVM = new Color(shell.getDisplay(), new RGB(red, green, blue));
+                       this.colorVM = new Color(shell.getDisplay(), new RGB(red, green,
+                                       blue));
                } else {
                        int vmIndex = (portNumber % 100) / 10;
 
                        SkinBasicColor colors[] = SkinBasicColor.values();
-                       this.colorVM = new Color(shell.getDisplay(), colors[vmIndex].color());
+                       this.colorVM = new Color(shell.getDisplay(),
+                                       colors[vmIndex].color());
                }
        }
 
@@ -255,15 +253,17 @@ public class EmulatorSkin {
 
                /* build a skin layout */
                if (skinInfo.isGeneralPurposeSkin() == false) {
-                       skinComposer = new ProfileSpecificSkinComposer(config, this,
-                                       shell, currentState, imageRegistry, communicator);
+                       skinComposer = new ProfileSpecificSkinComposer(config, this, shell,
+                                       currentState, imageRegistry, communicator);
 
-                       ((ProfileSpecificSkinComposer) skinComposer).addProfileSpecificListener(shell);
+                       ((ProfileSpecificSkinComposer) skinComposer)
+                                       .addProfileSpecificListener(shell);
                } else { /* general purpose skin */
-                       skinComposer = new GeneralPurposeSkinComposer(config, this,
-                                       shell, currentState, imageRegistry);
+                       skinComposer = new GeneralPurposeSkinComposer(config, this, shell,
+                                       currentState, imageRegistry);
 
-                       ((GeneralPurposeSkinComposer) skinComposer).addGeneralPurposeListener(shell);
+                       ((GeneralPurposeSkinComposer) skinComposer)
+                                       .addGeneralPurposeListener(shell);
                }
 
                lcdCanvas = skinComposer.compose(displayCanvasStyle);
@@ -280,39 +280,42 @@ public class EmulatorSkin {
                return 0;
        }
 
-//     private void readyToReopen( EmulatorSkin sourceSkin, boolean isOnTop ) {
-//
-//             logger.info( "Start Changing AlwaysOnTop status" );
-//
-//             sourceSkin.reopenSkin = new EmulatorSkin( sourceSkin.config, isOnTop );
-//
-//             sourceSkin.reopenSkin.lcdCanvas = sourceSkin.lcdCanvas;
-//             Point previousLocation = sourceSkin.shell.getLocation();
-//
-//             sourceSkin.reopenSkin.composeInternal( sourceSkin.lcdCanvas, previousLocation.x, previousLocation.y,
-//                             sourceSkin.currentLcdWidth, sourceSkin.currentLcdHeight, sourceSkin.currentScale,
-//                             sourceSkin.currentRotationId, sourceSkin.isOnKbd );
-//
-//             sourceSkin.reopenSkin.windowHandleId = sourceSkin.windowHandleId;
-//
-//             sourceSkin.reopenSkin.communicator = sourceSkin.communicator;
-//             sourceSkin.reopenSkin.communicator.resetSkin( reopenSkin );
-//
-//             sourceSkin.isAboutToReopen = true;
-//             sourceSkin.isShutdownRequested = true;
-//
-//             if ( sourceSkin.isScreenShotOpened && ( null != sourceSkin.screenShotDialog ) ) {
-//                     sourceSkin.screenShotDialog.setReserveImage( true );
-//                     sourceSkin.screenShotDialog.setEmulatorSkin( reopenSkin );
-//                     reopenSkin.isScreenShotOpened = true;
-//                     reopenSkin.screenShotDialog = sourceSkin.screenShotDialog;
-//                     // see open() method to know next logic for screenshot dialog.
-//             }
-//
-//             sourceSkin.lcdCanvas.setParent( reopenSkin.shell );
-//             sourceSkin.shell.close();
-//
-//     }
+       // private void readyToReopen( EmulatorSkin sourceSkin, boolean isOnTop ) {
+       //
+       // logger.info( "Start Changing AlwaysOnTop status" );
+       //
+       // sourceSkin.reopenSkin = new EmulatorSkin( sourceSkin.config, isOnTop );
+       //
+       // sourceSkin.reopenSkin.lcdCanvas = sourceSkin.lcdCanvas;
+       // Point previousLocation = sourceSkin.shell.getLocation();
+       //
+       // sourceSkin.reopenSkin.composeInternal( sourceSkin.lcdCanvas,
+       // previousLocation.x, previousLocation.y,
+       // sourceSkin.currentLcdWidth, sourceSkin.currentLcdHeight,
+       // sourceSkin.currentScale,
+       // sourceSkin.currentRotationId, sourceSkin.isOnKbd );
+       //
+       // sourceSkin.reopenSkin.windowHandleId = sourceSkin.windowHandleId;
+       //
+       // sourceSkin.reopenSkin.communicator = sourceSkin.communicator;
+       // sourceSkin.reopenSkin.communicator.resetSkin( reopenSkin );
+       //
+       // sourceSkin.isAboutToReopen = true;
+       // sourceSkin.isShutdownRequested = true;
+       //
+       // if ( sourceSkin.isScreenShotOpened && ( null !=
+       // sourceSkin.screenShotDialog ) ) {
+       // sourceSkin.screenShotDialog.setReserveImage( true );
+       // sourceSkin.screenShotDialog.setEmulatorSkin( reopenSkin );
+       // reopenSkin.isScreenShotOpened = true;
+       // reopenSkin.screenShotDialog = sourceSkin.screenShotDialog;
+       // // see open() method to know next logic for screenshot dialog.
+       // }
+       //
+       // sourceSkin.lcdCanvas.setParent( reopenSkin.shell );
+       // sourceSkin.shell.close();
+       //
+       // }
 
        private Color loadHoverColor() {
                HoverType hover = config.getDbiContents().getHover();
@@ -325,8 +328,8 @@ public class EmulatorSkin {
                                Long b = hoverRgb.getB();
 
                                if (null != r && null != g && null != b) {
-                                       Color hoverColor = new Color(shell.getDisplay(),
-                                                       new RGB(r.intValue(), g.intValue(), b.intValue()));
+                                       Color hoverColor = new Color(shell.getDisplay(), new RGB(
+                                                       r.intValue(), g.intValue(), b.intValue()));
 
                                        return hoverColor;
                                }
@@ -373,14 +376,14 @@ public class EmulatorSkin {
                this.shell.open();
 
                // logic only for reopen case ///////
-//             if ( isScreenShotOpened && ( null != screenShotDialog ) ) {
-//                     try {
-//                             screenShotDialog.setReserveImage( false );
-//                             screenShotDialog.open();
-//                     } finally {
-//                             isScreenShotOpened = false;
-//                     }
-//             }
+               // if ( isScreenShotOpened && ( null != screenShotDialog ) ) {
+               // try {
+               // screenShotDialog.setReserveImage( false );
+               // screenShotDialog.open();
+               // } finally {
+               // isScreenShotOpened = false;
+               // }
+               // }
                // ///////////////////////////////////
 
                while (!shell.isDisposed()) {
@@ -436,13 +439,15 @@ public class EmulatorSkin {
                                                                Boolean.toString(isOnTop));
 
                                                int dockValue = 0;
-                                               SkinWindow keyWindow = getKeyWindowKeeper().getKeyWindow();
-                                               if (keyWindow != null &&
-                                                               keyWindow.getShell().isVisible() == true) {
+                                               SkinWindow keyWindow = getKeyWindowKeeper()
+                                                               .getKeyWindow();
+                                               if (keyWindow != null
+                                                               && keyWindow.getShell().isVisible() == true) {
                                                        dockValue = getKeyWindowKeeper().getDockPosition();
                                                }
                                                config.setSkinProperty(
-                                                               SkinPropertiesConstants.KEYWINDOW_POSITION, dockValue);
+                                                               SkinPropertiesConstants.KEYWINDOW_POSITION,
+                                                               dockValue);
 
                                                config.saveSkinProperties();
 
@@ -471,8 +476,10 @@ public class EmulatorSkin {
                                        skinFinalize();
 
                                } else {
-                                       /* Skin have to be alive until
-                                        * receiving shutdown request from qemu */
+                                       /*
+                                        * Skin have to be alive until receiving shutdown request
+                                        * from qemu
+                                        */
                                        event.doit = false;
 
                                        if (null != communicator) {
@@ -485,17 +492,20 @@ public class EmulatorSkin {
                        public void shellActivated(ShellEvent event) {
                                logger.info("activate");
 
-                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
+                               if (isKeyWindow == true
+                                               && getKeyWindowKeeper().getKeyWindow() != null) {
                                        if (isOnTop == false) {
-                                               getKeyWindowKeeper().getKeyWindow().getShell().moveAbove(shell);
+                                               getKeyWindowKeeper().getKeyWindow().getShell()
+                                                               .moveAbove(shell);
 
                                                if (getKeyWindowKeeper().getDockPosition() != SWT.NONE) {
-                                                       shell.moveAbove(
-                                                                       getKeyWindowKeeper().getKeyWindow().getShell());
+                                                       shell.moveAbove(getKeyWindowKeeper().getKeyWindow()
+                                                                       .getShell());
                                                }
                                        } else {
                                                if (getKeyWindowKeeper().getDockPosition() == SWT.NONE) {
-                                                       getKeyWindowKeeper().getKeyWindow().getShell().moveAbove(shell);
+                                                       getKeyWindowKeeper().getKeyWindow().getShell()
+                                                                       .moveAbove(shell);
                                                }
                                        }
                                }
@@ -503,7 +513,7 @@ public class EmulatorSkin {
 
                        @Override
                        public void shellDeactivated(ShellEvent event) {
-                               //logger.info("deactivate");
+                               // logger.info("deactivate");
 
                                /* do nothing */
                        }
@@ -516,13 +526,17 @@ public class EmulatorSkin {
                                shell.getDisplay().asyncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
-                                                       Shell keyWindowShell = getKeyWindowKeeper().getKeyWindow().getShell();
+                                               if (isKeyWindow == true
+                                                               && getKeyWindowKeeper().getKeyWindow() != null) {
+                                                       Shell keyWindowShell = getKeyWindowKeeper()
+                                                                       .getKeyWindow().getShell();
 
                                                        if (keyWindowShell.getMinimized() == false) {
                                                                keyWindowShell.setVisible(false);
-                                                               /* the tool style window is exposed
-                                                               when even it was minimized */
+                                                               /*
+                                                                * the tool style window is exposed when even it
+                                                                * was minimized
+                                                                */
                                                                keyWindowShell.setMinimized(true);
                                                        }
                                                }
@@ -534,8 +548,10 @@ public class EmulatorSkin {
                        public void shellDeiconified(ShellEvent event) {
                                logger.info("deiconified");
 
-                               if (isKeyWindow == true && getKeyWindowKeeper().getKeyWindow() != null) {
-                                       Shell keyWindowShell = getKeyWindowKeeper().getKeyWindow().getShell();
+                               if (isKeyWindow == true
+                                               && getKeyWindowKeeper().getKeyWindow() != null) {
+                                       Shell keyWindowShell = getKeyWindowKeeper().getKeyWindow()
+                                                       .getShell();
 
                                        if (keyWindowShell.getMinimized() == true) {
                                                keyWindowShell.setMinimized(false);
@@ -544,9 +560,10 @@ public class EmulatorSkin {
                                }
 
                                DisplayStateData lcdStateData = new DisplayStateData(
-                                               currentState.getCurrentScale(), currentState.getCurrentRotationId());
-                               communicator.sendToQEMU(
-                                               SendCommand.CHANGE_LCD_STATE, lcdStateData, false);
+                                               currentState.getCurrentScale(),
+                                               currentState.getCurrentRotationId());
+                               communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+                                               lcdStateData, false);
                        }
                };
 
@@ -623,7 +640,7 @@ public class EmulatorSkin {
                        @Override
                        public void mouseMove(MouseEvent e) {
                                logger.info("mouse move : " + e);
-                               //TODO:
+                               // TODO:
                        }
                };
 
@@ -643,8 +660,7 @@ public class EmulatorSkin {
                                        }
 
                                        mouseUpDelivery(e);
-                               }
-                               else if (2 == e.button) /* wheel button */
+                               } else if (2 == e.button) /* wheel button */
                                {
                                        logger.info("wheelUp in display");
                                }
@@ -676,19 +692,19 @@ public class EmulatorSkin {
                        @Override
                        public void mouseUp(MouseEvent e) {
                                logger.info("mouse up : " + e);
-                               //TODO:
+                               // TODO:
                        }
 
                        @Override
                        public void mouseDown(MouseEvent e) {
                                logger.info("mouse down : " + e);
-                               //TODO:
+                               // TODO:
                        }
 
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
                                logger.info("mouse double click : " + e);
-                               //TODO:
+                               // TODO:
                        }
                };
 
@@ -702,9 +718,10 @@ public class EmulatorSkin {
                                int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
                                                currentState.getCurrentResolutionWidth(),
                                                currentState.getCurrentResolutionHeight(),
-                                               currentState.getCurrentScale(), currentState.getCurrentAngle());
-                               logger.info("mousewheel in display" +
-                                               " x:" + geometry[0] + " y:" + geometry[1] + " value:" + e.count);
+                                               currentState.getCurrentScale(),
+                                               currentState.getCurrentAngle());
+                               logger.info("mousewheel in display" + " x:" + geometry[0]
+                                               + " y:" + geometry[1] + " value:" + e.count);
 
                                int eventType;
                                if (e.count < 0) {
@@ -714,11 +731,11 @@ public class EmulatorSkin {
                                }
 
                                MouseEventData mouseEventData = new MouseEventData(
-                                               MouseButtonType.WHEEL.value(), eventType,
-                                               e.x, e.y, geometry[0], geometry[1], e.count);
+                                               MouseButtonType.WHEEL.value(), eventType, e.x, e.y,
+                                               geometry[0], geometry[1], e.count);
 
-                               communicator.sendToQEMU(
-                                               SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+                               communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT,
+                                               mouseEventData, false);
                        }
                };
 
@@ -750,7 +767,7 @@ public class EmulatorSkin {
                canvasFocusListener = new FocusListener() {
                        @Override
                        public void focusGained(FocusEvent event) {
-                               //logger.info("gain focus");
+                               // logger.info("gain focus");
 
                                /* do nothing */
                        }
@@ -765,16 +782,14 @@ public class EmulatorSkin {
                lcdCanvas.addFocusListener(canvasFocusListener);
 
                /* mouse event */
-               if (config.getArgBoolean(
-                               ArgsConstants.INPUT_MOUSE, false) == true) {
+               if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) {
                        canvasMouseMoveListener = makeDisplayMouseMoveLitener();
                } else {
                        canvasMouseMoveListener = makeDisplayTouchMoveLitener();
                }
                lcdCanvas.addMouseMoveListener(canvasMouseMoveListener);
 
-               if (config.getArgBoolean(
-                               ArgsConstants.INPUT_MOUSE, false) == true) {
+               if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) {
                        canvasMouseListener = makeDisplayMouseClickLitener();
                } else {
                        canvasMouseListener = makeDisplayTouchClickLitener();
@@ -796,8 +811,8 @@ public class EmulatorSkin {
                        @Override
                        public void keyReleased(KeyEvent e) {
                                if (logger.isLoggable(Level.INFO)) {
-                                       logger.info("'" + e.character + "':" +
-                                                       e.keyCode + ":" + e.stateMask + ":" + e.keyLocation);
+                                       logger.info("'" + e.character + "':" + e.keyCode + ":"
+                                                       + e.stateMask + ":" + e.keyLocation);
                                } else if (logger.isLoggable(Level.FINE)) {
                                        logger.fine(e.toString());
                                }
@@ -811,15 +826,17 @@ public class EmulatorSkin {
                                if (SwtUtil.isWindowsPlatform() && disappearEvent) {
                                        disappearEvent = false;
                                        if (isMetaKey(e.keyCode) && e.character != '\0') {
-                                               logger.info("send disappear release : keycode=" + disappearKeycode +
-                                                               ", stateMask=" + disappearStateMask +
-                                                               ", keyLocation=" + disappearKeyLocation);
+                                               logger.info("send disappear release : keycode="
+                                                               + disappearKeycode + ", stateMask="
+                                                               + disappearStateMask + ", keyLocation="
+                                                               + disappearKeyLocation);
 
                                                KeyEventData keyEventData = new KeyEventData(
                                                                KeyEventType.RELEASED.value(),
-                                                               disappearKeycode, disappearStateMask, disappearKeyLocation);
-                                               communicator.sendToQEMU(
-                                                               SendCommand.SEND_KEY_EVENT, keyEventData, false);
+                                                               disappearKeycode, disappearStateMask,
+                                                               disappearKeyLocation);
+                                               communicator.sendToQEMU(SendCommand.SEND_KEY_EVENT,
+                                                               keyEventData, false);
 
                                                removePressedKeyFromList(keyEventData);
 
@@ -837,10 +854,12 @@ public class EmulatorSkin {
                                int keyCode = e.keyCode;
                                int stateMask = e.stateMask;
 
-                               /* When the pressed key event is overwritten by next key event,
+                               /*
+                                * When the pressed key event is overwritten by next key event,
                                 * the release event of previous key does not occur in Windows.
-                                * So, we generate a release key event by ourselves
-                                * that had been disappeared. */
+                                * So, we generate a release key event by ourselves that had
+                                * been disappeared.
+                                */
                                if (SwtUtil.isWindowsPlatform()) {
                                        if (null != previous) {
                                                if (previous.keyCode != e.keyCode) {
@@ -851,11 +870,13 @@ public class EmulatorSkin {
                                                                disappearStateMask = stateMask;
                                                                disappearKeyLocation = e.keyLocation;
                                                        } else {
-                                                               /* three or more keys were pressed
-                                                               at the same time */
+                                                               /*
+                                                                * three or more keys were pressed at the same
+                                                                * time
+                                                                */
                                                                if (disappearEvent == true) {
-                                                                       logger.info("replace the disappearEvent : " +
-                                                                                       disappearKeycode + "->" + keyCode);
+                                                                       logger.info("replace the disappearEvent : "
+                                                                                       disappearKeycode + "->" + keyCode);
 
                                                                        disappearKeycode = keyCode;
                                                                        disappearStateMask = stateMask;
@@ -866,17 +887,23 @@ public class EmulatorSkin {
                                                                int previousStateMask = previous.stateMask;
 
                                                                if (logger.isLoggable(Level.INFO)) {
-                                                                       logger.info("send previous release : '" +
-                                                                                       previous.character + "':" + previous.keyCode + ":" +
-                                                                                       previous.stateMask + ":" + previous.keyLocation);
+                                                                       logger.info("send previous release : '"
+                                                                                       + previous.character + "':"
+                                                                                       + previous.keyCode + ":"
+                                                                                       + previous.stateMask + ":"
+                                                                                       + previous.keyLocation);
                                                                } else if (logger.isLoggable(Level.FINE)) {
-                                                                       logger.fine("send previous release :" + previous.toString());
+                                                                       logger.fine("send previous release :"
+                                                                                       + previous.toString());
                                                                }
 
-                                                               KeyEventData keyEventData = new KeyEventData(KeyEventType.RELEASED.value(),
-                                                                               previousKeyCode, previousStateMask, previous.keyLocation);
+                                                               KeyEventData keyEventData = new KeyEventData(
+                                                                               KeyEventType.RELEASED.value(),
+                                                                               previousKeyCode, previousStateMask,
+                                                                               previous.keyLocation);
                                                                communicator.sendToQEMU(
-                                                                               SendCommand.SEND_KEY_EVENT, keyEventData, false);
+                                                                               SendCommand.SEND_KEY_EVENT,
+                                                                               keyEventData, false);
 
                                                                removePressedKeyFromList(keyEventData);
                                                        }
@@ -886,8 +913,8 @@ public class EmulatorSkin {
                                } /* end isWindowsPlatform */
 
                                if (logger.isLoggable(Level.INFO)) {
-                                       logger.info("'" + e.character + "':" +
-                                                       e.keyCode + ":" + e.stateMask + ":" + e.keyLocation);
+                                       logger.info("'" + e.character + "':" + e.keyCode + ":"
+                                                       + e.stateMask + ":" + e.keyLocation);
                                } else if (logger.isLoggable(Level.FINE)) {
                                        logger.fine(e.toString());
                                }
@@ -910,11 +937,11 @@ public class EmulatorSkin {
                                currentState.getCurrentScale(), currentState.getCurrentAngle());
 
                MouseEventData mouseEventData = new MouseEventData(
-                               MouseButtonType.LEFT.value(), eventType,
-                               e.x, e.y, geometry[0], geometry[1], 0);
+                               MouseButtonType.LEFT.value(), eventType, e.x, e.y, geometry[0],
+                               geometry[1], 0);
 
-               communicator.sendToQEMU(
-                               SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+               communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+                               false);
        }
 
        protected void mouseUpDelivery(MouseEvent e) {
@@ -922,15 +949,15 @@ public class EmulatorSkin {
                                currentState.getCurrentResolutionWidth(),
                                currentState.getCurrentResolutionHeight(),
                                currentState.getCurrentScale(), currentState.getCurrentAngle());
-               logger.info("mouseUp in display" +
-                               " x:" + geometry[0] + " y:" + geometry[1]);
+               logger.info("mouseUp in display" + " x:" + geometry[0] + " y:"
+                               + geometry[1]);
 
                MouseEventData mouseEventData = new MouseEventData(
                                MouseButtonType.LEFT.value(), MouseEventType.RELEASE.value(),
                                e.x, e.y, geometry[0], geometry[1], 0);
 
-               communicator.sendToQEMU(
-                               SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+               communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+                               false);
        }
 
        protected void mouseDownDelivery(MouseEvent e) {
@@ -938,40 +965,40 @@ public class EmulatorSkin {
                                currentState.getCurrentResolutionWidth(),
                                currentState.getCurrentResolutionHeight(),
                                currentState.getCurrentScale(), currentState.getCurrentAngle());
-               logger.info("mouseDown in display" +
-                               " x:" + geometry[0] + " y:" + geometry[1]);
+               logger.info("mouseDown in display" + " x:" + geometry[0] + " y:"
+                               + geometry[1]);
 
                MouseEventData mouseEventData = new MouseEventData(
                                MouseButtonType.LEFT.value(), MouseEventType.PRESS.value(),
                                e.x, e.y, geometry[0], geometry[1], 0);
 
-               communicator.sendToQEMU(
-                               SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+               communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+                               false);
        }
 
-       protected void keyReleasedDelivery(int keyCode, int stateMask, int keyLocation) {
+       protected void keyReleasedDelivery(int keyCode, int stateMask,
+                       int keyLocation) {
                KeyEventData keyEventData = new KeyEventData(
                                KeyEventType.RELEASED.value(), keyCode, stateMask, keyLocation);
-               communicator.sendToQEMU(
-                               SendCommand.SEND_KEY_EVENT, keyEventData, false);
+               communicator
+                               .sendToQEMU(SendCommand.SEND_KEY_EVENT, keyEventData, false);
 
                removePressedKeyFromList(keyEventData);
        }
 
-       protected void keyPressedDelivery(int keyCode, int stateMask, int keyLocation) {
+       protected void keyPressedDelivery(int keyCode, int stateMask,
+                       int keyLocation) {
                KeyEventData keyEventData = new KeyEventData(
                                KeyEventType.PRESSED.value(), keyCode, stateMask, keyLocation);
-               communicator.sendToQEMU(
-                               SendCommand.SEND_KEY_EVENT, keyEventData, false);
+               communicator
+                               .sendToQEMU(SendCommand.SEND_KEY_EVENT, keyEventData, false);
 
                addPressedKeyToList(keyEventData);
        }
 
        private boolean isMetaKey(int keyCode) {
-               if (SWT.CTRL == keyCode ||
-                               SWT.ALT == keyCode ||
-                               SWT.SHIFT == keyCode ||
-                               SWT.COMMAND == keyCode) {
+               if (SWT.CTRL == keyCode || SWT.ALT == keyCode || SWT.SHIFT == keyCode
+                               || SWT.COMMAND == keyCode) {
                        return true;
                }
 
@@ -981,7 +1008,7 @@ public class EmulatorSkin {
        protected synchronized boolean addPressedKeyToList(KeyEventData pressData) {
                for (KeyEventData data : pressedKeyEventList) {
                        if (data.keycode == pressData.keycode &&
-                                       //data.stateMask == pressData.stateMask &&
+                       // data.stateMask == pressData.stateMask &&
                                        data.keyLocation == pressData.keyLocation) {
                                return false;
                        }
@@ -991,11 +1018,12 @@ public class EmulatorSkin {
                return true;
        }
 
-       protected synchronized boolean removePressedKeyFromList(KeyEventData releaseData) {
+       protected synchronized boolean removePressedKeyFromList(
+                       KeyEventData releaseData) {
 
                for (KeyEventData data : pressedKeyEventList) {
                        if (data.keycode == releaseData.keycode &&
-                                       //data.stateMask == releaseData.stateMask &&
+                       // data.stateMask == releaseData.stateMask &&
                                        data.keyLocation == releaseData.keyLocation) {
                                pressedKeyEventList.remove(data);
 
@@ -1070,8 +1098,8 @@ public class EmulatorSkin {
                                }
 
                                String emulatorName = SkinUtil.makeEmulatorName(config);
-                               DetailInfoDialog detailInfoDialog = new DetailInfoDialog(
-                                               shell, emulatorName, communicator, config, skinInfo);
+                               DetailInfoDialog detailInfoDialog = new DetailInfoDialog(shell,
+                                               emulatorName, communicator, config, skinInfo);
                                detailInfoDialog.open();
                        }
                };
@@ -1086,16 +1114,29 @@ public class EmulatorSkin {
 
                                String emulName = SkinUtil.getVmName(config);
                                int portSdb = config.getArgInt(ArgsConstants.VM_BASE_PORT);
-                               int portEcp = 0;
 
                                DataTranfer dataTranfer = communicator.sendDataToQEMU(
                                                SendCommand.ECP_PORT_REQ, null, true);
                                byte[] receivedData = communicator.getReceivedData(dataTranfer);
-                               portEcp = receivedData[0] << 24;
+                               int portEcp = receivedData[0] << 24;
                                portEcp |= receivedData[1] << 16;
                                portEcp |= receivedData[2] << 8;
                                portEcp |= receivedData[3];
 
+                               if (portEcp <= 0) {
+                                       logger.log(Level.INFO, "ecs server port failed: " + portEcp);
+                                       String ecpErrorMessage = "Please wait until ecs server is booting up.";
+                                       Shell temp = new Shell(Display.getDefault());
+                                       MessageBox messageBox = new MessageBox(temp, SWT.ICON_ERROR);
+                                       messageBox.setText("Emulator");
+                                       if (portEcp == -1) {
+                                               ecpErrorMessage = "Failed to open ecs server. Please restart the emulator.";
+                                       }
+                                       messageBox.setMessage(ecpErrorMessage);
+                                       messageBox.open();
+                                       return;
+                               }
+
                                ProcessBuilder procEcp = new ProcessBuilder();
 
                                // FIXME: appropriate running binary setting is necessary.
@@ -1147,8 +1188,8 @@ public class EmulatorSkin {
                                        popupMenu.onTopItem.setSelection(isOnTop = false);
                                } else {
                                        if (getKeyWindowKeeper().getKeyWindow() != null) {
-                                               SkinUtil.setTopMost(
-                                                               getKeyWindowKeeper().getKeyWindow().getShell(), isOnTop);
+                                               SkinUtil.setTopMost(getKeyWindowKeeper().getKeyWindow()
+                                                               .getShell(), isOnTop);
                                        }
                                }
                        }
@@ -1162,48 +1203,52 @@ public class EmulatorSkin {
 
                final List<MenuItem> rotationList = new ArrayList<MenuItem>();
 
-               Iterator<Entry<Short, RotationType>> iterator = SkinRotation.getRotationIterator();
+               Iterator<Entry<Short, RotationType>> iterator = SkinRotation
+                               .getRotationIterator();
 
-               while ( iterator.hasNext() ) {
+               while (iterator.hasNext()) {
 
                        Entry<Short, RotationType> entry = iterator.next();
                        Short rotationId = entry.getKey();
                        RotationType section = entry.getValue();
 
-                       final MenuItem menuItem = new MenuItem( menu, SWT.RADIO );
-                       menuItem.setText( section.getName().value() );
-                       menuItem.setData( rotationId );
+                       final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
+                       menuItem.setText(section.getName().value());
+                       menuItem.setData(rotationId);
 
                        if (currentState.getCurrentRotationId() == rotationId) {
-                               menuItem.setSelection( true );
+                               menuItem.setSelection(true);
                        }
 
-                       rotationList.add( menuItem );
+                       rotationList.add(menuItem);
 
                }
 
                /* temp : swap rotation menu names */
-               if (currentState.getCurrentResolutionWidth() >
-                               currentState.getCurrentResolutionHeight())
-               {
+               if (currentState.getCurrentResolutionWidth() > currentState
+                               .getCurrentResolutionHeight()) {
                        for (MenuItem m : rotationList) {
                                short rotationId = (Short) m.getData();
 
                                if (rotationId == RotationInfo.PORTRAIT.id()) {
-                                       String landscape = SkinRotation.getRotation(
-                                                       RotationInfo.LANDSCAPE.id()).getName().value();
+                                       String landscape = SkinRotation
+                                                       .getRotation(RotationInfo.LANDSCAPE.id()).getName()
+                                                       .value();
                                        m.setText(landscape);
                                } else if (rotationId == RotationInfo.LANDSCAPE.id()) {
-                                       String portrait = SkinRotation.getRotation(
-                                                       RotationInfo.PORTRAIT.id()).getName().value();
+                                       String portrait = SkinRotation
+                                                       .getRotation(RotationInfo.PORTRAIT.id()).getName()
+                                                       .value();
                                        m.setText(portrait);
                                } else if (rotationId == RotationInfo.REVERSE_PORTRAIT.id()) {
-                                       String landscapeReverse = SkinRotation.getRotation(
-                                                       RotationInfo.REVERSE_LANDSCAPE.id()).getName().value();
+                                       String landscapeReverse = SkinRotation
+                                                       .getRotation(RotationInfo.REVERSE_LANDSCAPE.id())
+                                                       .getName().value();
                                        m.setText(landscapeReverse);
                                } else if (rotationId == RotationInfo.REVERSE_LANDSCAPE.id()) {
-                                       String portraitReverse = SkinRotation.getRotation(
-                                                       RotationInfo.REVERSE_PORTRAIT.id()).getName().value();
+                                       String portraitReverse = SkinRotation
+                                                       .getRotation(RotationInfo.REVERSE_PORTRAIT.id())
+                                                       .getName().value();
                                        m.setText(portraitReverse);
                                }
                        }
@@ -1233,9 +1278,11 @@ public class EmulatorSkin {
                                                }
                                        }
 
-                                       SkinUtil.openMessage(shell, null,
-                                                       "Rotation is not ready.\n" +
-                                                       "Please wait until the emulator is completely boot up.",
+                                       SkinUtil.openMessage(
+                                                       shell,
+                                                       null,
+                                                       "Rotation is not ready.\n"
+                                                                       + "Please wait until the emulator is completely boot up.",
                                                        SWT.ICON_WARNING, config);
                                        return;
                                }
@@ -1245,10 +1292,12 @@ public class EmulatorSkin {
                                shell.getDisplay().syncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               skinComposer.arrangeSkin(currentState.getCurrentScale(), rotationId);
+                                               skinComposer.arrangeSkin(
+                                                               currentState.getCurrentScale(), rotationId);
 
                                                /* location correction */
-                                               Rectangle monitorBounds = Display.getDefault().getBounds();
+                                               Rectangle monitorBounds = Display.getDefault()
+                                                               .getBounds();
                                                Rectangle emulatorBounds = shell.getBounds();
                                                shell.setLocation(
                                                                Math.max(emulatorBounds.x, monitorBounds.x),
@@ -1256,10 +1305,10 @@ public class EmulatorSkin {
                                        }
                                });
 
-                               DisplayStateData lcdStateData =
-                                               new DisplayStateData(currentState.getCurrentScale(), rotationId);
-                               communicator.sendToQEMU(
-                                               SendCommand.CHANGE_LCD_STATE, lcdStateData, false);
+                               DisplayStateData lcdStateData = new DisplayStateData(
+                                               currentState.getCurrentScale(), rotationId);
+                               communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+                                               lcdStateData, false);
                        }
                };
 
@@ -1312,10 +1361,12 @@ public class EmulatorSkin {
                                shell.getDisplay().syncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               skinComposer.arrangeSkin(scale, currentState.getCurrentRotationId());
+                                               skinComposer.arrangeSkin(scale,
+                                                               currentState.getCurrentRotationId());
 
                                                /* location correction */
-                                               Rectangle monitorBounds = Display.getDefault().getBounds();
+                                               Rectangle monitorBounds = Display.getDefault()
+                                                               .getBounds();
                                                Rectangle emulatorBounds = shell.getBounds();
                                                shell.setLocation(
                                                                Math.max(emulatorBounds.x, monitorBounds.x),
@@ -1323,14 +1374,14 @@ public class EmulatorSkin {
                                        }
                                });
 
-                               DisplayStateData lcdStateData =
-                                               new DisplayStateData(scale, currentState.getCurrentRotationId());
-                               communicator.sendToQEMU(
-                                               SendCommand.CHANGE_LCD_STATE, lcdStateData, false);
+                               DisplayStateData lcdStateData = new DisplayStateData(scale,
+                                               currentState.getCurrentRotationId());
+                               communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+                                               lcdStateData, false);
 
                        }
                };
-               
+
                for (MenuItem menuItem : scaleList) {
 
                        int scale = ((Scale) menuItem.getData()).value();
@@ -1353,12 +1404,14 @@ public class EmulatorSkin {
                                        MenuItem layoutSelected = (MenuItem) e.widget;
 
                                        if (layoutSelected.getSelection() == true) {
-                                               for (MenuItem layout : layoutSelected.getParent().getItems()) {
+                                               for (MenuItem layout : layoutSelected.getParent()
+                                                               .getItems()) {
                                                        if (layout != layoutSelected) {
                                                                /* uncheck other menu items */
                                                                layout.setSelection(false);
                                                        } else {
-                                                               int layoutIndex = getKeyWindowKeeper().getLayoutIndex();
+                                                               int layoutIndex = getKeyWindowKeeper()
+                                                                               .getLayoutIndex();
                                                                if (getKeyWindowKeeper().determineLayout() != layoutIndex) {
                                                                        /* switch */
                                                                        getKeyWindowKeeper().closeKeyWindow();
@@ -1370,12 +1423,12 @@ public class EmulatorSkin {
                                }
 
                                /* control the window */
-                               if (getKeyWindowKeeper().isSelectKeyWindowMenu() == true)
-                               { /* checked */
+                               if (getKeyWindowKeeper().isSelectKeyWindowMenu() == true) { /* checked */
                                        if (getKeyWindowKeeper().getKeyWindow() == null) {
                                                if (getKeyWindowKeeper().getRecentlyDocked() != SWT.NONE) {
                                                        getKeyWindowKeeper().openKeyWindow(
-                                                                       getKeyWindowKeeper().getRecentlyDocked(), false);
+                                                                       getKeyWindowKeeper().getRecentlyDocked(),
+                                                                       false);
 
                                                        getKeyWindowKeeper().setRecentlyDocked(SWT.NONE);
                                                } else {
@@ -1387,9 +1440,7 @@ public class EmulatorSkin {
                                                getKeyWindowKeeper().openKeyWindow(
                                                                getKeyWindowKeeper().getDockPosition(), false);
                                        }
-                               }
-                               else
-                               { /* unchecked */
+                               } else { /* unchecked */
                                        if (getKeyWindowKeeper().getDockPosition() != SWT.NONE) {
                                                /* close the Key Window if it is docked to Main Window */
                                                getKeyWindowKeeper().setRecentlyDocked(
@@ -1414,15 +1465,15 @@ public class EmulatorSkin {
                                logger.info("Ram dump menu is selected");
 
                                communicator.setRamdumpFlag(true);
-                               communicator.sendToQEMU(
-                                               SendCommand.RAM_DUMP, null, false);
+                               communicator.sendToQEMU(SendCommand.RAM_DUMP, null, false);
 
                                RamdumpDialog ramdumpDialog;
                                try {
-                                       ramdumpDialog = new RamdumpDialog(shell, communicator, config);
+                                       ramdumpDialog = new RamdumpDialog(shell, communicator,
+                                                       config);
                                        ramdumpDialog.open();
                                } catch (IOException ee) {
-                                       logger.log( Level.SEVERE, ee.getMessage(), ee);
+                                       logger.log(Level.SEVERE, ee.getMessage(), ee);
                                }
                        }
                };
@@ -1448,9 +1499,11 @@ public class EmulatorSkin {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                if (!communicator.isSensorDaemonStarted()) {
-                                       SkinUtil.openMessage(shell, null,
-                                                       "Host Keyboard is not ready.\n" +
-                                                       "Please wait until the emulator is completely boot up.",
+                                       SkinUtil.openMessage(
+                                                       shell,
+                                                       null,
+                                                       "Host Keyboard is not ready.\n"
+                                                                       + "Please wait until the emulator is completely boot up.",
                                                        SWT.ICON_WARNING, config);
                                        popupMenu.kbdOnItem.setSelection(isOnKbd);
                                        popupMenu.kbdOffItem.setSelection(!isOnKbd);
@@ -1464,8 +1517,9 @@ public class EmulatorSkin {
                                        isOnKbd = on;
                                        logger.info("Host Keyboard " + isOnKbd);
 
-                                       communicator.sendToQEMU(SendCommand.HOST_KBD,
-                                                       new BooleanData(on, SendCommand.HOST_KBD.toString()), false);
+                                       communicator
+                                                       .sendToQEMU(SendCommand.HOST_KBD, new BooleanData(
+                                                                       on, SendCommand.HOST_KBD.toString()), false);
                                }
                        }
                };
@@ -1494,8 +1548,8 @@ public class EmulatorSkin {
                                logger.info("Force close is selected");
 
                                int answer = SkinUtil.openMessage(shell, null,
-                                               "If you force stop an emulator, it may cause some problems.\n" +
-                                               "Are you sure you want to contiue?",
+                                               "If you force stop an emulator, it may cause some problems.\n"
+                                                               + "Are you sure you want to contiue?",
                                                SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL, config);
 
                                if (answer == SWT.OK) {
@@ -1523,8 +1577,11 @@ public class EmulatorSkin {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                if (!communicator.isSdbDaemonStarted()) {
-                                       SkinUtil.openMessage(shell, null, "SDB is not ready.\n" +
-                                                       "Please wait until the emulator is completely boot up.",
+                                       SkinUtil.openMessage(
+                                                       shell,
+                                                       null,
+                                                       "SDB is not ready.\n"
+                                                                       + "Please wait until the emulator is completely boot up.",
                                                        SWT.ICON_WARNING, config);
                                        return;
                                }
@@ -1533,11 +1590,14 @@ public class EmulatorSkin {
 
                                File sdbFile = new File(sdbPath);
                                if (!sdbFile.exists()) {
-                                       logger.log(Level.INFO, "SDB file is not exist : " + sdbFile.getAbsolutePath());
+                                       logger.log(
+                                                       Level.INFO,
+                                                       "SDB file is not exist : "
+                                                                       + sdbFile.getAbsolutePath());
                                        try {
                                                SkinUtil.openMessage(shell, null,
-                                                               "SDB file is not exist in the following path.\n" +
-                                                               sdbFile.getCanonicalPath(),
+                                                               "SDB file is not exist in the following path.\n"
+                                                                               + sdbFile.getCanonicalPath(),
                                                                SWT.ICON_ERROR, config);
                                        } catch (IOException ee) {
                                                logger.log(Level.SEVERE, ee.getMessage(), ee);
@@ -1550,16 +1610,19 @@ public class EmulatorSkin {
                                ProcessBuilder procSdb = new ProcessBuilder();
 
                                if (SwtUtil.isLinuxPlatform()) {
-                                       procSdb.command("/usr/bin/gnome-terminal", "--disable-factory",
-                                                       "--title=" + SkinUtil.makeEmulatorName( config ), "-x", sdbPath,
-                                                       "-s", "emulator-" + portSdb, "shell");
+                                       procSdb.command("/usr/bin/gnome-terminal",
+                                                       "--disable-factory",
+                                                       "--title=" + SkinUtil.makeEmulatorName(config),
+                                                       "-x", sdbPath, "-s", "emulator-" + portSdb, "shell");
                                } else if (SwtUtil.isWindowsPlatform()) {
                                        procSdb.command("cmd.exe", "/c", "start", sdbPath, "sdb",
                                                        "-s", "emulator-" + portSdb, "shell");
                                } else if (SwtUtil.isMacPlatform()) {
                                        procSdb.command("./sdbscript", "emulator-" + portSdb);
-                                       /* procSdb.command(
-                                       "/usr/X11/bin/uxterm", "-T", "emulator-" + portSdb, "-e", sdbPath,"shell"); */
+                                       /*
+                                        * procSdb.command( "/usr/X11/bin/uxterm", "-T", "emulator-"
+                                        * + portSdb, "-e", sdbPath,"shell");
+                                        */
                                }
 
                                logger.log(Level.INFO, procSdb.command().toString());
@@ -1568,12 +1631,11 @@ public class EmulatorSkin {
                                        procSdb.start(); /* open the sdb shell */
                                } catch (Exception ee) {
                                        logger.log(Level.SEVERE, ee.getMessage(), ee);
-                                       SkinUtil.openMessage(shell, null, "Fail to open Shell: \n" +
-                                                       ee.getMessage(), SWT.ICON_ERROR, config);
+                                       SkinUtil.openMessage(shell, null, "Fail to open Shell: \n"
+                                                       ee.getMessage(), SWT.ICON_ERROR, config);
                                }
 
-                               communicator.sendToQEMU(
-                                               SendCommand.OPEN_SHELL, null, false);
+                               communicator.sendToQEMU(SendCommand.OPEN_SHELL, null, false);
                        }
                };
 
@@ -1586,8 +1648,7 @@ public class EmulatorSkin {
                        public void widgetSelected(SelectionEvent e) {
                                logger.info("Close Menu is selected");
 
-                               communicator.sendToQEMU(
-                                               SendCommand.CLOSE, null, false);
+                               communicator.sendToQEMU(SendCommand.CLOSE, null, false);
                        }
                };
 
@@ -1607,7 +1668,7 @@ public class EmulatorSkin {
                                                EmulatorSkin.this.shell.close();
                                        }
                                }
-                       } );
+                       });
                }
 
        }
@@ -1626,12 +1687,12 @@ public class EmulatorSkin {
                                KeyEventData keyEventData = new KeyEventData(
                                                KeyEventType.RELEASED.value(), data.keycode,
                                                data.stateMask, data.keyLocation);
-                               communicator.sendToQEMU(
-                                               SendCommand.SEND_KEY_EVENT, keyEventData, false);
+                               communicator.sendToQEMU(SendCommand.SEND_KEY_EVENT,
+                                               keyEventData, false);
 
-                               logger.info("auto release : keycode=" + keyEventData.keycode +
-                                               ", stateMask=" + keyEventData.stateMask +
-                                               ", keyLocation=" + keyEventData.keyLocation);
+                               logger.info("auto release : keycode=" + keyEventData.keycode
+                                               + ", stateMask=" + keyEventData.stateMask
+                                               ", keyLocation=" + keyEventData.keyLocation);
                        }
                }
 
index b48db61..fc00f8e 100644 (file)
@@ -43,7 +43,6 @@
 #include "emulator.h"
 #include "debug_ch.h"
 #include "sdb.h"
-#include "ecs.h"
 #include "mloop_event.h"
 #include "emul_state.h"
 #include "maruskin_keymap.h"
@@ -508,11 +507,6 @@ void free_detail_info(DetailInfo* detail_info)
     }
 }
 
-int get_ecs_port_req(void)
-{
-       return get_ecs_port();
-}
-
 void do_open_shell(void)
 {
     INFO("open shell\n");
index 6356af2..0ef20c9 100644 (file)
@@ -61,7 +61,6 @@ void send_rotation_event(int rotation_type);
 
 QemuSurfaceInfo *get_screenshot_info(void);
 DetailInfo *get_detail_info(int qemu_argc, char **qemu_argv);
-int get_ecs_port_req(void);
 void free_detail_info(DetailInfo *detail_info);
 void free_screenshot_info(QemuSurfaceInfo *);
 
index 933bd83..c1fa7e1 100644 (file)
@@ -44,6 +44,7 @@
 #include "maruskin_client.h"
 #include "emulator.h"
 #include "maru_err_table.h"
+#include "ecs.h"
 
 #ifndef CONFIG_USE_SHM
 #include "maru_sdl.h"
@@ -970,7 +971,7 @@ static void* run_skin_server(void* args)
                     log_cnt += sprintf(log_buf + log_cnt, "RECV_ECP_PORT_REQ ==\n");
                     TRACE(log_buf);
 
-                                       int port = get_ecs_port_req();
+                                       int port = get_ecs_port();
                        unsigned char port_buf[5];
                                        memset(port_buf, 0, 5);
                                        port_buf[0] = (port & 0xFF000000) >> 24;