Update liveinfo util, key down/up, accessibility
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 25 Jan 2013 11:06:42 +0000 (11:06 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 25 Jan 2013 11:06:42 +0000 (11:06 +0000)
Change-Id: I50b0dc92adaffaca248758365392243a90c3a14b

packaging/org.tizen.data-provider-master.spec
src/group.c
src/instance.c
src/server.c
src/slave_life.c
src/xmonitor.c
util_liveinfo/src/liveinfo.c

index e928c79..7d46e67 100644 (file)
@@ -1,6 +1,6 @@
 Name: org.tizen.data-provider-master
 Summary: Master data provider
-Version: 0.14.4
+Version: 0.14.5
 Release: 1
 Group: main/app
 License: Flora License
index 2b94e45..4b58aa9 100644 (file)
@@ -474,7 +474,6 @@ HAPI int group_add_livebox(const char *group, const char *pkgname)
        struct context_info *info;
        struct context_item *item;
        char *key;
-       char *value;
        char *name;
        char *ptr;
        int len;
@@ -493,7 +492,6 @@ HAPI int group_add_livebox(const char *group, const char *pkgname)
        ptr = (char *)group;
        len = 0;
        key = NULL;
-       value = NULL;
 
        /* Skip the first space characters */
        while (*ptr && isspace(*ptr)) ptr++;
index b96cb4f..59e228a 100644 (file)
@@ -2194,7 +2194,6 @@ HAPI int instance_destroyed(struct inst_info *inst)
  */
 HAPI int instance_recover_state(struct inst_info *inst)
 {
-       struct pkg_info *info;
        int ret = 0;
 
        if (inst->changing_state) {
@@ -2215,7 +2214,6 @@ HAPI int instance_recover_state(struct inst_info *inst)
                        break;
                case INST_DESTROYED:
                        DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       info = inst->info;
                        instance_state_reset(inst);
                        instance_destroy(inst);
                        break;
@@ -2263,11 +2261,8 @@ HAPI int instance_recover_state(struct inst_info *inst)
 HAPI int instance_need_slave(struct inst_info *inst)
 {
        int ret = 0;
-       struct pkg_info *info;
 
        if (inst->client && client_is_faulted(inst->client)) {
-               info = inst->info;
-
                /*!
                 * \note
                 * In this case, the client is faulted(disconnected)
@@ -2276,7 +2271,7 @@ HAPI int instance_need_slave(struct inst_info *inst)
                 * remove it and don't try to recover its states
                 */
 
-               DbgPrint("CLIENT FAULT: Req. to DESTROYED (%s)\n", package_name(info));
+               DbgPrint("CLIENT FAULT: Req. to DESTROYED (%s)\n", package_name(inst->info));
                switch (inst->state) {
                case INST_INIT:
                case INST_ACTIVATED:
@@ -2305,7 +2300,6 @@ HAPI int instance_need_slave(struct inst_info *inst)
                        break;
                case INST_DESTROYED:
                        DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       info = inst->info;
                        instance_state_reset(inst);
                        instance_destroy(inst);
                        break;
index 201910e..d896eb8 100644 (file)
@@ -671,7 +671,7 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
        } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               // struct packet *packet;
 
                buffer = instance_pd_buffer(inst);
                if (!buffer) {
@@ -687,14 +687,1391 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
                        goto out;
                }
 
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_in(e, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not found\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("pd_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_out(e, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not found\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("pd_mouse_down", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, 1);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("pd_mouse_up", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, 0);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*!
+                * Reuse the packet.
+               packet = packet_create_noack("pd_mouse_move", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+                */
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_lb_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("lb_mouse_move", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_lb_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("lb_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_in(e, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_lb_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               evas_event_feed_mouse_out(e, timestamp, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_lb_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("lb_mouse_down", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, 1);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Parameter is not matched\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               //struct packet *packet;
+
+               buffer = instance_lb_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("lb_mouse_up", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, 0);
+               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_access_read(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Invalid parameter\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not found\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               /*!
+                * \TODO: Push up the ACCESS_READ event
+                */
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_access_read_prev(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Invalid parameter\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not found\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               if (!packet) {
+                       ErrPrint("Failed to create a packet[%s]\n", pkgname);
+                       ret = -EFAULT;
+                       goto out;
+               }
+               */
+
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+               Evas *e;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               e = script_handler_evas(script);
+               if (!e) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               /*!
+                * \TODO: Push up the ACCESS_READ_PREV event
+                */
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = -EINVAL;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_access_read_next(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int w;
+       int h;
+       double timestamp;
+       double x;
+       double y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_pid(pid);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
+       if (ret != 7) {
+               ErrPrint("Invalid parameter\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /*!
+        * \NOTE:
+        * Trust the package name which are sent by the client.
+        * The package has to be a livebox package name.
+        */
+       inst = package_find_instance_by_id(pkgname, id);
+       if (!inst) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               ret = -ENOENT;
+               goto out;
+       }
+
+       pkg = instance_package(inst);
+       if (!pkg) {
+               ErrPrint("Package[%s] info is not found\n", pkgname);
+               ret = -EFAULT;
+               goto out;
+       }
+
+       if (package_is_fault(pkg)) {
+               /*!
+                * \note
+                * If the package is registered as fault module,
+                * slave has not load it, so we don't need to do anything at here!
+                */
+               DbgPrint("Package[%s] is faulted\n", pkgname);
+               ret = -EFAULT;
+       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               struct buffer_info *buffer;
+               struct slave_node *slave;
+               // struct packet *packet;
+
+               buffer = instance_pd_buffer(inst);
+               if (!buffer) {
+                       ErrPrint("Instance[%s] has no buffer\n", id);
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               slave = package_slave(pkg);
+               if (!slave) {
+                       ErrPrint("Package[%s] has no slave\n", pkgname);
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               /*
                packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -712,7 +2089,9 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_in(e, timestamp, NULL);
+               /*!
+                * \TODO: Push up the ACCESS_READ_NEXT event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -724,7 +2103,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -747,7 +2126,7 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
 
        ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
        if (ret != 7) {
-               ErrPrint("Parameter is not matched\n");
+               ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
        }
@@ -782,7 +2161,7 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
        } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               // struct packet *packet;
 
                buffer = instance_pd_buffer(inst);
                if (!buffer) {
@@ -798,14 +2177,17 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               packet = packet_create_noack("pd_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -823,7 +2205,9 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_out(e, timestamp, NULL);
+               /*!
+                * \TODO: Push up the ACCESS_READ_ACTIVATE event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -835,7 +2219,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -858,7 +2242,7 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
 
        ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
        if (ret != 7) {
-               ErrPrint("Parameter is not matched\n");
+               ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
        }
@@ -893,7 +2277,7 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
        } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               // struct packet *packet;
 
                buffer = instance_pd_buffer(inst);
                if (!buffer) {
@@ -909,14 +2293,17 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               packet = packet_create_noack("pd_mouse_down", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -933,9 +2320,10 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
-               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               script_handler_update_pointer(script, x, y, -1);
+               /*!
+                * \TODO: Push up the KEY_DOWN event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -947,7 +2335,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -970,7 +2358,7 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
 
        ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, &timestamp, &x, &y);
        if (ret != 7) {
-               ErrPrint("Parameter is not matched\n");
+               ErrPrint("Invalid parameter\n");
                ret = -EINVAL;
                goto out;
        }
@@ -989,7 +2377,7 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
 
        pkg = instance_package(inst);
        if (!pkg) {
-               ErrPrint("Package[%s] info is not exists\n", pkgname);
+               ErrPrint("Package[%s] info is not found\n", pkgname);
                ret = -EFAULT;
                goto out;
        }
@@ -1005,7 +2393,7 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
        } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               // struct packet *packet;
 
                buffer = instance_pd_buffer(inst);
                if (!buffer) {
@@ -1021,14 +2409,17 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
                        goto out;
                }
 
-               packet = packet_create_noack("pd_mouse_up", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -1045,9 +2436,10 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 0);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
-               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               script_handler_update_pointer(script, x, y, -1);
+               /*!
+                * \TODO: Push up the KEY_UP event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1059,7 +2451,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_access_read(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1114,12 +2506,12 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
                 */
                DbgPrint("Package[%s] is faulted\n", pkgname);
                ret = -EFAULT;
-       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+       } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
                //struct packet *packet;
 
-               buffer = instance_pd_buffer(inst);
+               buffer = instance_lb_buffer(inst);
                if (!buffer) {
                        ErrPrint("Instance[%s] has no buffer\n", id);
                        ret = -EFAULT;
@@ -1133,22 +2525,22 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               /*!
-                * Reuse the packet.
-               packet = packet_create_noack("pd_mouse_move", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
-                */
+               */
+
                packet_ref((struct packet *)packet);
                ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
 
-               script = instance_pd_script(inst);
+               script = instance_lb_script(inst);
                if (!script) {
                        ret = -EFAULT;
                        goto out;
@@ -1161,7 +2553,10 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+
+               /*!
+                * \TODO: Feed up this ACCESS_READ event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1173,7 +2568,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_access_read_prev(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1248,13 +2643,14 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
                }
 
                /*
-               packet = packet_create_noack("lb_mouse_move", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
                */
+
                packet_ref((struct packet *)packet);
                ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
@@ -1274,7 +2670,10 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
+
+               /*!
+                * \TODO: Feed up this ACCESS_READ_PREV event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1286,7 +2685,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_access_read_next(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1344,7 +2743,7 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
        } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               //struct packet *packet;
 
                buffer = instance_lb_buffer(inst);
                if (!buffer) {
@@ -1360,14 +2759,17 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
                        goto out;
                }
 
-               packet = packet_create_noack("lb_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -1385,7 +2787,10 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_in(e, timestamp, NULL);
+
+               /*!
+                * \TODO: Feed up this ACCESS_READ_NEXT event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1397,7 +2802,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1455,7 +2860,7 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
        } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               //struct packet *packet;
 
                buffer = instance_lb_buffer(inst);
                if (!buffer) {
@@ -1471,14 +2876,17 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
                        goto out;
                }
 
+               /*
                packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -1496,7 +2904,10 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
                }
 
                script_handler_update_pointer(script, x, y, -1);
-               evas_event_feed_mouse_out(e, timestamp, NULL);
+
+               /*!
+                * \TODO: Feed up this ACCESS_ACTIVATE event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1508,7 +2919,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1566,7 +2977,7 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
        } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               //struct packet *packet;
 
                buffer = instance_lb_buffer(inst);
                if (!buffer) {
@@ -1582,14 +2993,17 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               packet = packet_create_noack("lb_mouse_down", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -1606,9 +3020,11 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 1);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
-               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+               script_handler_update_pointer(script, x, y, -1);
+
+               /*!
+                * \TODO: Feed up this KEY_DOWN event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -1620,7 +3036,7 @@ out:
        return NULL;
 }
 
-static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
        const char *pkgname;
@@ -1678,7 +3094,7 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
        } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
                struct buffer_info *buffer;
                struct slave_node *slave;
-               struct packet *packet;
+               //struct packet *packet;
 
                buffer = instance_lb_buffer(inst);
                if (!buffer) {
@@ -1694,14 +3110,17 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
                        goto out;
                }
 
-               packet = packet_create_noack("lb_mouse_up", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+               /*
+               packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
                if (!packet) {
                        ErrPrint("Failed to create a packet[%s]\n", pkgname);
                        ret = -EFAULT;
                        goto out;
                }
+               */
 
-               ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+               packet_ref((struct packet *)packet);
+               ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
        } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
                struct script_info *script;
                Evas *e;
@@ -1718,9 +3137,11 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
                        goto out;
                }
 
-               script_handler_update_pointer(script, x, y, 0);
-               evas_event_feed_mouse_move(e, x * w, y * h, timestamp, NULL);
-               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+               script_handler_update_pointer(script, x, y, -1);
+
+               /*!
+                * \TODO: Feed up this KEY_UP event
+                */
                ret = 0;
        } else {
                ErrPrint("Unsupported package\n");
@@ -3269,9 +4690,6 @@ static struct packet *liveinfo_slave_list(pid_t pid, int handle, const struct pa
        if (!fp)
                goto out;
 
-       fprintf(fp, "----------------------------------------------------------------------[Slave List]------------------------------------------------------------------------------\n");
-       fprintf(fp, "    pid          slave name                     package name                   abi     secured   refcnt   fault           state           inst   pkg     ttl    \n");
-       fprintf(fp, "----------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
        list = (Eina_List *)slave_list();
        EINA_LIST_FOREACH(list, l, slave) {
                fprintf(fp, "  %7d   %20s   %39s   %7s   %7s   %6d   %5d   %21s   %4d   %3d   %3.4lf  \n", 
@@ -3288,6 +4706,7 @@ static struct packet *liveinfo_slave_list(pid_t pid, int handle, const struct pa
                        slave_ttl(slave)
                );
        }
+       fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
 
 out:
@@ -3332,7 +4751,7 @@ static struct packet *liveinfo_slave_load(pid_t pid, int handle, const struct pa
                if (package_slave(pkg) == slave)
                        fprintf(fp, "%s, ", package_name(pkg));
        }
-       fprintf(fp, "}\n");
+       fprintf(fp, "}\nEOD\n");
 
        liveinfo_close_fifo(info);
 
@@ -3396,10 +4815,6 @@ static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       fprintf(fp, "-----------------------------------------------[Instance List]---------------------------------------\n");
-       fprintf(fp, "         ID         |      Cluster ID    |   Sub cluster ID   | Period | Visibility | Width | Height \n");
-       fprintf(fp, "-----------------------------------------------------------------------------------------------------\n");
-
        inst_list = package_instance_list(pkg);
        EINA_LIST_FOREACH(inst_list, l, inst) {
                fprintf(fp, " %18s %18s %18s %3.3lf %10s %5d %6d\n",
@@ -3412,6 +4827,7 @@ static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct pac
                                                instance_lb_height(inst));
        }
 
+       fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
 
 out:
@@ -3447,9 +4863,6 @@ static struct packet *liveinfo_pkg_list(pid_t pid, int handle, const struct pack
        if (!fp)
                goto out;
 
-       fprintf(fp, "+----------------------------------------------[Package List]------------------------------------------------+\n");
-       fprintf(fp, "    pid          slave name                     package name                   abi     refcnt   fault   inst  \n");
-       fprintf(fp, "+------------------------------------------------------------------------------------------------------------+\n");
        list = (Eina_List *)package_list();
        EINA_LIST_FOREACH(list, l, pkg) {
                slave = package_slave(pkg);
@@ -3474,6 +4887,7 @@ static struct packet *liveinfo_pkg_list(pid_t pid, int handle, const struct pack
                        eina_list_count(inst_list)
                );
        }
+       fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
 
 out:
@@ -3490,6 +4904,36 @@ static struct packet *liveinfo_pkg_ctrl(pid_t pid, int handle, const struct pack
        return NULL;
 }
 
+static struct packet *liveinfo_toggle_debug(pid_t pid, int handle, const struct packet *packet)
+{
+       double timestamp;
+       struct liveinfo *info;
+       FILE *fp;
+
+       if (packet_get(packet, "d", &timestamp) != 1) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       info = liveinfo_find_by_pid(pid);
+       if (!info) {
+               ErrPrint("Invalid request\n");
+               goto out;
+       }
+
+       liveinfo_open_fifo(info);
+       fp = liveinfo_fifo(info);
+       if (!fp)
+               goto out;
+
+       g_conf.debug_mode = !g_conf.debug_mode;
+       fprintf(fp, "Debug mode is %s\nEOD\n", g_conf.debug_mode ? "enabled" : "disabled");
+       liveinfo_close_fifo(info);
+
+out:
+       return NULL;
+}
+
 static struct method s_info_table[] = {
        {
                .cmd = "liveinfo_hello",
@@ -3520,6 +4964,10 @@ static struct method s_info_table[] = {
                .handler = liveinfo_pkg_ctrl,
        },
        {
+               .cmd = "toggle_debug",
+               .handler = liveinfo_toggle_debug,
+       },
+       {
                .cmd = NULL,
                .handler = NULL,
        },
@@ -3658,6 +5106,59 @@ static struct method s_client_table[] = {
                .cmd = "refresh_group",
                .handler = client_refresh_group,
        },
+
+       {
+               .cmd = "pd_access_read",
+               .handler = client_pd_access_read,
+       },
+       {
+               .cmd = "pd_access_read_prev",
+               .handler = client_pd_access_read_prev,
+       },
+       {
+               .cmd = "pd_access_read_next",
+               .handler = client_pd_access_read_next,
+       },
+       {
+               .cmd = "pd_access_activate",
+               .handler = client_pd_access_activate,
+       },
+
+       {
+               .cmd = "lb_access_read",
+               .handler = client_lb_access_read,
+       },
+       {
+               .cmd = "lb_access_read_prev",
+               .handler = client_lb_access_read_prev,
+       },
+       {
+               .cmd = "lb_access_read_next",
+               .handler = client_lb_access_read_next,
+       },
+       {
+               .cmd = "lb_access_activate",
+               .handler = client_lb_access_activate,
+       },
+
+       {
+               .cmd = "lb_key_down",
+               .handler = client_lb_key_down,
+       },
+       {
+               .cmd = "lb_key_up",
+               .handler = client_lb_key_up,
+       },
+
+       {
+               .cmd = "pd_key_down",
+               .handler = client_pd_key_down,
+       },
+       {
+               .cmd = "pd_key_up",
+               .handler = client_pd_key_up,
+       },
+
        {
                .cmd = NULL,
                .handler = NULL,
index 252f953..771fe3d 100644 (file)
@@ -369,7 +369,6 @@ static inline void invoke_activate_cb(struct slave_node *slave)
 
 HAPI int slave_activate(struct slave_node *slave)
 {
-       bundle *param;
 
        /*!
         * \note
@@ -383,25 +382,32 @@ HAPI int slave_activate(struct slave_node *slave)
        if (slave->pid != (pid_t)-1)
                return -EALREADY;
 
-       param = bundle_create();
-       if (!param) {
-               ErrPrint("Failed to create a bundle\n");
-               return -EFAULT;
-       }
+       if (DEBUG_MODE) {
+               DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave->name, slave->secured, slave->abi);
+       } else {
+               bundle *param;
+               param = bundle_create();
+               if (!param) {
+                       ErrPrint("Failed to create a bundle\n");
+                       return -EFAULT;
+               }
 
-       bundle_add(param, BUNDLE_SLAVE_NAME, slave->name);
-       bundle_add(param, BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
-       bundle_add(param, BUNDLE_SLAVE_ABI, slave->abi);
-       DbgPrint("Launch the slave package: %s\n", slave->pkgname);
-       slave->pid = (pid_t)aul_launch_app(slave->pkgname, param);
-       bundle_free(param);
+               bundle_add(param, BUNDLE_SLAVE_NAME, slave->name);
+               bundle_add(param, BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
+               bundle_add(param, BUNDLE_SLAVE_ABI, slave->abi);
 
-       if (slave->pid < 0) {
-               ErrPrint("Failed to launch a new slave %s (%d)\n", slave->name, slave->pid);
-               slave->pid = (pid_t)-1;
-               return -EFAULT;
+               DbgPrint("Launch the slave package: %s\n", slave->pkgname);
+               slave->pid = (pid_t)aul_launch_app(slave->pkgname, param);
+
+               bundle_free(param);
+
+               if (slave->pid < 0) {
+                       ErrPrint("Failed to launch a new slave %s (%d)\n", slave->name, slave->pid);
+                       slave->pid = (pid_t)-1;
+                       return -EFAULT;
+               }
+               DbgPrint("Slave launched %d for %s\n", slave->pid, slave->name);
        }
-       DbgPrint("Slave launched %d for %s\n", slave->pid, slave->name);
 
        slave->state = SLAVE_REQUEST_TO_LAUNCH;
        /*!
index a587cd7..c3924c5 100644 (file)
@@ -119,8 +119,7 @@ static Eina_Bool create_cb(void *data, int type, void *event)
 
 static Eina_Bool destroy_cb(void *data, int type, void *event)
 {
-       Ecore_X_Event_Window_Destroy * info;
-       info = event;
+       // Ecore_X_Event_Window_Destroy *info = event;
        return ECORE_CALLBACK_PASS_ON;
 }
 
index ab3dcf8..41f82ad 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <termios.h>
 
 #include <glib.h>
 #include <glib-object.h>
 
 #include <Ecore.h>
 
+#define PROMPT "liveinfo) "
+
 static struct info {
        int fifo_handle;
        int fd;
        Ecore_Fd_Handler *fd_handler;
        Ecore_Fd_Handler *in_handler;
+       int input_fd;
 } s_info = {
        .fifo_handle = -EINVAL,
        .fd = -EINVAL,
        .fd_handler = NULL,
        .in_handler = NULL,
+       .input_fd = -1,
 };
 
 static void send_slave_list(void)
 {
        struct packet *packet;
 
-       printf("Send request SLAVE LIST\n");
        packet = packet_create_noack("slave_list", "d", 0.0f);
        if (!packet) {
                fprintf(stderr, "Failed to create a packet\n");
@@ -56,13 +60,16 @@ static void send_slave_list(void)
 
        com_core_packet_send_only(s_info.fd, packet);
        packet_destroy(packet);
+
+       printf("----------------------------------------------------------------------[Slave List]------------------------------------------------------------------------------\n");
+       printf("    pid          slave name                     package name                   abi     secured   refcnt   fault           state           inst   pkg     ttl    \n");
+       printf("----------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
 }
 
 static void send_pkg_list(void)
 {
        struct packet *packet;
 
-       printf("Send request PACKAGE LIST\n");
        packet = packet_create_noack("pkg_list", "d", 0.0f);
        if (!packet) {
                fprintf(stderr, "Failed to create a packet\n");
@@ -71,13 +78,30 @@ static void send_pkg_list(void)
 
        com_core_packet_send_only(s_info.fd, packet);
        packet_destroy(packet);
+
+       printf("+----------------------------------------------[Package List]------------------------------------------------+\n");
+       printf("    pid          slave name                     package name                   abi     refcnt   fault   inst  \n");
+       printf("+------------------------------------------------------------------------------------------------------------+\n");
+}
+
+static void send_toggle_debug(void)
+{
+       struct packet *packet;
+
+       packet = packet_create_noack("toggle_debug", "d", 0.0f);
+       if (!packet) {
+               fprintf(stderr, "Failed to create a packet\n");
+               return;
+       }
+
+       com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
 }
 
 static void send_slave_load(pid_t pid)
 {
        struct packet *packet;
 
-       printf("Send request Loaded package list\n");
        packet = packet_create_noack("slave_load", "i", pid);
        if (!packet) {
                fprintf(stderr, "Failed to create a packet\n");
@@ -92,7 +116,6 @@ static void send_inst_list(const char *pkgname)
 {
        struct packet *packet;
 
-       printf("Send request instance list\n");
        packet = packet_create_noack("inst_list", "s", pkgname);
        if (!packet) {
                fprintf(stderr, "Failed to create a packet\n");
@@ -101,6 +124,10 @@ static void send_inst_list(const char *pkgname)
 
        com_core_packet_send_only(s_info.fd, packet);
        packet_destroy(packet);
+
+       printf("-----------------------------------------------[Instance List]---------------------------------------\n");
+       printf("         ID         |      Cluster ID    |   Sub cluster ID   | Period | Visibility | Width | Height \n");
+       printf("-----------------------------------------------------------------------------------------------------\n");
 }
 
 static inline void help(void)
@@ -111,6 +138,7 @@ static inline void help(void)
        printf("\e[33mslave_list\e[0m - Display the slave list\n");
        printf("\e[33minst_list\e[0m \e[37mLIVEBOX_PKGNAME\e[0m - Display the instance list of this LIVEBOX_PKGNAME\n");
        printf("\e[33mslave_load\e[0m \e[37mSLAVE_PID\e[0m - Display the loaded livebox instance list on the given slave\n");
+       printf("\e[33mtoggle_debug\e[0m - Enable/Disable debug mode\n");
        printf("\e[32mexit - \e[0m\n");
        printf("\e[32mquit - \e[0m\n");
        printf("----------------------------------------------------------------------------\n");
@@ -119,30 +147,40 @@ static inline void help(void)
 static inline void do_command(const char *cmd)
 {
        char command[256];
-       char argument[256];
-
-       if (sscanf(cmd, "%255[^ ] %255s", command, argument) == 2) {
-               if (!strcasecmp(command, "inst_list")) {
-                       send_inst_list(argument);
-               } else if (!strcasecmp(command, "slave_load")) {
-                       pid_t pid;
-                       if (sscanf(argument, "%d", &pid) == 1)
-                               send_slave_load(pid);
-               } else {
-                       help();
-               }
+       char argument[256] = { '\0', };
+
+       if (sscanf(cmd, "%255[^ ] %255s", command, argument) == 2)
+               cmd = command;
+
+       if (!strcasecmp(cmd, "inst_list") && *argument) {
+               send_inst_list(argument);
+       } else if (!strcasecmp(cmd, "slave_load") && *argument) {
+               pid_t pid;
+
+               if (sscanf(argument, "%d", &pid) == 1)
+                       send_slave_load(pid);
+               else
+                       goto errout;
+       } else if (!strcasecmp(cmd, "pkg_list")) {
+               send_pkg_list();
+       } else if (!strcasecmp(cmd, "slave_list")) {
+               send_slave_list();
+       } else if (!strcasecmp(cmd, "exit") || !strcasecmp(cmd, "quit")) {
+               ecore_main_loop_quit();
+       } else if (!strcasecmp(cmd, "toggle_debug")) {
+               send_toggle_debug();
+       } else if (!strcasecmp(cmd, "help")) {
+               goto errout;
        } else {
-               if (!strcasecmp(cmd, "pkg_list"))
-                       send_pkg_list();
-               else if (!strcasecmp(cmd, "slave_list"))
-                       send_slave_list();
-               else if (!strcasecmp(cmd, "exit"))
-                       ecore_main_loop_quit();
-               else if (!strcasecmp(cmd, "quit"))
-                       ecore_main_loop_quit();
-               else if (!strcasecmp(cmd, "help"))
-                       help();
+               printf("Unknown command - \"help\"\n");
+               fputs(PROMPT, stdout);
        }
+
+       return;
+
+errout:
+       help();
+       fputs(PROMPT, stdout);
 }
 
 static Eina_Bool input_cb(void *data, Ecore_Fd_Handler *fd_handler)
@@ -171,19 +209,25 @@ static Eina_Bool input_cb(void *data, Ecore_Fd_Handler *fd_handler)
 
        switch (ch) {
        case 0x08: /* BKSP */
-               printf("\033[3D");
+               cmd_buffer[idx] = '\0';
                if (idx > 0)
                        idx--;
+               cmd_buffer[idx] = ' ';
+               printf("\r"PROMPT"%s", cmd_buffer); /* Cleare the last bytes */
+               cmd_buffer[idx] = '\0';
+               printf("\r"PROMPT"%s", cmd_buffer); /* Cleare the last bytes */
                break;
        case '\n':
        case '\r':
                cmd_buffer[idx] = '\0';
                idx = 0;
-               printf("\n");
+               putc((int)'\n', stdout);
                do_command(cmd_buffer);
+               memset(cmd_buffer, 0, sizeof(cmd_buffer));
                break;
        default:
                cmd_buffer[idx++] = ch;
+               putc((int)ch, stdout);
                if (idx == sizeof(cmd_buffer) - 1) {
                        cmd_buffer[idx] = '\0';
                        printf("\nCommand buffer is overflow: %s\n", cmd_buffer);
@@ -198,8 +242,8 @@ static Eina_Bool input_cb(void *data, Ecore_Fd_Handler *fd_handler)
 static Eina_Bool read_cb(void *data, Ecore_Fd_Handler *fd_handler)
 {
        int fd;
-       char buffer[1024];
-       int len;
+       static const char *eod = "EOD\n";
+       char ch;
 
        fd = ecore_main_fd_handler_fd_get(fd_handler);
        if (fd < 0) {
@@ -207,12 +251,18 @@ static Eina_Bool read_cb(void *data, Ecore_Fd_Handler *fd_handler)
                return ECORE_CALLBACK_RENEW;
        }
 
-       while ((len = read(fd, buffer, sizeof(buffer) - 1)) > 0) {
-               buffer[len] = '\0';
-               fputs(buffer, stdout);
-       }
+       read(fd, &ch, sizeof(ch));
+       if (ch == *eod)
+               eod++;
+       else
+               eod = "EOD\n";
+
+       putc(ch, stdout);
 
-       fflush(stdout);
+       if (*eod == '\0') {
+               fputs(PROMPT, stdout);
+               eod = "EOD\n";
+       }
 
        return ECORE_CALLBACK_RENEW;
 }
@@ -251,6 +301,10 @@ static int ret_cb(pid_t pid, int handle, const struct packet *packet, void *data
                return -EFAULT;
        }
 
+       fputs(PROMPT, stdout);
+        if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) < 0)
+                fprintf(stderr, "Error: %s\n", strerror(errno));
+
        s_info.in_handler = ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, input_cb, NULL, NULL, NULL);
        if (!s_info.in_handler) {
                fprintf(stderr, "Failed to add a input handler\n");
@@ -298,6 +352,7 @@ static int connected_cb(int handle, void *data)
 
 int main(int argc, char *argv[])
 {
+       struct termios ttystate;
        static struct method s_table[] = {
                {
                        .cmd = NULL,
@@ -319,8 +374,25 @@ int main(int argc, char *argv[])
 
        printf("Type your command on below empty line\n");
 
+       if (tcgetattr(STDIN_FILENO, &ttystate) < 0) {
+               fprintf(stderr, "Error: %s\n", strerror(errno));
+       } else {
+               ttystate.c_lflag &= ~(ICANON | ECHO);
+               ttystate.c_cc[VMIN] = 1;
+
+               if (tcsetattr(STDIN_FILENO, TCSANOW, &ttystate) < 0)
+                       fprintf(stderr, "Error: %s\n", strerror(errno));
+       }
+
+       if (setvbuf(stdout, (char *)NULL, _IONBF, 0) != 0)
+               fprintf(stderr, "Error: %s\n", strerror(errno));
+
        ecore_main_loop_begin();
 
+       ttystate.c_lflag |= ICANON | ECHO;
+       if (tcsetattr(STDIN_FILENO, TCSANOW, &ttystate) < 0)
+               fprintf(stderr, "Error: %s\n", strerror(errno));
+
        if (s_info.fd > 0) {
                com_core_packet_client_fini(s_info.fd);
                s_info.fd = -EINVAL;