Abolished the touch panel (include the calibration) support. 27/10127/1 accepted/tizen/20130919.180910 accepted/tizen/20130919.204300 submit/tizen/20130919.121020
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 19 Sep 2013 10:47:49 +0000 (19:47 +0900)
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 19 Sep 2013 10:53:53 +0000 (19:53 +0900)
Change-Id: I387bf1ceb2bfce5b2c5ff47c93559f0f9b91c1bd
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
32 files changed:
Makefile.am
configure.ac
egalax_calibration.conf [deleted file]
gtforce/Makefile.am [moved from joystick_gtforce/Makefile.am with 56% similarity]
gtforce/ico_dic-gtforce.c [moved from joystick_gtforce/ico_ictl-joystick.c with 50% similarity]
gtforce/ico_dic-gtforce.h [new file with mode: 0644]
gtforce/ico_dic-wayland.c [new file with mode: 0644]
joystick_gtforce.conf [deleted file]
joystick_gtforce/dbg_curtime.c [deleted file]
joystick_gtforce/ico_ictl-local.h [deleted file]
joystick_gtforce/ico_ictl-wayland.c [deleted file]
packaging/ico-uxf-device-input-controller.changes
packaging/ico-uxf-device-input-controller.spec
settings/drivingforcegt.conf [new file with mode: 0644]
settings/g27racingwheel.conf [new file with mode: 0644]
settings/ico-device-input-controller.service [new file with mode: 0644]
settings/ico-dic-wait-weston-ready.path [new file with mode: 0644]
settings/set_daynight.sh [new file with mode: 0755]
settings/set_navi_busguide.sh [new file with mode: 0755]
settings/set_navi_destination.sh [new file with mode: 0755]
tests/input-controller-test
tests/test-client.c
tests/test-common.c
tests/test-common.h
tests/test-homescreen.c
tests/test-send_event.c
tests/weston.ini [deleted file]
tests/weston_ivi_plugin.ini [deleted file]
touch_egalax/Makefile.am [deleted file]
touch_egalax/ico_ictl-egalax_calibration.c [deleted file]
touch_egalax/ico_ictl-touch_egalax.c [deleted file]
touch_egalax/ico_ictl-touch_egalax.h [deleted file]

index a5ec0c8..47ed706 100644 (file)
@@ -1,6 +1,6 @@
-SUBDIRS = joystick_gtforce touch_egalax tests
+SUBDIRS = gtforce tests
 
-DIST_SUBDIRS = joystick_gtforce touch_egalax tests
+DIST_SUBDIRS = gtforce tests
 
 DISTCHECK_CONFIGURE_FLAGS = --disable-setuid-install
 
index 445afaa..8416598 100644 (file)
@@ -1,6 +1,6 @@
 AC_PREREQ([2.68])
 AC_INIT([ico-uxf-device-input-controller],
-        [0.4.91],
+        [0.9.01],
         [https://BUG-REPORT-ADDRESS])
 
 AC_CONFIG_HEADERS([config.h])
@@ -55,7 +55,6 @@ AC_SUBST(GCC_CXXFLAGS)
 WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol'])
 
 AC_CONFIG_FILES([Makefile
-                joystick_gtforce/Makefile
-                touch_egalax/Makefile
+                gtforce/Makefile
                 tests/Makefile])
 AC_OUTPUT
diff --git a/egalax_calibration.conf b/egalax_calibration.conf
deleted file mode 100644 (file)
index 93c1952..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-DWIDTH=1920
-DHEIGHT=1080
-POSITION1=1958*114
-POSITION2=77*125
-POSITION3=1924*1879
-POSITION4=99*1852
similarity index 56%
rename from joystick_gtforce/Makefile.am
rename to gtforce/Makefile.am
index 3256caf..d4ab70e 100644 (file)
@@ -4,20 +4,19 @@ wayland_client_lib = -lwayland-client
 wayland_ivi_client_lib = -lico-uxf-weston-plugin
 wayland_ivi_client_inc = -I/usr/include/ico-uxf-weston-plugin
 
-AM_CFLAGS = $(GCC_CFLAGS)
+AM_CFLAGS = $(GCC_CFLAGS) -I/usr/include/ico-util
 AM_CPPFLAGS = -I$(top_srcdir)/src $(wayland_ivi_client_inc) $(GLIB_CFLAGS) $(COMPOSITOR_CFLAGS)
 
 bin_PROGRAMS =         \
-       ico_ictl-joystick_gtforce
+       ico_dic-gtforce
 
 check_LTLIBRARIES = $(TESTS)
-check_PROGRAMS = ico_ictl-joystick
+check_PROGRAMS = ico_dic-gtforce
 
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS)
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS) -lico-util
 
-ico_ictl_joystick_gtforce_SOURCES = \
-       ico_ictl-joystick.c             \
-       ico_ictl-wayland.c              \
-       dbg_curtime.c
-ico_ictl_joystick_gtforce_LDADD = $(SIMPLE_CLIENT_LIBS) $(wayland_ivi_client_lib) $(wayland_client_lib)
+ico_dic_gtforce_SOURCES = \
+       ico_dic-gtforce.c               \
+       ico_dic-wayland.c
+ico_dic_gtforce_LDADD = $(SIMPLE_CLIENT_LIBS) $(wayland_ivi_client_lib) $(wayland_client_lib)
 
similarity index 50%
rename from joystick_gtforce/ico_ictl-joystick.c
rename to gtforce/ico_dic-gtforce.c
index 3e10160..89c72f9 100644 (file)
@@ -8,9 +8,9 @@
  */
 /**
  * @brief   Device Input Controller(GtForce joystick)
- * @brief   joystick input event to Input Manager
+ * @brief   GtForce input event to Input Manager
  *
- * @date    Feb-08-2013
+ * @date    Sep-08-2013
  */
 
 #include    <stdio.h>
 #include    <linux/joystick.h>
 #include    <glib.h>
 
-#include    "ico_ictl-local.h"
+#include    "ico_dic-gtforce.h"
 
 /* type definition                                                                  */
-typedef struct  _Ico_ICtl_JS    {
+typedef struct  _Ico_Dic_JS    {
     int                     fd;                 /* device file fd                   */
     char                    device[32];         /* device name                      */
-    char                    ictl[32];           /* input controller name            */
+    char                    dic_name[32];       /* input controller name            */
     int                     type;               /* device type                      */
     int                     hostid;             /* host Id(currently unused)        */
-}   Ico_ICtl_JS;
+}   Ico_Dic_JS;
 
-typedef struct  _Ico_Ictl_Code  {
+typedef struct  _Ico_Dic_Code  {
     unsigned short          code;               /* code value                       */
     char                    name[20];           /* code name                        */
-}   Ico_Ictl_Code;
+    char                    appid[ICO_DIC_MAX_APPID_LEN];
+                                                /* application id or script path    */
+    short                   keycode;            /* keycode or -1 for script         */
+}   Ico_Dic_Code;
 
-typedef struct  _Ico_ICtl_JS_Input  {
+typedef struct  _Ico_Dic_JS_Input  {
     char                    name[20];           /* input switch name                */
     int                     input;              /* input number                     */
     int                     type;               /* input event type                 */
     int                     number;             /* input event number               */
-    Ico_Ictl_Code           code[20];           /* key code                         */
+    Ico_Dic_Code            code[ICO_DIC_MAX_CODES];
+                                                /* key code                         */
     int                     last;               /* last input code                  */
-}   Ico_ICtl_JS_Input;
+}   Ico_Dic_JS_Input;
 
 /* prototype of static function                                                     */
 static void PrintUsage(const char *pName);
@@ -59,31 +63,31 @@ struct timeval      lastEvent = { 0, 0 };       /* last input event time
 int                 gRunning = 1;               /* run state(1:run, 0:finish)       */
 
 /* Input Contorller Table           */
-Ico_ICtl_Mng        gIco_ICtrl_Mng = { 0 };
-Ico_ICtl_JS         gIco_ICtrl_JS = { 0 };
-int                 nIco_ICtrl_JS_Input = 0;
-Ico_ICtl_JS_Input   *gIco_ICtrl_JS_Input = NULL;
+Ico_Dic_Mng         gIco_Dic_Mng = { 0 };
+Ico_Dic_JS          gIco_Dic_JS = { 0 };
+int                 nIco_Dic_JS_Input = 0;
+Ico_Dic_JS_Input    *gIco_Dic_JS_Input = NULL;
 
 /* static functions                 */
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_ictl_find_input_by_name: find Input Table by input switch name
+ * @brief   ico_dic_find_input_by_name: find Input Table by input switch name
  *
  * @param[in]   name        input switch name
- * @return  result
- * @retval  !=NULL      success(Input Table address)
- * @retval  ==NULL      failed
+ * @return      result
+ * @retval      !=NULL      success(Input Table address)
+ * @retval      ==NULL      failed
  */
 /*--------------------------------------------------------------------------*/
-static Ico_ICtl_JS_Input *
-ico_ictl_find_input_by_name(const char *name)
+static Ico_Dic_JS_Input *
+ico_dic_find_input_by_name(const char *name)
 {
-    Ico_ICtl_JS_Input   *iMng = NULL;
+    Ico_Dic_JS_Input   *iMng = NULL;
     int                  ii;
 
-    for (ii = 0; ii < nIco_ICtrl_JS_Input; ii++)    {
-        if (strncasecmp(name, gIco_ICtrl_JS_Input[ii].name, 16) == 0) {
-            iMng = &gIco_ICtrl_JS_Input[ii];
+    for (ii = 0; ii < nIco_Dic_JS_Input; ii++)    {
+        if (strncasecmp(name, gIco_Dic_JS_Input[ii].name, 16) == 0) {
+            iMng = &gIco_Dic_JS_Input[ii];
             break;
         }
     }
@@ -92,25 +96,25 @@ ico_ictl_find_input_by_name(const char *name)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_ictl_find_input_by_param: find Input Table by input switch type and number
+ * @brief   ico_dic_find_input_by_param: find Input Table by input switch type and number
  *
  * @param[in]   type        input event type (of Linux Input subsystem)
  * @param[in]   number      input event number (of Linux Input subsystem)
- * @return  result
- * @retval  !=NULL      success(Input Table address)
- * @retval  ==NULL      failed
+ * @return      result
+ * @retval      !=NULL      success(Input Table address)
+ * @retval      ==NULL      failed
  */
 /*--------------------------------------------------------------------------*/
-static Ico_ICtl_JS_Input *
-ico_ictl_find_input_by_param(int type, int number)
+static Ico_Dic_JS_Input *
+ico_dic_find_input_by_param(int type, int number)
 {
-    Ico_ICtl_JS_Input   *iMng = NULL;
+    Ico_Dic_JS_Input   *iMng = NULL;
     int                  ii;
 
-    for (ii = 0; ii < nIco_ICtrl_JS_Input; ii++)    {
-        if ((gIco_ICtrl_JS_Input[ii].type == type)
-            && (gIco_ICtrl_JS_Input[ii].number == number))  {
-            iMng = &gIco_ICtrl_JS_Input[ii];
+    for (ii = 0; ii < nIco_Dic_JS_Input; ii++)    {
+        if ((gIco_Dic_JS_Input[ii].type == type)
+            && (gIco_Dic_JS_Input[ii].number == number))  {
+            iMng = &gIco_Dic_JS_Input[ii];
             break;
         }
     }
@@ -122,9 +126,9 @@ ico_ictl_find_input_by_param(int type, int number)
  * @brief   conf_getUint: convert integer string to value
  *
  * @param[in]   str         integer string
- * @return  result
- * @retval  >=0         success(converted vaule)
- * @retval  -1          failed
+ * @return      result
+ * @retval      >=0         success(converted vaule)
+ * @retval      -1          failed
  */
 /*--------------------------------------------------------------------------*/
 static int
@@ -149,9 +153,9 @@ conf_getUint(const char *str)
  *
  * @param[in]   keyfile     configuration file
  * @param[in]   group       configuration key group name
- * @return  result
- * @retval  !=NULL          success(configuration list)
- * @retval  ==NULL          failed
+ * @return      result
+ * @retval      !=NULL          success(configuration list)
+ * @retval      ==NULL          failed
  */
 /*--------------------------------------------------------------------------*/
 static GList *
@@ -180,7 +184,7 @@ conf_countNumericalKey(GKeyFile *keyfile, const char *group)
  *
  * @param[in]   str1        string 1
  * @param[in]   str2        string 2
- * @return  connected string
+ * @return      connected string
  */
 /*--------------------------------------------------------------------------*/
 static char *
@@ -193,28 +197,28 @@ conf_appendStr(const char *str1, const char *str2)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_ictl_read_conf: read configuration file
+ * @brief   ico_dic_read_conf: read configuration file
  *
- * @param[in]   file        configuration file path name
- * @return  result
- * @retval  ICO_ICTL_OK     sccess
- * @retval  ICO_ICTL_ERR    failed
+ * @param[in]   file            configuration file path name
+ * @return      result
+ * @retval      ICO_DIC_OK      sccess
+ * @retval      ICO_DIC_ERR     failed
  */
 /*--------------------------------------------------------------------------*/
 static int
-ico_ictl_read_conf(const char *file)
+ico_dic_read_conf(const char *file)
 {
-    DEBUG_PRINT("ico_ictl_read_conf: Enter(file=%s)", file);
+    ICO_TRA("ico_dic_read_conf: Enter(file=%s)", file);
 
     GKeyFile            *keyfile;
     GKeyFileFlags       flags;
     GString             *filepath;
     GList               *idlist;
     GError              *error = NULL;
-    Ico_ICtl_JS_Input   *iMng;
+    Ico_Dic_JS_Input   *iMng;
     char                *name;
     gsize               length;
-    int                 ii, jj;
+    int                 ii, jj, kk, ll;
 
     keyfile = g_key_file_new();
     flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
@@ -222,24 +226,24 @@ ico_ictl_read_conf(const char *file)
     filepath = g_string_new(file);
 
     if (! g_key_file_load_from_file(keyfile, filepath->str, flags, &error)) {
-        ERROR_PRINT("ico_ictl_read_conf: Leave(can not open conf file)");
+        ICO_ERR("ico_dic_read_conf: Leave(can not open conf file)");
         g_string_free(filepath, TRUE);
-        return ICO_ICTL_ERR;
+        return ICO_DIC_ERR;
     }
     g_string_free(filepath, TRUE);
 
     /* count number of key in [device] section   */
-    memset((char *)&gIco_ICtrl_JS, 0, sizeof(gIco_ICtrl_JS));
+    memset((char *)&gIco_Dic_JS, 0, sizeof(gIco_Dic_JS));
     name = g_key_file_get_string(keyfile, "device", "name", &error);
     if (name)   {
-        strncpy(gIco_ICtrl_JS.device, name, sizeof(gIco_ICtrl_JS.device)-1);
+        strncpy(gIco_Dic_JS.device, name, sizeof(gIco_Dic_JS.device)-1);
     }
-    name = g_key_file_get_string(keyfile, "device", "ictl", &error);
+    name = g_key_file_get_string(keyfile, "device", "dic", &error);
     if (name)   {
-        strncpy(gIco_ICtrl_JS.ictl, name, sizeof(gIco_ICtrl_JS.ictl)-1);
+        strncpy(gIco_Dic_JS.dic_name, name, sizeof(gIco_Dic_JS.dic_name)-1);
     }
-    gIco_ICtrl_JS.type = g_key_file_get_integer(keyfile, "device", "type", &error);
-    gIco_ICtrl_JS.hostid = g_key_file_get_integer(keyfile, "device", "ecu", &error);
+    gIco_Dic_JS.type = g_key_file_get_integer(keyfile, "device", "type", &error);
+    gIco_Dic_JS.hostid = g_key_file_get_integer(keyfile, "device", "ecu", &error);
 
     /* count number of key in [input] section   */
     idlist = conf_countNumericalKey(keyfile, "input");
@@ -247,31 +251,34 @@ ico_ictl_read_conf(const char *file)
     if (length <= 0)    {
         length = 1;
     }
-    nIco_ICtrl_JS_Input = 0;
-    gIco_ICtrl_JS_Input = (Ico_ICtl_JS_Input *)malloc(sizeof(Ico_ICtl_JS_Input) * length);
-    if (! gIco_ICtrl_JS_Input)  {
-        ERROR_PRINT("joystick_gtforce: No Memory");
+    nIco_Dic_JS_Input = 0;
+    gIco_Dic_JS_Input = (Ico_Dic_JS_Input *)malloc(sizeof(Ico_Dic_JS_Input) * length);
+    if (! gIco_Dic_JS_Input)  {
+        ICO_ERR("joystick_gtforce: No Memory");
         exit(1);
     }
-    memset((char *)gIco_ICtrl_JS_Input, 0, sizeof(Ico_ICtl_JS_Input) * length);
+    memset((char *)gIco_Dic_JS_Input, 0, sizeof(Ico_Dic_JS_Input) * length);
 
     for (ii = 0; ii < (int)length; ii++) {
         const char  *g = "input";
         char        *key = (char *)g_list_nth_data(idlist, ii);
         gsize       listsize;
+        gsize       listsize2;
         gint        *attr;
         gchar       **code;
+        char        *p;
+        int         codeval;
 
         name = g_key_file_get_string(keyfile, g, key, &error);
         if (name == NULL)   continue;
 
-        iMng = ico_ictl_find_input_by_name(name);
+        iMng = ico_dic_find_input_by_name(name);
         if (iMng != NULL)   {
             /* multiple define  */
-            ERROR_PRINT("ico_ictl_read_conf: switch name(%s) re-define", name);
+            ICO_ERR("ico_dic_read_conf: switch name(%s) re-define", name);
             continue;
         }
-        iMng = &gIco_ICtrl_JS_Input[nIco_ICtrl_JS_Input];
+        iMng = &gIco_Dic_JS_Input[nIco_Dic_JS_Input];
 
         iMng->input = conf_getUint(key);
         strncpy(iMng->name, name, sizeof(iMng->name)-1);
@@ -279,20 +286,20 @@ ico_ictl_read_conf(const char *file)
         /* event            */
         attr = g_key_file_get_integer_list(keyfile, g, conf_appendStr(key, ".event"),
                                            &listsize, &error);
-        if (listsize < 2)   continue;
+        if ((int)listsize < 2)   continue;
         iMng->type = attr[0];
         iMng->number = attr[1];
 
         /* code             */
         code = g_key_file_get_string_list(keyfile, g, conf_appendStr(key, ".code"),
                                           &listsize, &error);
-        if ((code == NULL) || (listsize <= 0))  {
+        if ((code == NULL) || ((int)listsize <= 0))  {
             strcpy(iMng->code[0].name, iMng->name);
         }
         else    {
-            if ((int)listsize > 20) listsize = 20;
+            if ((int)listsize > ICO_DIC_MAX_CODES) listsize = ICO_DIC_MAX_CODES;
             for (jj = 0; jj < (int)listsize; jj++) {
-                char    *p = (char *)code[jj];
+                p = (char *)code[jj];
                 while ((*p != 0) && (*p != ':'))    {
                     iMng->code[jj].code = iMng->code[jj].code * 10 + *p - '0';
                     p ++;
@@ -308,50 +315,133 @@ ico_ictl_read_conf(const char *file)
         }
         if (code)   g_strfreev(code);
 
-        nIco_ICtrl_JS_Input ++;
+        /* fixed            */
+        code = g_key_file_get_string_list(keyfile, g, conf_appendStr(key, ".fixed"),
+                                          &listsize2, &error);
+        error = NULL;
+        if ((code != NULL) && ((int)listsize2 > 0))  {
+            for (jj = 0; jj < (int)listsize2; jj++) {
+                p = (char *)code[jj];
+                codeval = -1;
+                while ((*p >= '0') && (*p <= '9'))  {
+                    if (codeval < 0)    codeval = 0;
+                    codeval = codeval * 10 + *p - '0';
+                    p ++;
+                }
+                if ((codeval >= 0) && (*p == ':'))  {
+                    p++;
+                    for (kk = 0; kk < (int)listsize; kk++)   {
+                        if (iMng->code[kk].code == codeval) break;
+                    }
+                    memset(iMng->code[kk].appid, 0, ICO_DIC_MAX_APPID_LEN);
+                    if (strncasecmp(p, "shell=", 6) == 0)   {
+                        iMng->code[kk].keycode = -1;
+                        strncpy(iMng->code[kk].appid, p + 6, ICO_DIC_MAX_APPID_LEN-1);
+                    }
+                    else    {
+                        if (strncasecmp(p, "appid=", 6) == 0)   {
+                            p += 6;
+                        }
+                        for (ll = 0; ll < (ICO_DIC_MAX_APPID_LEN-1); ll++)  {
+                            if ((*p == 0) || (*p == ':'))   break;
+                            iMng->code[kk].appid[ll] = *p;
+                            p++;
+                        }
+                        if (*p) {
+                            p ++;
+                            if (strncasecmp(p, "key=", 4) == 0) p += 4;
+                            iMng->code[kk].keycode = strtol(p, (char **)0, 0);
+                        }
+                    }
+                }
+                else    {
+                    for (kk = 0; kk < (int)listsize; kk++)   {
+                        if (kk == 0)    {
+                            memset(iMng->code[0].appid, 0, ICO_DIC_MAX_APPID_LEN);
+                            if (strncasecmp(p, "shell=", 6) == 0)   {
+                                iMng->code[0].keycode = -1;
+                                strncpy(iMng->code[0].appid, p + 6, ICO_DIC_MAX_APPID_LEN-1);
+                            }
+                            else    {
+                                if (strncasecmp(p, "appid=", 6) == 0)   {
+                                    p += 6;
+                                }
+                                for (ll = 0; ll < (ICO_DIC_MAX_APPID_LEN-1); ll++)  {
+                                    if ((*p == 0) || (*p == ':'))   break;
+                                    iMng->code[0].appid[ll] = *p;
+                                    p++;
+                                }
+                                if (*p) {
+                                    p ++;
+                                    if (strncasecmp(p, "key=", 4) == 0) p += 4;
+                                    iMng->code[0].keycode = strtol(p, (char **)0, 0);
+                                }
+                            }
+                        }
+                        else    {
+                            memcpy(iMng->code[kk].appid,
+                                   iMng->code[0].appid, ICO_DIC_MAX_APPID_LEN);
+                            iMng->code[kk].keycode = iMng->code[0].keycode;
+                        }
+                    }
+                }
+            }
+        }
+        if (code)   g_strfreev(code);
+
+        nIco_Dic_JS_Input ++;
 
-        DEBUG_PRINT("%s input:%d(type=%d,number=%d,code=%d[%s],%d[%s])",
+        if (iMng->code[1].code == 0)    {
+            ICO_DBG("%s input:%d type=%d,number=%d,code=%d[%s,%s,%d]",
                     iMng->name, iMng->input, iMng->type, iMng->number,
                     iMng->code[0].code, iMng->code[0].name,
-                    iMng->code[1].code, iMng->code[1].name);
+                    iMng->code[0].appid, iMng->code[0].keycode);
+        }
+        else    {
+            ICO_DBG("%s input:%d type=%d,number=%d,code=%d[%s,%s,%d],code=%d[%s,%s,%d]",
+                    iMng->name, iMng->input, iMng->type, iMng->number,
+                    iMng->code[0].code, iMng->code[0].name,
+                    iMng->code[0].appid, iMng->code[0].keycode,
+                    iMng->code[1].code, iMng->code[1].name,
+                    iMng->code[1].appid, iMng->code[1].keycode);
+        }
     }
-    DEBUG_PRINT("ico_ictl_read_conf: Leave");
+    ICO_TRA("ico_dic_read_conf: Leave");
 
-    return ICO_ICTL_OK;
+    return ICO_DIC_OK;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_ictl_js_open: open input jyostick input device
+ * @brief   ico_dic_js_open: open input jyostick input device
  *
- * @param[in]   ictlDevName     device name
- * @return  result
- * @retval  >= 0            sccess(device file descriptor)
- * @retval  ICO_ICTL_ERR    failed
+ * @param[in]       dicDevName      device name
+ * @param[in/out]   confpath        configuration file path
+ * @return      result
+ * @retval      >= 0            sccess(device file descriptor)
+ * @retval      ICO_DIC_ERR     failed
  */
 /*--------------------------------------------------------------------------*/
 static int
-ico_ictl_js_open(const char *ictlDevName)
+ico_dic_js_open(const char *dicDevName, char **confpath)
 {
-    DEBUG_PRINT("ico_ictl_js_open: Enter(device=%s)", ictlDevName)
-
     int                 fd = -1;
+    int                 conf_fd;
+    static char         fixconfpath[128];
     char                devFile[64];
     char                devName[64];
     int                 ii, jj, kk;
 
-    if (ictlDevName == NULL) {
-        ERROR_PRINT("ico_ictl_js_open: Leave(failed devname NULL)");
-        return ICO_ICTL_ERR;
-    }
+    ICO_TRA("ico_dic_js_open: Enter(device=%s, conf=%s)", dicDevName,
+            *confpath ? *confpath : "(null)");
 
-    char *pdev = getenv(ICO_ICTL_INPUT_DEV);
+    char *pdev = getenv(ICO_DIC_INPUT_DEV);
     if ((pdev != NULL) && (*pdev != 0)) {
-        DEBUG_PRINT("ico_ictl_js_open: Pseudo input device(%s)", pdev);
+        ICO_DBG("ico_dic_js_open: Pseudo input device(%s)", pdev);
         mPseudo = 1;
     }
     else    {
-        pdev = (char *)ictlDevName;
+        pdev = (char *)dicDevName;
     }
     for (ii = 0; ii < 16; ii++) {
         if (mPseudo)    {
@@ -373,44 +463,70 @@ ico_ictl_js_open(const char *ictlDevName)
         kk = 0;
         for (jj = 0; devName[jj]; jj++) {
             if (devName[jj] != ' ') {
-                devName[kk++] = devName[jj];
+                if ((devName[jj] >= 'A') && (devName[jj] <= 'Z'))   {
+                    devName[kk++] = devName[jj] - 'A' + 'a';
+                }
+                else    {
+                    devName[kk++] = devName[jj];
+                }
             }
         }
         devName[kk] = 0;
-        DEBUG_PRINT("ico_ictl_js_open: %d.%s", ii+1, devName);
+        ICO_DBG("ico_dic_js_open: %d.%s", ii+1, devName);
 
-        if (strncasecmp(devName, pdev, sizeof(devName)) == 0)   break;
+        if (pdev)   {
+            /* fixed (or debug) device      */
+            if (strcasecmp(pdev, devName) == 0) {
+                if (*confpath == NULL)  {
+                    snprintf(fixconfpath, sizeof(fixconfpath), ICO_DIC_CONF_FILE, devName);
+                }
+                break;
+            }
+        }
+        else    {
+            /* search configuration file    */
+            if (*confpath == NULL)  {
+                snprintf(fixconfpath, sizeof(fixconfpath), ICO_DIC_CONF_FILE, devName);
+                conf_fd = open(fixconfpath, O_RDONLY);
+                if (conf_fd < 0)    continue;
+                close(conf_fd);
+            }
+            break;
+        }
         /* not match, close */
         close(fd);
         fd = -1;
     }
 
     if (fd < 0) {
-        ERROR_PRINT("ico_ictl_js_open: Leave(not find device file)");
-        return ICO_ICTL_ERR;
+        ICO_ERR("ico_dic_js_open: Leave(not find device file)");
+        return ICO_DIC_ERR;
+    }
+    ICO_TRA("ico_dic_js_open: Leave(found %s)", fixconfpath);
+
+    if (*confpath == NULL)  {
+        *confpath = &fixconfpath[0];
     }
-    DEBUG_PRINT("ico_ictl_js_open: Leave(found %s[%s] as %s)", pdev, devFile, ictlDevName);
     return fd;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_ictl_js_read: read input jyostick input device
+ * @brief   ico_dic_js_read: read jyostick input device
  *
  * @param[in]   fd          file descriptor
  * @return      nothing
  */
 /*--------------------------------------------------------------------------*/
 static void
-ico_ictl_js_read(int fd)
+ico_dic_js_read(int fd)
 {
-    DEBUG_PRINT("ico_ictl_js_read: Enter(fd=%d)", fd)
-
     struct js_event     events[8];
     struct input_event  pevents[8];
     int                 rSize;
     int                 ii, jj;
     int                 number, value, type, code, state;
+    int                 icode;
 
     if (mPseudo)    {
         /* Pseudo event input for Debug */
@@ -428,8 +544,8 @@ ico_ictl_js_read(int fd)
                 else if ((events[ii].type == 1) && (events[ii].number == 9))    {
                     events[ii].number = 0;
                 }
-                DEBUG_PRINT("ico_ictl_js_read: pseude event.%d %d.%d.%d",
-                            ii, events[ii].type, events[ii].number, events[ii].value);
+                ICO_DBG("ico_dic_js_read: pseude event.%d %d.%d.%d",
+                        ii, events[ii].type, events[ii].number, events[ii].value);
             }
             rSize = ii * sizeof(struct js_event);
         }
@@ -442,22 +558,25 @@ ico_ictl_js_read(int fd)
         if ((ii == EINTR) || (ii == EAGAIN))    {
             return;
         }
-        DEBUG_PRINT("ico_ictl_js_read: Leave(read error[%d])", ii)
+        ICO_ERR("ico_dic_js_read: read error[%d]", ii)
         exit(9);
     }
     for (ii = 0; ii < (rSize / (int)sizeof(struct js_event)); ii++) {
-        Ico_ICtl_JS_Input   *iMng = NULL;
+        Ico_Dic_JS_Input   *iMng = NULL;
 
         type = events[ii].type;
         number = events[ii].number;
         value = events[ii].value;
-        DEBUG_PRINT("ico_ictl_js_read: Read(type=%d, number=%d, value=%d",
-                    type, number, value);
-
-        iMng = ico_ictl_find_input_by_param(type, number);
+        iMng = ico_dic_find_input_by_param(type, number);
         if (iMng == NULL) {
+            if (mDebug >= 2)    {
+                ICO_DBG("ico_dic_js_read: Not Assigned(type=%d, number=%d, value=%d)",
+                        type, number, value);
+            }
             continue;
         }
+        ICO_DBG("ico_dic_js_read: Read(type=%d, number=%d, value=%d)",
+                type, number, value);
 
         if (mEventLog)  {
             struct timeval  curtime;
@@ -488,14 +607,15 @@ ico_ictl_js_read(int fd)
                 lastEvent.tv_usec = curtime.tv_usec;
             }
             for (jj = 0;
-                 jj < (int)(sizeof(gIco_ICtrl_JS_Input)/sizeof(Ico_ICtl_JS_Input)); jj++) {
-                if ((type == gIco_ICtrl_JS_Input[jj].type) &&
-                    (number == gIco_ICtrl_JS_Input[jj].number))  {
+                 jj < (int)(sizeof(gIco_Dic_JS_Input)/sizeof(Ico_Dic_JS_Input)); jj++) {
+                if ((type == gIco_Dic_JS_Input[jj].type) &&
+                    (number == gIco_Dic_JS_Input[jj].number))  {
                     break;
                 }
             }
         }
 
+        icode = 0;
         if (iMng->code[1].code != 0)    {
             if (value < 0) {
                 code = iMng->code[0].code;
@@ -503,6 +623,7 @@ ico_ictl_js_read(int fd)
                 iMng->last = code;
             }
             else if (value > 0) {
+                icode = 1;
                 code = iMng->code[1].code;
                 state = WL_KEYBOARD_KEY_STATE_PRESSED;
                 iMng->last = code;
@@ -512,6 +633,9 @@ ico_ictl_js_read(int fd)
                     continue;
                 }
                 code = iMng->last;
+                if (code == iMng->code[1].code) {
+                    icode = 1;
+                }
                 state = WL_KEYBOARD_KEY_STATE_RELEASED;
                 iMng->last = -1;
             }
@@ -529,8 +653,38 @@ ico_ictl_js_read(int fd)
                 continue;
             }
         }
-        ico_input_mgr_device_input_event(gIco_ICtrl_Mng.Wayland_InputMgr, events[ii].time,
-                                         gIco_ICtrl_JS.device, iMng->input, code, state);
+        if (iMng->code[icode].appid[0]) {
+            /* fixed event                      */
+            if (iMng->code[icode].keycode < 0)  {
+                /* start program if pressed */
+                if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+                    ICO_DBG("ico_dic_js_read: start script(%s)", iMng->code[icode].appid);
+                    if (system(iMng->code[icode].appid) == -1)  {
+                        ICO_WRN("ico_dic_js_read: script(%s) Error",
+                                iMng->code[icode].appid);
+                    }
+                }
+            }
+            else    {
+                /* send keyboard event to application               */
+                if (state == WL_KEYBOARD_KEY_STATE_PRESSED) state = 1;
+                else                                        state = 0;
+
+                ICO_DBG("ico_dic_js_read: send event to %s(%d.%d)",
+                        iMng->code[icode].appid, iMng->code[icode].keycode, state);
+                ico_input_mgr_control_send_input_event(gIco_Dic_Mng.Wayland_InputCtl,
+                                                       iMng->code[icode].appid, 0,
+                                                       ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD,
+                                                       0, iMng->code[icode].keycode, state);
+            }
+        }
+        else    {
+            /* general switch event, send to multi input manager    */
+            ICO_DBG("ico_dic_js_read: send general input event(%s.%d.%d.%d)",
+                    gIco_Dic_JS.device, iMng->input, code, state);
+            ico_input_mgr_device_input_event(gIco_Dic_Mng.Wayland_InputMgr, events[ii].time,
+                                             gIco_Dic_JS.device, iMng->input, code, state);
+        }
     }
 }
 
@@ -550,19 +704,20 @@ signal_int(int signum)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   Device Input Controllers: For Joy Stick
+ * @brief   Device Input Controllers: For GtForce
  *          main routine
  *
- * @param   main() finction's standard parameter (argc,argv)
- * @return  result
- * @retval  0       success
- * @retval  1       failed
+ * @param       main() finction's standard parameter (argc,argv)
+ * @return      result
+ * @retval      0       success
+ * @retval      1       failed
  */
 /*--------------------------------------------------------------------------*/
 int main(int argc, char *argv[])
 {
     struct epoll_event  ev_ret[16];
-    char                *ictlDevName = "DrivingForceGT";
+    char                *dicDevName = NULL;
+    char                *confpath;
     int                 JSfd;
     int                 ii, jj;
     int                 ret;
@@ -574,16 +729,20 @@ int main(int argc, char *argv[])
             PrintUsage(argv[0]);
             exit( 0 );
         }
-        else if (strcasecmp( argv[ii], "-d") == 0) {
+        else if (strcmp( argv[ii], "-d") == 0) {
             /* debug    */
             mDebug = 1;
         }
+        else if (strcmp( argv[ii], "-D") == 0) {
+            /* debug    */
+            mDebug = 2;
+        }
         else if (strcasecmp( argv[ii], "-l") == 0) {
             /* event input log  */
             mEventLog = 1;
         }
         else {
-            ictlDevName = argv[ii];
+            dicDevName = argv[ii];
         }
     }
 
@@ -595,63 +754,75 @@ int main(int argc, char *argv[])
         }
     }
 
+    /* set log name     */
+    ico_log_open("ico_dic-gtforce");
+
+    /* read conf file   */
+    confpath = getenv(ICO_DIC_CONF_ENV);
+
     /* open joystick    */
-    JSfd = ico_ictl_js_open(ictlDevName);
+    JSfd = ico_dic_js_open(dicDevName, &confpath);
     if (JSfd < 0) {
-        ERROR_PRINT("main: Leave(Error device open)");
+        ICO_ERR("main: Leave(Error device open)");
         exit(1);
     }
-    gIco_ICtrl_JS.fd = JSfd;
+    gIco_Dic_JS.fd = JSfd;
 
     /* read conf file   */
-    char *confpath = getenv(ICO_ICTL_CONF_ENV);
-    if (!confpath)  {
-        confpath = ICO_ICTL_CONF_FILE;
+    if (ico_dic_read_conf(confpath) == ICO_DIC_ERR) {
+        ICO_ERR("main: Leave(Error can not read configfile(%s))", confpath);
+        exit(1);
     }
-    ico_ictl_read_conf(confpath);
 
     /* initialize wayland   */
-    ico_ictl_wayland_init(NULL, NULL);
-    ico_ictl_add_fd(JSfd);
+    if (ico_dic_wayland_init(NULL, NULL) == ICO_DIC_ERR)    {
+        ICO_ERR("main: Leave(Error can not connect to wayland)");
+        exit(1);
+    }
+    ico_dic_add_fd(JSfd);
 
     /* send configuration informations to Multi Input Manager   */
-    for (ii = 0; ii < nIco_ICtrl_JS_Input; ii++)    {
+    for (ii = 0; ii < nIco_Dic_JS_Input; ii++)    {
+        if (gIco_Dic_JS_Input[ii].code[0].appid[0] != 0)    continue;
         ico_input_mgr_device_configure_input(
-                gIco_ICtrl_Mng.Wayland_InputMgr, gIco_ICtrl_JS.device, gIco_ICtrl_JS.type,
-                gIco_ICtrl_JS_Input[ii].name, gIco_ICtrl_JS_Input[ii].input,
-                gIco_ICtrl_JS_Input[ii].code[0].name, gIco_ICtrl_JS_Input[ii].code[0].code);
-        for (jj = 1; jj < 20; jj++)     {
-            if (gIco_ICtrl_JS_Input[ii].code[jj].code == 0) break;
+                gIco_Dic_Mng.Wayland_InputMgr, gIco_Dic_JS.device, gIco_Dic_JS.type,
+                gIco_Dic_JS_Input[ii].name, gIco_Dic_JS_Input[ii].input,
+                gIco_Dic_JS_Input[ii].code[0].name, gIco_Dic_JS_Input[ii].code[0].code);
+        for (jj = 1; jj < ICO_DIC_MAX_CODES; jj++)     {
+            if (gIco_Dic_JS_Input[ii].code[jj].code == 0) break;
             ico_input_mgr_device_configure_code(
-                    gIco_ICtrl_Mng.Wayland_InputMgr, gIco_ICtrl_JS.device,
-                    gIco_ICtrl_JS_Input[ii].input, gIco_ICtrl_JS_Input[ii].code[jj].name,
-                    gIco_ICtrl_JS_Input[ii].code[jj].code);
+                    gIco_Dic_Mng.Wayland_InputMgr, gIco_Dic_JS.device,
+                    gIco_Dic_JS_Input[ii].input, gIco_Dic_JS_Input[ii].code[jj].name,
+                    gIco_Dic_JS_Input[ii].code[jj].code);
         }
     }
 
     /* signal init  */
+    signal(SIGCHLD, SIG_IGN);
     sigint.sa_handler = signal_int;
     sigemptyset(&sigint.sa_mask);
     sigint.sa_flags = SA_RESETHAND;
     sigaction(SIGINT, &sigint, NULL);
+    sigaction(SIGTERM, &sigint, NULL);
 
     /* main loop    */
     while (gRunning) {
-        ret = ico_ictl_wayland_iterate(ev_ret, 200);
+        ret = ico_dic_wayland_iterate(ev_ret, 200);
         for (ii = 0; ii < ret; ii++) {
             if (ev_ret[ii].data.fd == JSfd) {
-                ico_ictl_js_read(JSfd);
+                ico_dic_js_read(JSfd);
             }
         }
     }
-    ico_ictl_wayland_finish();
+    ico_dic_wayland_finish();
+    ico_log_close();
 
     exit(0);
 }
 
 static void PrintUsage(const char *pName)
 {
-    fprintf( stderr, "Usage: %s [-h] [-d] DeviceName\n", pName );
+    fprintf( stderr, "Usage: %s [-h] [-d] [DeviceName]\n", pName );
     fprintf( stderr, "       ex)\n");
     fprintf( stderr, "          %s \"Driving Force GT\"\n", pName);
 }
diff --git a/gtforce/ico_dic-gtforce.h b/gtforce/ico_dic-gtforce.h
new file mode 100644 (file)
index 0000000..87c0bd7
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   header file of Device Input Controllers for GtForce
+ *
+ * @date    Sep-08-2013
+ */
+
+#ifndef _ICO_DIC_GTFORCE_H_
+#define _ICO_DIC_GTFORCE_H_
+
+#include    <wayland-client-protocol.h>
+#include    <wayland-client.h>
+#include    <wayland-egl.h>
+#include    <wayland-util.h>
+#include    <sys/ioctl.h>
+#include    <sys/epoll.h>
+#include    <string.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include    <fcntl.h>
+
+#include    <ico_window_mgr-client-protocol.h>
+#include    <ico_input_mgr-client-protocol.h>
+#include    <ico_log.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* call back function */
+typedef void (*Ico_Dic_Wayland_Cb)( void );
+
+/* Deafult config file                      */
+#define ICO_DIC_CONF_FILE   \
+                        "/opt/etc/ico/device-input-controller/%s.conf"
+/* Environment valible name for config file */
+#define ICO_DIC_CONF_ENV    "DIC_GTFORCE_CONF"
+/* Environment valible name for input device*/
+#define ICO_DIC_INPUT_DEV   "DIC_GTFORCE_DEV"
+
+/* maximum value                            */
+#define ICO_DIC_MAX_APPID_LEN   80          /* application id name length           */
+#define ICO_DIC_MAX_CODES       2           /* maximum codes in same switch         */
+
+/* event code                               */
+#define ICO_DIC_TOUCH_NONE      0           /* not exist touch event                */
+#define ICO_DIC_TOUCH_KEYIN     1           /* touch event is reserved              */
+#define ICO_DIC_TOUCH_PASSED    2           /* touch event is passed                */
+#define ICO_DIC_EVENT_NUM       (16)
+
+/* return val */
+#define ICO_DIC_OK              0           /* success                              */
+#define ICO_DIC_ERR             (-1)        /* failedi                              */
+
+/* management table */
+typedef struct  _Ico_Dic_Mng    {
+    /* Multi Input Controller   */
+    int                         Dic_id;         /* multi input controller ID        */
+    Ico_Dic_Wayland_Cb          Dic_CallBack;   /* call back function               */
+
+    /* wayland interfaces       */
+    struct wl_display           *Wayland_Display;   /* Wayland Display              */
+    struct wl_registry          *Wayland_Registry;  /* Wayland Registory            */
+    struct ico_window_mgr       *Wayland_WindowMgr; /* Wayland multi window manager */
+    struct ico_input_mgr_control *Wayland_InputCtl; /* Wayland multi input manager  */
+    struct ico_input_mgr_device *Wayland_InputMgr;  /* Wayland multi input manager  */
+
+    int                         WaylandFd;          /* file descriptor of Wayland   */
+    int                         Dic_efd;            /* descriptor of epoll          */
+
+}   Ico_Dic_Mng;
+
+/* function prototype           */
+                                                /* initialization to wayland        */
+int ico_dic_wayland_init(const char *display ,Ico_Dic_Wayland_Cb callback);
+void ico_dic_wayland_finish(void);              /* finish wayland connection        */
+                                                /* iterate wayland connection       */
+int ico_dic_wayland_iterate(struct epoll_event *ev_ret, int timeout);
+int ico_dic_add_fd(int fd);                     /* add file descriptor              */
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* _ICO_DIC_GTFORCE_H_ */
+
diff --git a/gtforce/ico_dic-wayland.c b/gtforce/ico_dic-wayland.c
new file mode 100644 (file)
index 0000000..5066b65
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Device Input Controllers(wayland processing)
+ *          processing related wayland
+ *
+ * @date    Sep-08-2013
+ */
+
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <strings.h>
+#include    <errno.h>
+#include    <pthread.h>
+#include    "ico_dic-gtforce.h"
+
+/* prototype of static function             */
+/* callback function from wayland global    */
+static void ico_dic_wayland_globalcb(void *data, struct wl_registry *registry,
+                                     uint32_t wldispid, const char *event,
+                                     uint32_t version);
+
+/* table/variable                           */
+extern Ico_Dic_Mng      gIco_Dic_Mng;
+
+static const struct wl_registry_listener registry_listener = {
+    ico_dic_wayland_globalcb
+};
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_dic_wayland_init
+ *          connect to wayland of specified Display. specified NULL to
+ *          connected Display, connect to the default Display.
+ *
+ * @param[in]   display             display to connect
+ * @param[in]   callback            callback function
+ * @return      result
+ * @retval      ICO_DIC_EOK         Success
+ * @retval      ICO_DIC_ERR         Failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_dic_wayland_init(const char *display, Ico_Dic_Wayland_Cb callback)
+{
+    ICO_TRA("ico_dic_wayland_init: Enter");
+
+    int ret;
+
+    /* regist callback funtion  */
+    gIco_Dic_Mng.Dic_CallBack = callback;
+
+    /* connect to wayland(retry max 5 sec)  */
+    for (ret = 0; ret < (5000/20); ret++) {
+        gIco_Dic_Mng.Wayland_Display = wl_display_connect(display);
+        if (gIco_Dic_Mng.Wayland_Display) {
+            break;
+        }
+        usleep(20*1000);
+    }
+    if (! gIco_Dic_Mng.Wayland_Display) {
+        ICO_ERR("ico_dic_wayland_init: Leave(ERR), Wayland Connect Error");
+        return ICO_DIC_ERR;
+    }
+
+    /* add listener of wayland registry */
+    gIco_Dic_Mng.Wayland_Registry =
+        wl_display_get_registry(gIco_Dic_Mng.Wayland_Display);
+    wl_registry_add_listener(gIco_Dic_Mng.Wayland_Registry,
+                             &registry_listener, &gIco_Dic_Mng);
+
+    /* display dispatch to wait     */
+    do  {
+        wl_display_dispatch(gIco_Dic_Mng.Wayland_Display);
+    } while ((gIco_Dic_Mng.Wayland_WindowMgr == NULL) ||
+             (gIco_Dic_Mng.Wayland_InputCtl == NULL) ||
+             (gIco_Dic_Mng.Wayland_InputMgr == NULL));
+
+    /* get the Wayland descriptor   */
+    gIco_Dic_Mng.WaylandFd = wl_display_get_fd(gIco_Dic_Mng.Wayland_Display);
+    ICO_DBG("ico_dic_wayland_init: Wayland FD = %d", gIco_Dic_Mng.WaylandFd);
+
+    /* create epoll file descriptor */
+    gIco_Dic_Mng.Dic_efd = epoll_create1(EPOLL_CLOEXEC);
+    if (gIco_Dic_Mng.Dic_efd < 0) {
+        ICO_ERR("ico_dic_wayland_init: Leave(ERR), Epoll Create Error");
+        return ICO_DIC_ERR;
+    }
+    struct epoll_event ev;
+    memset(&ev, 0, sizeof(ev));
+    ev.events = EPOLLIN;
+    ev.data.fd = gIco_Dic_Mng.WaylandFd;
+    if (epoll_ctl(gIco_Dic_Mng.Dic_efd, EPOLL_CTL_ADD,
+                  gIco_Dic_Mng.WaylandFd, &ev) != 0) {
+        ICO_ERR("ico_dic_wayland_init: Leave(ERR), Epoll ctl Error");
+        return ICO_DIC_ERR;
+    }
+    ICO_TRA("ico_dic_wayland_init: Leave(EOK)");
+    return ICO_DIC_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_dic_wayland_globalcb
+ *
+ * @param[in]   data        the information that appointed at the time of
+ *                          callback registration
+ * @param[in]   registry    wayland registry
+ * @param[in]   wldispid    wayland displya id
+ * @param[in]   event       event name
+ * @param[in]   version     version of Wayland
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_dic_wayland_globalcb(void *data, struct wl_registry *registry, uint32_t wldispid,
+                          const char *event, uint32_t version)
+{
+    ICO_DBG("ico_dic_wayland_globalcb: Event=%s DispId=%08x", event, wldispid);
+
+    if (strcmp(event, "ico_window_mgr") == 0)  {
+        gIco_Dic_Mng.Wayland_WindowMgr = wl_registry_bind(gIco_Dic_Mng.Wayland_Registry,
+                                                          wldispid,
+                                                          &ico_window_mgr_interface, 1);
+        ICO_DBG("ico_dic_wayland_globalcb: wl_registry_bind(ico_window_mgr)");
+    }
+    else if (strcmp(event, "ico_input_mgr_control") == 0)   {
+        /* conect to multi input manager control interface  */
+        gIco_Dic_Mng.Wayland_InputCtl = wl_registry_bind(gIco_Dic_Mng.Wayland_Registry,
+                                                         wldispid,
+                                                         &ico_input_mgr_control_interface, 1);
+        ICO_DBG("ico_dic_wayland_globalcb: wl_registry_bind(ico_input_mgr_control)");
+    }
+    else if (strcmp(event, "ico_input_mgr_device") == 0) {
+        /* conect to multi input manager device interface   */
+        gIco_Dic_Mng.Wayland_InputMgr = wl_registry_bind(gIco_Dic_Mng.Wayland_Registry,
+                                                         wldispid,
+                                                         &ico_input_mgr_device_interface, 1);
+        ICO_DBG("ico_dic_wayland_globalcb: wl_registry_bind(ico_input_mgr_device)");
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_dic_wayland_iterate
+ *          iterate processing of wayland
+ *
+ * @param[in]   timeout     wait time miri-sec
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_dic_wayland_iterate(struct epoll_event *ev_ret, int timeout)
+{
+    int nfds;
+    int ii;
+    static int  errcount = 0;
+
+    memset(ev_ret, 0, sizeof(struct epoll_event) * ICO_DIC_EVENT_NUM);
+    wl_display_flush(gIco_Dic_Mng.Wayland_Display);
+
+    while (1) {
+        if ((nfds = epoll_wait(gIco_Dic_Mng.Dic_efd, ev_ret,
+                               ICO_DIC_EVENT_NUM, timeout)) > 0) {
+            for (ii = 0; ii < nfds; ii++) {
+                if (ev_ret[ii].data.fd == gIco_Dic_Mng.WaylandFd) {
+                    wl_display_dispatch(gIco_Dic_Mng.Wayland_Display);
+                    ICO_DBG("ico_dic_wayland_iterate: Event wayland fd");
+                    errcount ++;
+                    if (errcount > 50)  {
+                        ICO_ERR("ico_dic_wayland_iterate: Error wayland disconnect");
+                        exit(9);
+                    }
+                    if ((errcount % 5) == 0)    {
+                        usleep(50*1000);
+                    }
+                }
+                else    {
+                    errcount = 0;
+                }
+            }
+            return nfds;
+        }
+        else if (nfds == 0) {
+            return 0;
+        }
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_dic_add_fd
+ *          Add file descriptor to watch in pool.
+ *
+ * @param[in]   fd                  File descriptor
+ * @return      result
+ * @retval      ICO_DIC_EOK        Success
+ * @retval      ICO_DIC_ERR        Failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_dic_add_fd(int fd)
+{
+    ICO_DBG("ico_dic_add_fd: Enter(fd=%d)", fd);
+
+    struct epoll_event      ev;
+
+    if (gIco_Dic_Mng.Dic_efd <= 0) {
+        ICO_ERR("ico_dic_add_fd: Leave(ERR), Epoll Never Created");
+        return ICO_DIC_ERR;
+    }
+
+    memset(&ev, 0, sizeof(ev));
+    ev.events = EPOLLIN;
+    ev.data.fd = fd;
+    if (epoll_ctl(gIco_Dic_Mng.Dic_efd, EPOLL_CTL_ADD, fd, &ev) != 0) {
+        ICO_ERR("ico_dic_add_fd: Leave(ERR), Epoll ctl Error");
+        return ICO_DIC_ERR;
+    }
+    ICO_DBG("ico_dic_add_fd: Leave(EOK)");
+
+    return ICO_DIC_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_dic_wayland_finish
+ *          Finish wayland connection
+ *
+ * @param       nothing
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_dic_wayland_finish(void)
+{
+    ICO_DBG("ico_dic_wayland_finish: Enter");
+
+    wl_display_flush(gIco_Dic_Mng.Wayland_Display);
+    wl_display_disconnect(gIco_Dic_Mng.Wayland_Display);
+
+    ICO_DBG("ico_dic_wayland_finish: Leave");
+}
+
diff --git a/joystick_gtforce.conf b/joystick_gtforce.conf
deleted file mode 100644 (file)
index 9537ad1..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-## Multi Input Controller Configurations for joystick_gtforce
-##  /opt/etc/ico-uxf-device-input-controller/joystick_gtforce.conf
-##     Feb-08-2013
-
-## Device
-[device]
-# Device Name
-name=DrivingForceGT
-# Device Input Controller
-ictl=ico_ictl-joystick
-# Device type('8' is input switch)
-type=8
-# ECU Id
-ecu=0
-
-## Input Switch
-[input]
-## UpDown key input
-0=JS_UPDOWN
-# input event from device(type;number)
-0.event=2;3
-# event code to Multi Input Manager(Up;Down)
-0.code=10:Up;11:Down
-
-## LeftRight key input
-1=JS_LR
-# input event from device(type;number)
-1.event=2;2
-# event code to Multi Input Manager(Left;Right)
-1.code=20:Left;21:Right
-
-## CROSS Button input
-2=JS_CROSS
-# input event from device(type;number)
-2.event=1;0
-# event code to Multi Input Manager
-2.code=30
-
-## SQUARE Button input
-3=JS_SQUARE
-# input event from device(type;number)
-3.event=1;1
-# event code to Multi Input Manager
-3.code=40
-
-## CIRCLE Button input
-4=JS_CIRCLE
-# input event from device(type;number)
-4.event=1;2
-# event code to Multi Input Manager
-4.code=50
-
-## TRIANGLE Button input
-5=JS_TRIANGLE
-# input event from device(type;number)
-5.event=1;3
-# event code to Multi Input Manager
-5.code=60
-
diff --git a/joystick_gtforce/dbg_curtime.c b/joystick_gtforce/dbg_curtime.c
deleted file mode 100644 (file)
index 23063fb..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   Current date & time string for log output
- *
- * @date    Feb-08-2013
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-#include <sys/time.h>
-#include <time.h>
-
-const char *dbg_curtime(void);
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   dbg_curtime: Current time for Debug Write
- *
- * @param   None
- * @return  String pointer for current time
- */
-/*--------------------------------------------------------------------------*/
-const char *
-dbg_curtime(void)
-{
-    struct timeval  NowTime;            /* Current date & time              */
-    static int      NowZone = (99*60*60);/* Local time                      */
-    extern long     timezone;           /* System time zone                 */
-    static char     sBuf[28];
-
-    if (NowZone > (24*60*60))  {
-        tzset();
-        NowZone = timezone;
-    }
-    gettimeofday(&NowTime, (struct timezone *)0);
-    NowTime.tv_sec -= NowZone;
-
-    sprintf(sBuf, "[%02d:%02d:%02d.%03d]",
-            (int)((NowTime.tv_sec/3600) % 24),
-            (int)((NowTime.tv_sec/60) % 60),
-            (int)(NowTime.tv_sec % 60),
-            (int)NowTime.tv_usec/1000);
-
-    return(sBuf);
-}
-
diff --git a/joystick_gtforce/ico_ictl-local.h b/joystick_gtforce/ico_ictl-local.h
deleted file mode 100644 (file)
index cc6265b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   header file of Input Controllers
- *
- * @date    Feb-20-2013
- */
-
-#ifndef _ICO_ICTL_LOCAL_H_
-#define _ICO_ICTL_LOCAL_H_
-
-#include    <wayland-client-protocol.h>
-#include    <wayland-client.h>
-#include    <wayland-egl.h>
-#include    <wayland-util.h>
-#include    <sys/ioctl.h>
-#include    <sys/epoll.h>
-#include    <string.h>
-#include    <sys/types.h>
-#include    <sys/stat.h>
-#include    <fcntl.h>
-
-#include    <ico_input_mgr-client-protocol.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* call back function */
-typedef void (*Ico_ICtl_Wayland_Cb)( void );
-
-/* Deafult config file                      */
-#define ICO_ICTL_CONF_FILE  \
-                        "/opt/etc/ico-uxf-device-input-controller/joystick_gtforce.conf"
-/* Environment valible name for config file */
-#define ICO_ICTL_CONF_ENV   "ICTL_GTFORCE_CONF"
-/* Environment valible name for input device*/
-#define ICO_ICTL_INPUT_DEV  "ICTL_GTFORCE_DEV"
-
-#define ICO_ICTL_TOUCH_NONE     0           /* not exist touch event                */
-#define ICO_ICTL_TOUCH_KEYIN    1           /* touch event is reserved              */
-#define ICO_ICTL_TOUCH_PASSED   2           /* touch event is passed                */
-
-#define ICO_ICTL_EVENT_NUM      (16)
-/* return val */
-#define ICO_ICTL_OK             0           /* success                              */
-#define ICO_ICTL_ERR            (-1)        /* failedi                              */
-
-/* management table */
-typedef struct  _Ico_ICtl_Mng   {
-    /* Multi Input Controller   */
-    int                         ICTL_ID;            /* multi input controller ID    */
-    Ico_ICtl_Wayland_Cb         ICtl_CallBack;      /* call back function           */
-
-    /* wayland interfaces       */
-    struct wl_display           *Wayland_Display;   /* Wayland Display              */
-    struct wl_registry          *Wayland_Registry;  /* Wayland Registory            */
-    struct ico_input_mgr_device *Wayland_InputMgr;  /* Wayland multi input manager  */
-
-    int                         WaylandFd;          /* file descriptor of Wayland   */
-    int                         ICTL_EFD;           /* descriptor of epoll          */
-
-}   Ico_ICtl_Mng;
-
-/* function prototype           */
-                                                /* initialization to wayland        */
-int ico_ictl_wayland_init(const char *display ,Ico_ICtl_Wayland_Cb callback);
-void ico_ictl_wayland_finish(void);             /* finish wayland connection        */
-                                                /* iterate wayland connection       */
-int ico_ictl_wayland_iterate(struct epoll_event *ev_ret, int timeout);
-int ico_ictl_add_fd(int fd);                    /* add file descriptor              */
-
-/* macro for debug              */
-extern const char *dbg_curtime(void);
-extern int  mDebug;
-#define DEBUG_PRINT(fmt, ...)   \
-    {if (mDebug) {fprintf(stderr, "%sDBG> "fmt" (%s:%d)\n",dbg_curtime(),##__VA_ARGS__,__FILE__,__LINE__); fflush(stderr);}}
-#define ERROR_PRINT(fmt, ...)   \
-    {fprintf(stderr, "%sERR> "fmt" (%s:%d)\n",dbg_curtime(),##__VA_ARGS__,__FILE__,__LINE__); fflush(stderr);}
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_ICTL_LOCAL_H_ */
-
diff --git a/joystick_gtforce/ico_ictl-wayland.c b/joystick_gtforce/ico_ictl-wayland.c
deleted file mode 100644 (file)
index 9665f2c..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   Device Input Controllers(wayland processing)
- *          processing related wayland
- *
- * @date    Feb-08-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <strings.h>
-#include    <errno.h>
-#include    <pthread.h>
-
-#include    "ico_ictl-local.h"
-
-/* prototype of static function             */
-/* callback function from wayland global    */
-static void ico_ictl_wayland_globalcb(void *data, struct wl_registry *registry,
-                                      uint32_t wldispid, const char *event,
-                                      uint32_t version);
-
-/* table/variable                           */
-extern Ico_ICtl_Mng         gIco_ICtrl_Mng;
-
-static const struct wl_registry_listener registry_listener = {
-    ico_ictl_wayland_globalcb
-};
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_ictl_wayland_init
- *          connect to wayland of specified Display. specified NULL to
- *          connected Display, connect to the default Display.
- *
- * @param[in]   display             display to connect
- * @param[in]   callback            callback function
- * @return      result
- * @retval      ICO_ICTL_EOK        Success
- * @retval      ICO_ICTL_ERR        Failed
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_ictl_wayland_init(const char *display, Ico_ICtl_Wayland_Cb callback)
-{
-    DEBUG_PRINT("ico_ictl_wayland_init: Enter");
-
-    int ret;
-
-    /* regist callback funtion  */
-    gIco_ICtrl_Mng.ICtl_CallBack = callback;
-
-    /* connect to wayland(retry max 3 sec)  */
-    for (ret = 0; ret < (3000/20); ret++) {
-        gIco_ICtrl_Mng.Wayland_Display = wl_display_connect(display);
-        if (gIco_ICtrl_Mng.Wayland_Display) {
-            break;
-        }
-        usleep(20*1000);
-    }
-    if (! gIco_ICtrl_Mng.Wayland_Display) {
-        ERROR_PRINT("ico_ictl_wayland_init: Leave(ERR), Wayland Connect Error");
-        return ICO_ICTL_ERR;
-    }
-
-    /* add listener of wayland registry */
-    gIco_ICtrl_Mng.Wayland_Registry =
-        wl_display_get_registry(gIco_ICtrl_Mng.Wayland_Display);
-    wl_registry_add_listener(gIco_ICtrl_Mng.Wayland_Registry,
-                             &registry_listener, &gIco_ICtrl_Mng);
-
-    /* display dispatch to wait     */
-    do  {
-        wl_display_dispatch(gIco_ICtrl_Mng.Wayland_Display);
-    } while (gIco_ICtrl_Mng.Wayland_InputMgr == NULL);
-
-    /* get the Wayland descriptor   */
-    gIco_ICtrl_Mng.WaylandFd =
-        wl_display_get_fd(gIco_ICtrl_Mng.Wayland_Display);
-    DEBUG_PRINT("ico_ictl_wayland_init: WFD = %d", gIco_ICtrl_Mng.WaylandFd);
-
-    /* create epoll file descriptor */
-    gIco_ICtrl_Mng.ICTL_EFD = epoll_create1(EPOLL_CLOEXEC);
-    if (gIco_ICtrl_Mng.ICTL_EFD < 0) {
-        ERROR_PRINT("ico_ictl_wayland_init: Leave(ERR), Epoll Create Error");
-        return ICO_ICTL_ERR;
-    }
-    struct epoll_event ev;
-    memset(&ev, 0, sizeof(ev));
-    ev.events = EPOLLIN;
-    ev.data.fd = gIco_ICtrl_Mng.WaylandFd;
-    if (epoll_ctl(gIco_ICtrl_Mng.ICTL_EFD, EPOLL_CTL_ADD,
-                  gIco_ICtrl_Mng.WaylandFd, &ev) != 0) {
-        ERROR_PRINT("ico_ictl_wayland_init: Leave(ERR), Epoll ctl Error");
-        return ICO_ICTL_ERR;
-    }
-    DEBUG_PRINT("ico_ictl_wayland_init: Leave(EOK)");
-    return ICO_ICTL_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_ictl_wayland_globalcb
- *
- * @param[in]   data        the information that appointed at the time of
- *                          callback registration
- * @param[in]   registry    wayland registry
- * @param[in]   wldispid    wayland displya id
- * @param[in]   event       event name
- * @param[in]   version     version of Wayland
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_ictl_wayland_globalcb(void *data, struct wl_registry *registry, uint32_t wldispid,
-                          const char *event, uint32_t version)
-{
-    DEBUG_PRINT("ico_ictl_wayland_globalcb: Event=%s DispId=%08x", event, wldispid);
-
-    if (strcmp(event, "ico_input_mgr_device") == 0) {
-        /* connect ictl_master in multi input manager   */
-        gIco_ICtrl_Mng.Wayland_InputMgr = (struct ico_input_mgr_device *)
-            wl_registry_bind(gIco_ICtrl_Mng.Wayland_Registry,
-                             wldispid, &ico_input_mgr_device_interface, 1);
-
-        DEBUG_PRINT("ico_ictl_wayland_globalcb: wl_registry_bind(ico_input_mgr_device)");
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_ictl_wayland_iterate
- *          iterate processing of wayland
- *
- * @param[in]   timeout     wait time miri-sec
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_ictl_wayland_iterate(struct epoll_event *ev_ret, int timeout)
-{
-    int nfds;
-    int ii = 0;
-
-    memset(ev_ret, 0, sizeof(struct epoll_event) * ICO_ICTL_EVENT_NUM);
-    wl_display_flush(gIco_ICtrl_Mng.Wayland_Display);
-
-    while (1) {
-        if ((nfds = epoll_wait( gIco_ICtrl_Mng.ICTL_EFD, ev_ret,
-                                       ICO_ICTL_EVENT_NUM, timeout)) > 0) {
-            for (ii = 0; ii < nfds; ii++) {
-                if (ev_ret[ii].data.fd == gIco_ICtrl_Mng.WaylandFd) {
-                    wl_display_dispatch(gIco_ICtrl_Mng.Wayland_Display);
-                    DEBUG_PRINT( "ico_ictl_wayland_iterate: Exit wayland fd");
-                }
-            }
-            return nfds;
-        }
-        else if (nfds == 0) {
-            return nfds;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_ictl_add_fd
- *          Add file descriptor to watch in pool.
- *
- * @param[in]   fd                  File descriptor
- * @return      result
- * @retval      ICO_ICTL_EOK        Success
- * @retval      ICO_ICTL_ERR        Failed
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_ictl_add_fd(int fd)
-{
-    DEBUG_PRINT("ico_ictl_add_fd: Enter(fd=%d)", fd);
-
-    struct epoll_event      ev;
-
-    if (gIco_ICtrl_Mng.ICTL_EFD <= 0) {
-        ERROR_PRINT("ico_ictl_add_fd: Leave(ERR), Epoll Never Created");
-        return ICO_ICTL_ERR;
-    }
-
-    memset(&ev, 0, sizeof(ev));
-    ev.events = EPOLLIN;
-    ev.data.fd = fd;
-    if (epoll_ctl(gIco_ICtrl_Mng.ICTL_EFD, EPOLL_CTL_ADD, fd, &ev) != 0) {
-        ERROR_PRINT("ico_ictl_add_fd: Leave(ERR), Epoll ctl Error");
-        return ICO_ICTL_ERR;
-    }
-    DEBUG_PRINT("ico_ictl_add_fd: Leave(EOK)");
-
-    return ICO_ICTL_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_ictl_wayland_finish
- *          Finish wayland connection
- *
- * @param       nothing
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_ictl_wayland_finish(void)
-{
-    DEBUG_PRINT("ico_ictl_wayland_finish: Enter");
-
-    wl_display_flush(gIco_ICtrl_Mng.Wayland_Display);
-    wl_display_disconnect(gIco_ICtrl_Mng.Wayland_Display);
-
-    DEBUG_PRINT("ico_ictl_wayland_finish: Leave");
-}
-
index e8b9328..dbdd944 100644 (file)
@@ -1,3 +1,9 @@
+* Thu Sep 19 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/tizen/20130919.104803@2537721
+- 0.9.01 release.
+-- The initial release for TizenIVI 3.0.
+-- Support GTForce (G25 and G27).
+-- Abolished the touch panel (including the calibration) support, because it became the standard support of Weston.
+
 * Wed Jun 12 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/2.0alpha-wayland/20130606.173259@3f487a2
 - 0.5.05 release
 - The change of the package test program with the interface change of ico-uxf-weston-plugin.
index f2ec4f8..06caa10 100644 (file)
@@ -1,20 +1,22 @@
 Name:       ico-uxf-device-input-controller
 Summary:    Device Input Controller
-Version:    0.5.05
+Version:    0.9.01
 Release:    1.1
 Group:      System/GUI
 License:    Apache License, Version 2.0
 URL:        ""
 Source0:    %{name}-%{version}.tar.bz2
 
-BuildRequires: pkgconfig(wayland-client) >= 1.0
-BuildRequires: pkgconfig(wayland-egl)
+BuildRequires: pkgconfig(wayland-client) >= 1.2.0
+BuildRequires: mesa-devel
 BuildRequires: pkgconfig(egl)
 BuildRequires: pkgconfig(glesv2)
 BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.5.05
-Requires: weston >= 1.0
-Requires: ico-uxf-weston-plugin >= 0.5.05
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.04
+BuildRequires: ico-uxf-utilities-devel >= 0.2.04
+Requires: weston >= 1.2.1
+Requires: ico-uxf-weston-plugin >= 0.9.04
+Requires: ico-uxf-utilities >= 0.2.04
 
 %description
 Device Input Controller for ico-uxf-weston-plugin(Multi Input Manager)
@@ -23,9 +25,7 @@ Device Input Controller for ico-uxf-weston-plugin(Multi Input Manager)
 %setup -q -n %{name}-%{version}
 
 %build
-autoreconf --install
-
-%autogen --prefix=/usr
+%autogen
 
 %configure
 make %{?_smp_mflags}
@@ -35,16 +35,26 @@ rm -rf %{buildroot}
 %make_install
 
 # configurations
-%define ictl_conf /opt/etc/ico-uxf-device-input-controller
+%define ictl_conf /opt/etc/ico/device-input-controller
 mkdir -p %{buildroot}%{ictl_conf}
-install -m 0644 joystick_gtforce.conf %{buildroot}%{ictl_conf}
-install -m 0644 egalax_calibration.conf %{buildroot}%{ictl_conf}
+install -m 0644 settings/drivingforcegt.conf %{buildroot}%{ictl_conf}
+install -m 0644 settings/g27racingwheel.conf %{buildroot}%{ictl_conf}
+install -m 0755 settings/set_daynight.sh %{buildroot}%{ictl_conf}
+install -m 0755 settings/set_navi_busguide.sh %{buildroot}%{ictl_conf}
+install -m 0755 settings/set_navi_destination.sh %{buildroot}%{ictl_conf}
+install -d %{buildroot}/%{_unitdir_user}/weston.target.wants
+install -m 644 settings/ico-device-input-controller.service %{buildroot}%{_unitdir_user}/ico-device-input-controller.service
+install -m 644 settings/ico-dic-wait-weston-ready.path %{buildroot}%{_unitdir_user}/ico-dic-wait-weston-ready.path
+ln -sf ../ico-dic-wait-weston-ready.path %{buildroot}/%{_unitdir_user}/weston.target.wants/
 
 %files
 %defattr(-,root,root,-)
-%{_bindir}/ico_ictl-joystick_gtforce
-%{_bindir}/ico_ictl-touch_egalax
-%{_bindir}/ico_ictl-egalax_calibration
-%{ictl_conf}/joystick_gtforce.conf
-%{ictl_conf}/egalax_calibration.conf
-
+%{_bindir}/ico_dic-gtforce
+%{ictl_conf}/drivingforcegt.conf
+%{ictl_conf}/g27racingwheel.conf
+%{ictl_conf}/set_daynight.sh
+%{ictl_conf}/set_navi_busguide.sh
+%{ictl_conf}/set_navi_destination.sh
+/usr/lib/systemd/user/ico-device-input-controller.service
+/usr/lib/systemd/user/ico-dic-wait-weston-ready.path
+/usr/lib/systemd/user/weston.target.wants/ico-dic-wait-weston-ready.path
diff --git a/settings/drivingforcegt.conf b/settings/drivingforcegt.conf
new file mode 100644 (file)
index 0000000..c1dfdb5
--- /dev/null
@@ -0,0 +1,104 @@
+## Multi Input Controller Configurations for GtForce
+##  /opt/etc/ico/device-input-controller/gtforce_g25.conf
+##     Sep-08-2013
+
+## Device
+[device]
+# Device Name
+name=Driving Force GT
+# Device Input Controller
+dic=ico_uxf_dic-gtforce
+# Device type('8' is input switch)
+type=8
+# ECU Id
+ecu=0
+
+## Input Switch
+[input]
+## UpDown key input
+0=JS_UPDOWN
+# input event from device(type;number)
+0.event=2;4
+# event code to Multi Input Manager(Up;Down)
+0.code=10:Up;11:Down
+# fixed send appid (if fixed switch) ... send key event(Up='U',Down='D') to HapticDaemon
+0.fixed=10:appid=ico_uxf_dic-haptic:key=22;11:appid=ico_uxf_dic-haptic:key=32
+
+## LeftRight key input
+1=JS_LR
+# input event from device(type;number)
+1.event=2;3
+# event code to Multi Input Manager(Left;Right)
+1.code=20:Left;21:Right
+# fixed send appid (if fixed switch) ... send key event(Left='L',Right='R') to HapticDaemon
+1.fixed=20:appid=ico_uxf_dic-haptic:key=38;21:appid=ico_uxf_dic-haptic:key=19
+
+## CROSS Button input
+2=JS_CROSS
+# input event from device(type;number)
+2.event=1;0
+# event code to Multi Input Manager
+2.code=30
+2.fixed=appid=org.tizen.ico.homescreen:key=50
+
+## SQUARE Button input
+3=JS_SQUARE
+# input event from device(type;number)
+3.event=1;1
+# event code to Multi Input Manager
+3.code=40
+3.fixed=shell=/opt/etc/ico/device-input-controller/set_navi_busguide.sh
+
+## CIRCLE Button input
+4=JS_CIRCLE
+# input event from device(type;number)
+4.event=1;2
+# event code to Multi Input Manager
+4.code=50
+4.fixed=appid=ico_uxf_dic-haptic:key=24
+
+## TRIANGLE Button input
+5=JS_TRIANGLE
+# input event from device(type;number)
+5.event=1;3
+# event code to Multi Input Manager
+5.code=60
+# fixed start shell script
+5.fixed=shell=/opt/etc/ico/device-input-controller/set_daynight.sh
+
+## PS Button
+6=JS_PS
+6.event=1;20
+6.code=101
+6.fixed=shell=/opt/etc/ico/device-input-controller/set_navi_destination.sh
+
+## Home Button
+#7=JS_HOME
+#7.event=1;19
+#7.code=102
+
+## Enter Button
+#8=JS_ENTER
+#8.event=1;14
+#8.code=103
+
+## Start Button
+#9=JS_START
+#9.event=1;9
+#9.code=104
+
+## Select Button
+#10=JS_SELECT
+#10.event=1;8
+#10.code=105
+
+## + Button
+#11=JS_PLUS
+#11.event=1;15
+#11.code=111
+
+## - Button
+#12=JS_MINUS
+#12.event=1;18
+#12.code=112
+
diff --git a/settings/g27racingwheel.conf b/settings/g27racingwheel.conf
new file mode 100644 (file)
index 0000000..906f141
--- /dev/null
@@ -0,0 +1,112 @@
+## Multi Input Controller Configurations for GtForce
+##  /opt/etc/ico/device-input-controller/gtforce_g27.conf
+##     Sep-08-2013
+
+## Device
+[device]
+# Device Name
+name=G27 Racing Wheel
+# Device Input Controller
+dic=ico_uxf_dic-gtforce
+# Device type('8' is input switch)
+type=8
+# ECU Id
+ecu=0
+
+## Input Switch
+[input]
+## UpDown key input
+0=JS_UPDOWN
+# input event from device(type;number)
+0.event=2;5
+# event code to Multi Input Manager(Up;Down)
+0.code=10:Up;11:Down
+# fixed send appid (if fixed switch) ... send key event(Up='U',Down='D') to HapticDaemon
+0.fixed=10:appid=ico_uxf_dic-haptic:key=22;11:appid=ico_uxf_dic-haptic:key=32
+
+## LeftRight key input
+1=JS_LR
+# input event from device(type;number)
+1.event=2;4
+# event code to Multi Input Manager(Left;Right)
+1.code=20:Left;21:Right
+# fixed send appid (if fixed switch) ... send key event(Left='L',Right='R') to HapticDaemon
+1.fixed=20:appid=ico_uxf_dic-haptic:key=38;21:appid=ico_uxf_dic-haptic:key=19
+
+## CROSS Button(Black action button buttom) input
+2=JS_CROSS
+# input event from device(type;number)
+2.event=1;0
+# event code to Multi Input Manager
+2.code=30
+2.fixed=appid=org.tizen.ico.homescreen:key=50
+
+## SQUARE Button(Black action button left) input
+3=JS_SQUARE
+# input event from device(type;number)
+3.event=1;1
+# event code to Multi Input Manager
+3.code=40
+3.fixed=shell=/opt/etc/ico/device-input-controller/set_navi_busguide.sh
+
+## CIRCLE Button(Black action button right) input
+4=JS_CIRCLE
+# input event from device(type;number)
+4.event=1;2
+# event code to Multi Input Manager
+4.code=50
+4.fixed=appid=ico_uxf_dic-haptic:key=24
+
+## TRIANGLE Button(Black action button top) input
+5=JS_TRIANGLE
+# input event from device(type;number)
+5.event=1;3
+# event code to Multi Input Manager
+5.code=60
+# fixed start shell script
+5.fixed=shell=/opt/etc/ico/device-input-controller/set_daynight.sh
+
+## Shift Red Button
+6=RED_1
+6.event=1;11
+6.code=101
+6.fixed=shell=/opt/etc/ico/device-input-controller/set_navi_destination.sh
+#7=RED_2
+#7.event=1;8
+#7.code=102
+#8=RED_3
+#8.event=1;9
+#8.code=103
+#9=RED_4
+#9.event=1;10
+#9.code=104
+
+## Handle Left Red Buttons
+#10=LEFT_UPPER
+#10.event=1;7
+#10.code=71
+#11=LEFT_MIDDLE
+#11.event=1;20
+#11.code=72
+#12=LEFT_LOWER
+#12.event=1;21
+#12.code=73
+
+## Handle Right Red Button
+#13=RIGHT_UPPER
+#13.event=1;6
+#13.code=81
+#14=RIGHT_MIDDLE
+#14.event=1;18
+#14.code=82
+#15=RIGHT_LOWER
+#15.event=1;19
+#15.code=83
+
+## Handle Under Switch
+#16=HANDLE_LEFT
+#16.event=1;5
+#16.code=91
+#17=HANDLE_RIGHT
+#17.event=1;4
+#17.code=92
diff --git a/settings/ico-device-input-controller.service b/settings/ico-device-input-controller.service
new file mode 100644 (file)
index 0000000..b46f421
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=ico device input controller
+Requires=weston.service
+After=weston.service
+
+[Service]
+#Environment=XDG_RUNTIME_DIR=/run/user/5000
+Type=oneshot
+ExecStart=/usr/bin/ico_dic-gtforce -d
+
diff --git a/settings/ico-dic-wait-weston-ready.path b/settings/ico-dic-wait-weston-ready.path
new file mode 100644 (file)
index 0000000..f6bbfeb
--- /dev/null
@@ -0,0 +1,9 @@
+Description=Path activation for ico-device-input-controller
+
+[Path]
+PathExists=/run/user/5000/wayland-0.lock
+#PathExists=/tmp/amd_ready
+Unit=ico-device-input-controller.service
+
+[Install]
+WantedBy=weston.target 
diff --git a/settings/set_daynight.sh b/settings/set_daynight.sh
new file mode 100755 (executable)
index 0000000..a3e3e99
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# set day/night mode
+
+if [ -e /tmp/daynight_sw.day ] ; then
+       rm -fr /tmp/daynight_sw.day
+       /usr/local/bin/ico_set_vehicleinfo EXTERIOR=0
+else
+       touch /tmp/daynight_sw.day
+       /usr/local/bin/ico_set_vehicleinfo EXTERIOR=1000
+fi
diff --git a/settings/set_navi_busguide.sh b/settings/set_navi_busguide.sh
new file mode 100755 (executable)
index 0000000..66ae829
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# sample navi bus guide control
+
+if [ -e /tmp/busguide_sw.off ] ; then
+       rm -fr /tmp/busguide_sw.off
+       /usr/local/bin/set_navi_info genr ON &
+else
+       touch /tmp/busguide_sw.off
+       /usr/local/bin/set_navi_info genr OFF &
+fi
diff --git a/settings/set_navi_destination.sh b/settings/set_navi_destination.sh
new file mode 100755 (executable)
index 0000000..8a1eb9b
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+# set sample navi destination
+
+/usr/local/bin/set_navi_info dest 35.497467 139.405041 &
index 02f745e..dcbf026 100755 (executable)
@@ -5,54 +5,25 @@
 #        Remark: This examination premises that Weston does not run.
 
 # 1 Delete log file
-rm -fr ../tests/testlog
-mkdir ../tests/testlog
+mkdir ../tests/testlog 2> /dev/null
+rm -fr ../tests/testlog/* 2> /dev/null
 
-# 2 Start Pseudo event device (for Touch Panel and Jyostick)
-../tests/test-send_event -device=ico_test_touch -d -mq=55551 2> ../tests/testlog/event_log_touch.log &
-../tests/test-send_event -device=ico_test_joystick -d -J -mq=55552 2> ../tests/testlog/event_log_joystic.log &
-sleep 1
+# 2 set weston environment
+export XDG_RUNTIME_DIR=/run/user/5000
 
 # 3 Start Device Input Controllers
-export CALIBRATOIN_CONF="../egalax_calibration.conf"
-export ICTL_TOUCH_DEV="ico_test_touch"
-#../touch_egalax/ico_ictl-touch_egalax -d -L ico_test_touch 2> ../tests/testlog/touch_egalax.log &
-../touch_egalax/ico_ictl-touch_egalax -d -L > ../tests/testlog/touch_egalax.log 2>&1 &
+export DIC_GTFORCE_CONF="../settings/g27racingwheel.conf"
+../gtforce/ico_uxf_dic-gtforce -d -L 2> ../tests/testlog/gtforce.log &
 sleep 0.5
-export ICTL_GTFORCE_CONF="../joystick_gtforce.conf"
-export ICTL_GTFORCE_DEV="ico_test_joystick"
-#../joystick_gtforce/ico_ictl-joystick_gtforce -d -l ico_test_joystick 2> ../tests/testlog/joystick_gtforce.log &
-../joystick_gtforce/ico_ictl-joystick_gtforce -d -l > ../tests/testlog/joystick_gtforce.log 2>&1 &
-sleep 1
-
-# 4 Weston/Wayland Envionment
-export XDG_RUNTIME_DIR=/tmp/run-root
-export QT_QPA_PLATFORM=wayland
-export ELM_ENGINE=wayland_egl
-export ECORE_EVAS_ENGINE=wayland_egl
-#export ELM_ENGINE=wayland_shm
-#export ECORE_EVAS_ENGINE=wayland_shm
-export EVAS_FONT_DPI=72
-export ECORE_IMF_MODULE=isf
-export ELM_MODULES="ctxpopup_copypasteUI>entry/api:datetime_input_ctxpopup>datetime/api"
-export ELM_SCALE="0.7"
-export ELM_PROFILE=mobile
-
-# 5 Start Weston
-export XDG_CONFIG_HOME="../tests"
-/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=../tests/testlog/weston.log &
-sleep 1
 
-# 5 Start test-homescreen
-../tests/test-homescreen < ../tests/testdata/hs_alltest.dat 2> ../tests/testlog/test-homescreen.log
+# 4 Start Weston
+/usr/bin/weston --idle-time=0 $WESTON_BACKEND --log=../tests/testlog/weston.log &
+sleep 600
 
-# 6 End of Test
+# 5 End of Test
 sleep 1
 /usr/bin/killall weston
-/usr/bin/killall test-send_event
-/usr/bin/killall test-send_event
-/usr/bin/killall ico_ictl-touch_egalax
-/usr/bin/killall ico_ictl-joystick_gtforce
+/usr/bin/killall ico_uxf_dic-gtforce
 sleep 1
 
 # 9 Check Error
@@ -69,11 +40,11 @@ fi
 if [ "$?" != "1" ] ; then
        FOUND_ERR=1
 fi
-/bin/grep "error" testlog/* | /bin/grep -v "error_but_no_problem_for_test"
+/bin/grep "error" testlog/*
 if [ "$?" != "1" ] ; then
        FOUND_ERR=1
 fi
-/bin/grep "Fail" testlog/* | /bin/grep -v "error_but_no_problem_for_test"
+/bin/grep "Fail" testlog/*
 if [ "$?" != "1" ] ; then
        FOUND_ERR=1
 fi
index f6b877e..6a383f8 100644 (file)
@@ -1,13 +1,27 @@
 /*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright Â© 2012 Intel Corporation
+ * Copyright Â© 2013 TOYOTA MOTOR CORPORATION
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
  *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
  */
 /**
- * @brief   Wayland Application for uint test of Weston(Wayland) IVI plugins
+ * @brief   Wayland Application for unit test of Weston(Wayland) IVI plugins
  *
  * @date    Feb-08-2013
  */
@@ -20,7 +34,6 @@
 #include <poll.h>
 #include <wayland-client.h>
 #include <linux/input.h>
-#include "ico_ivi_shell-client-protocol.h"
 #include "ico_window_mgr-client-protocol.h"
 #include "ico_input_mgr-client-protocol.h"
 #include "test-common.h"
@@ -32,7 +45,6 @@ struct display {
     struct wl_registry *registry;
     struct wl_compositor *compositor;
     struct wl_shell *shell;
-    struct ico_ivi_shell *ico_ivi_shell;
     struct ico_window_mgr *ico_window_mgr;
     struct ico_exinput *ico_exinput;
     struct input *input;
@@ -50,6 +62,7 @@ struct input {
     struct wl_seat *seat;
     struct wl_pointer *pointer;
     struct wl_keyboard *keyboard;
+    struct wl_touch *touch;
     float x, y;
     uint32_t button_mask;
     struct surface *pointer_focus;
@@ -87,8 +100,8 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
     input->pointer_focus = wl_surface_get_user_data(surface);
     input->x = wl_fixed_to_double(x);
     input->y = wl_fixed_to_double(y);
-    print_log("CLIENT: got pointer enter (%d,%d), surface %p",
-              (int)input->x, (int)input->y, surface);
+    print_log("CLIENT: got pointer enter (%d,%d)=(%d,%d), surface %p",
+              x, y, (int)input->x, (int)input->y, surface);
 }
 
 static void
@@ -111,7 +124,8 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
     input->x = wl_fixed_to_double(x);
     input->y = wl_fixed_to_double(y);
 
-    print_log("CLIENT: got pointer motion (%d,%d)", (int)input->x, (int)input->y);
+    print_log("CLIENT: got pointer motion (%d,%d)=(%d,%d)",
+              x, y, (int)input->x, (int)input->y);
 }
 
 static void
@@ -185,6 +199,39 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
     print_log("CLIENT: got keyboard modifier");
 }
 
+static void
+touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+                  struct wl_surface *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+    print_log("CLIENT: got touch down %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+                int32_t id)
+{
+    print_log("CLIENT: got touch up %d", id);
+}
+
+static void
+touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time,
+                    int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+    print_log("CLIENT: got touch motion %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_frame(void *data, struct wl_touch *wl_touch)
+{
+    print_log("CLIENT: got touch frame");
+}
+
+static void
+touch_handle_cancel(void *data, struct wl_touch *wl_touch)
+{
+    print_log("CLIENT: got touch cancel");
+}
+
 static const struct wl_pointer_listener pointer_listener = {
     pointer_handle_enter,
     pointer_handle_leave,
@@ -201,6 +248,14 @@ static const struct wl_keyboard_listener keyboard_listener = {
     keyboard_handle_modifiers,
 };
 
+static const struct wl_touch_listener touch_listener = {
+    touch_handle_down,
+    touch_handle_up,
+    touch_handle_motion,
+    touch_handle_frame,
+    touch_handle_cancel
+};
+
 static void
 seat_handle_capabilities(void *data, struct wl_seat *seat,
                          enum wl_seat_capability caps)
@@ -210,8 +265,7 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
     if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
         input->pointer = wl_seat_get_pointer(seat);
         wl_pointer_set_user_data(input->pointer, input);
-        wl_pointer_add_listener(input->pointer, &pointer_listener,
-                    input);
+        wl_pointer_add_listener(input->pointer, &pointer_listener, input);
     }
     else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
         wl_pointer_destroy(input->pointer);
@@ -221,13 +275,22 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
     if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
         input->keyboard = wl_seat_get_keyboard(seat);
         wl_keyboard_set_user_data(input->keyboard, input);
-        wl_keyboard_add_listener(input->keyboard, &keyboard_listener,
-                     input);
+        wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input);
     }
     else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
         wl_keyboard_destroy(input->keyboard);
         input->keyboard = NULL;
     }
+
+    if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
+        input->touch = wl_seat_get_touch(seat);
+        wl_touch_set_user_data(input->touch, input);
+        wl_touch_add_listener(input->touch, &touch_listener, input);
+    }
+    else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
+        wl_touch_destroy(input->touch);
+        input->touch = NULL;
+    }
 }
 
 static const struct wl_seat_listener seat_listener = {
@@ -241,10 +304,11 @@ output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
 {
     struct output *output = data;
 
+    print_log("CLIENT: Event[handle_geometry] x/y=%d/%d p.w/h=%d/%d trans=%d",
+              x, y, physical_width, physical_height, transform);
+
     output->x = x;
     output->y = y;
-
-    print_log("CLIENT: Output[geometry] x/y=%d/%d,trans=%d", x, y, transform);
 }
 
 static void
@@ -253,10 +317,12 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
 {
     struct output *output = data;
 
+    print_log("CLIENT: Event[handle_mode] %08x x/y=%d/%d flags=%08x refresh=%d",
+              (int)wl_output, width, height, flags, refresh);
+
     if (flags & WL_OUTPUT_MODE_CURRENT) {
         output->width = width;
         output->height = height;
-        print_log("CLIENT: Output[mode] w/h=%d/%d", width, height);
     }
 }
 
@@ -334,15 +400,13 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
     print_log("CLIENT: handle_global: interface=<%s> id=%d", interface, (int)id);
 
     if (strcmp(interface, "wl_compositor") == 0) {
-        display->compositor =
-            wl_registry_bind(display->registry,
-                     id, &wl_compositor_interface, 1);
+        display->compositor = wl_registry_bind(display->registry, id,
+                                               &wl_compositor_interface, 1);
     }
     else if (strcmp(interface, "wl_seat") == 0) {
         input = calloc(1, sizeof *input);
         input->display = display;
-        input->seat = wl_registry_bind(display->registry, id,
-                           &wl_seat_interface, 1);
+        input->seat = wl_registry_bind(display->registry, id, &wl_seat_interface, 1);
         input->pointer_focus = NULL;
         input->keyboard_focus = NULL;
 
@@ -352,8 +416,7 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
     else if (strcmp(interface, "wl_output") == 0) {
         output = malloc(sizeof *output);
         output->display = display;
-        output->output = wl_registry_bind(display->registry,
-                          id, &wl_output_interface, 1);
+        output->output = wl_registry_bind(display->registry, id, &wl_output_interface, 1);
         wl_output_add_listener(output->output,
                        &output_listener, output);
         display->output = output;
@@ -361,27 +424,17 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
         print_log("CLIENT: created output global %p", display->output);
     }
     else if (strcmp(interface, "wl_shell") == 0)    {
-        display->shell =
-            wl_registry_bind(display->registry,
-                     id, &wl_shell_interface, 1);
-    }
-    else if (strcmp(interface, "ico_ivi_shell") == 0)   {
-        display->ico_ivi_shell =
-            wl_registry_bind(display->registry,
-                     id, &ico_ivi_shell_interface, 1);
+        display->shell = wl_registry_bind(display->registry, id, &wl_shell_interface, 1);
     }
     else if (strcmp(interface, "ico_window_mgr") == 0)  {
-        display->ico_window_mgr =
-            wl_registry_bind(display->registry,
-                     id, &ico_window_mgr_interface, 1);
+        display->ico_window_mgr = wl_registry_bind(display->registry, id,
+                                                   &ico_window_mgr_interface, 1);
         print_log("CLIENT: created window_mgr global %p", display->ico_window_mgr);
     }
     else if (strcmp(interface, "ico_exinput") == 0)   {
-        display->ico_exinput =
-            wl_registry_bind(display->registry,
-                             id, &ico_exinput_interface, 1);
-        ico_exinput_add_listener(display->ico_exinput,
-                                 &exinput_listener, display);
+        display->ico_exinput = wl_registry_bind(display->registry, id,
+                                                &ico_exinput_interface, 1);
+        ico_exinput_add_listener(display->ico_exinput, &exinput_listener, display);
         print_log("CLIENT: created exinput global %p", display->ico_exinput);
     }
 }
@@ -468,7 +521,7 @@ send_state(struct display* display)
 }
 
 static void
-create_surface(struct display *display)
+create_surface(struct display *display, const char *title)
 {
     struct surface *surface;
 
@@ -486,6 +539,7 @@ create_surface(struct display *display)
             wl_shell_surface_add_listener(surface->shell_surface,
                                           &shell_surface_listener, display);
             wl_shell_surface_set_toplevel(surface->shell_surface);
+            wl_shell_surface_set_title(surface->shell_surface, title);
         }
     }
     wl_display_flush(display->display);
@@ -503,7 +557,8 @@ create_surface(struct display *display)
         surface->egl_surface = opengl_create_window(display->display, surface->surface,
                                                     surface->dpy, surface->conf,
                                                     surface->ctx, display->init_width,
-                                                    display->init_height, display->init_color);
+                                                    display->init_height,
+                                                    display->init_color);
         clear_surface(display);
         print_log("CLIENT: created egl_surface %08x", (int)surface->egl_surface);
     }
@@ -513,7 +568,7 @@ static void
 clear_surface(struct display *display)
 {
     if (! display->surface) {
-        create_surface(display);
+        create_surface(display, "test-client");
     }
     else    {
         opengl_clear_window(display->init_color);
@@ -522,6 +577,88 @@ clear_surface(struct display *display)
     }
 }
 
+static void
+set_region(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     x, y, width, height;
+    int     hot_x, hot_y;
+    int     c_x, c_y, c_width, c_height;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 5)  {
+        x = strtol(args[1], (char **)0, 0);
+        y = strtol(args[2], (char **)0, 0);
+        width = strtol(args[3], (char **)0, 0);
+        height = strtol(args[4], (char **)0, 0);
+        hot_x = x + (width / 2);
+        hot_y = y + (height / 2);
+        c_x = x + 5;
+        c_y = y + 5;
+        c_width = width - 10;
+        if (c_width <= 0)   c_width = 2;
+        c_height = height - 10;
+        if (c_height <= 0)  c_height = 2;
+        print_log("CLIENT: ico_exinput_set_input_region(%s,%d,%d-%d,%d,"
+                  "hot=%d,%d,cur=%d,%d-%d,%d,attr=0)",
+                  args[0] ? args[0] : "(null)", x, y, width, height,
+                  hot_x, hot_y, c_x, c_y, c_width, c_height);
+        if (strcasecmp(args[0], "NULL") == 0)   {
+            ico_exinput_set_input_region(display->ico_exinput, "", x, y,
+                                         width, height, hot_x, hot_y, c_x, c_y,
+                                         c_width, c_height, 0);
+        }
+        else    {
+            ico_exinput_set_input_region(display->ico_exinput, args[0], x, y,
+                                         width, height, hot_x, hot_y, c_x, c_y,
+                                         c_width, c_height, 0);
+        }
+    }
+    else    {
+        print_log("CLIENT: set_region command[set_region winname@appid x y "
+                  "width height] has no argument");
+    }
+}
+
+static void
+unset_region(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     x, y, width, height;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 1)  {
+        if (narg >= 5) {
+            x = strtol(args[1], (char **)0, 0);
+            y = strtol(args[2], (char **)0, 0);
+            width = strtol(args[3], (char **)0, 0);
+            height = strtol(args[4], (char **)0, 0);
+        }
+        else    {
+            x = 0;
+            y = 0;
+            width = 0;
+            height = 0;
+        }
+        print_log("CLIENT: ico_exinput_unset_input_region(%s,08x,%d,%d-%d,%d)",
+                  args[0] ? args[0] : "(null)", x, y, width, height);
+        if (strcasecmp(args[0], "NULL") == 0)   {
+            ico_exinput_unset_input_region(display->ico_exinput, "", x, y,
+                                           width, height);
+        }
+        else    {
+            ico_exinput_unset_input_region(display->ico_exinput, args[0],
+                                           x, y, width, height);
+        }
+    }
+    else    {
+        print_log("CLIENT: unset_region command[unset_region winname@appid x y "
+                  "width height] has no argument");
+    }
+}
+
 int main(int argc, char *argv[])
 {
     struct display *display;
@@ -577,15 +714,16 @@ int main(int argc, char *argv[])
     wl_registry_add_listener(display->registry,
                  &registry_listener, display);
     wl_display_dispatch(display->display);
+    sleep_with_wayland(display->display, 1000);
 
     fd = 0;
 
     while (1) {
         sleep_with_wayland(display->display, 20);
         if (display->prompt)    {
-            printf("CLIENT: "); fflush(stdout);
+            printf("CLIENT> "); fflush(stdout);
         }
-        ret = getdata(display->ico_window_mgr, "CLIENT: ", fd, buf, sizeof(buf));
+        ret = getdata(display->ico_window_mgr, "CLIENT> ", fd, buf, sizeof(buf));
         if (ret < 0) {
             fprintf(stderr, "CLIENT: read error: fd %d, %m\n",
                 fd);
@@ -601,12 +739,20 @@ int main(int argc, char *argv[])
             break;
         }
         else if (strncasecmp(buf, "create-surface", ret) == 0) {
-            create_surface(display);
+            create_surface(display, "test-client");
         }
         else if (strncasecmp(buf, "clear-surface", 13) == 0) {
             display->init_color = strtoul(&buf[14], (char **)0, 0);
             clear_surface(display);
         }
+        else if (strncasecmp(buf, "set_region", 10) == 0) {
+            /* set input region                 */
+            set_region(display, &buf[10]);
+        }
+        else if (strncasecmp(buf, "unset_region", 12) == 0) {
+            /* unset input region               */
+            unset_region(display, &buf[12]);
+        }
         else if (strncasecmp(buf, "send-state", ret) == 0) {
             send_state(display);
         }
@@ -622,7 +768,7 @@ int main(int argc, char *argv[])
         }
         else {
             print_log("CLIENT: unknown command[%s]", buf);
-            return(-1);
+            return -1;
         }
     }
     if (postsec > 0)    {
index 5b83995..a85d765 100644 (file)
@@ -1,10 +1,23 @@
 /*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright Â© 2013 TOYOTA MOTOR CORPORATION
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
  *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
  */
 /**
  * @brief   Uint test common routines
@@ -22,7 +35,7 @@
 #include <time.h>
 #include <errno.h>
 #include <wayland-client.h>
-#include <ico_window_mgr-client-protocol.h>
+#include "ico_window_mgr-client-protocol.h"
 #include "test-common.h"
 
 /*--------------------------------------------------------------------------*/
@@ -50,7 +63,7 @@ getdata(void *window_mgr, const char *prompt, int fd, char *buf, const int size)
         ret = read(fd, &buf[i], 1);
 
         if (ret < 0)    {
-            return(ret);
+            return ret;
         }
 
         if ((buf[i] == '\n') || (buf[i] == '\r'))   break;
@@ -81,7 +94,7 @@ getdata(void *window_mgr, const char *prompt, int fd, char *buf, const int size)
         strcpy( buf, &buf[j] );
         i -= j;
     }
-    return(i);
+    return i;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -112,15 +125,66 @@ print_log(const char *fmt, ...)
         sTimeZone = timezone;
     }
     NowTime.tv_sec -= sTimeZone;
-    fprintf(stderr, "[%02d:%02d:%02d.%03d@%d] %s\n",
-            (int)((NowTime.tv_sec/3600) % 24),
-            (int)((NowTime.tv_sec/60) % 60),
-            (int)(NowTime.tv_sec % 60),
+    fprintf(stderr, "[%02d:%02d:%02d.%03d@%d] %s\n", (int)((NowTime.tv_sec/3600) % 24),
+            (int)((NowTime.tv_sec/60) % 60), (int)(NowTime.tv_sec % 60),
             (int)NowTime.tv_usec/1000, getpid(), log);
 }
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   skip_spaces: skip spaces in command input
+ *
+ * @param[in]   buf         input command string
+ * @return      character pointer of not space character
+ */
+/*--------------------------------------------------------------------------*/
+char *
+skip_spaces(char *buf)
+{
+    while ((*buf == ' ') || (*buf == '\t')) {
+        buf++;
+    }
+    return buf;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   pars_command: The word division of the command line
+ *
+ * @param[in]   buf         input command string
+ * @param[in]   pt          word pointers (maximum len words)
+ * @param[in]   len         maximum number of words
+ * @return      number of words
+ */
+/*--------------------------------------------------------------------------*/
+int
+pars_command(char *buf, char *pt[], const int len)
+{
+    char    *p;
+    int     narg;
+
+    memset(pt, 0, sizeof(int *)*10);
+    p = buf;
+    for (narg = 0; narg < len; narg++)  {
+        p = skip_spaces(p);
+        if (*p == 0)    break;
+        pt[narg] = p;
+        for (; *p; p++) {
+            if ((*p == ' ') || (*p == '\t') ||
+                (*p == '=') || (*p == ',')) break;
+        }
+        if (*p == 0)    {
+            narg++;
+            break;
+        }
+        *p = 0;
+        p++;
+    }
+    return narg;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   wayland_dispatch_nonblock: Read from wayland if receive data exist
  *
  * @param[in]   display     Wayland connection
@@ -203,15 +267,16 @@ wait_with_wayland(struct wl_display *display, int msec, int *endflag)
     fd = wl_display_get_fd(display);
 
     do  {
-        /* Flush send data          */
-        wl_display_flush(display);
-
         /* Check wayland input      */
-        nread = 0;
-        if (ioctl(fd, FIONREAD, &nread) < 0)    {
+        while(1)    {
+            /* Flush send data          */
+            wl_display_flush(display);
+
             nread = 0;
-        }
-        if (nread >= 8) {
+            if (ioctl(fd, FIONREAD, &nread) < 0)    {
+                nread = 0;
+            }
+            if (nread < 8)  break;
             /* Read event from wayland  */
             wl_display_dispatch(display);
         }
@@ -250,7 +315,7 @@ sec_str_2_value(const char *ssec)
         if (n == 2)     msec *= 10;
         sec += msec;
     }
-    return(sec);
+    return sec;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -319,7 +384,7 @@ opengl_init(struct wl_display *display, EGLConfig *rconf, EGLContext *rctx)
 
     wayland_dispatch_nonblock(display);
 
-    return(dpy);
+    return dpy;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -363,7 +428,7 @@ opengl_create_window(struct wl_display *display, struct wl_surface *surface,
 
     opengl_swap_buffer(display, dpy, egl_surface);
 
-    return(egl_surface);
+    return egl_surface;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -394,7 +459,7 @@ opengl_clear_window(const unsigned int color)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   opengl_create_window: Create OpenGL/EGL window
+ * @brief   opengl_swap_buffer: Swap OpenGL/EGL buffer
  *
  * @param[in]   display     Wayland connection
  * @param[in]   dpy         EGL display
@@ -409,3 +474,4 @@ opengl_swap_buffer(struct wl_display *display, EGLDisplay dpy, EGLSurface egl_su
 
     wayland_dispatch_nonblock(display);
 }
+
index a17e3ad..9e646e0 100644 (file)
@@ -1,10 +1,23 @@
 /*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright Â© 2013 TOYOTA MOTOR CORPORATION
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
  *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
  */
 /**
  * @brief   Header file for uint test common routines
@@ -24,6 +37,8 @@
 /* Function prototype           */
 int getdata(void *window_mgr, const char *prompt, int fd, char *buf, const int size);
 void print_log(const char *fmt, ...);
+char *skip_spaces(char *buf);
+int pars_command(char *buf, char *pt[], const int len);
 void wayland_dispatch_nonblock(struct wl_display *display);
 void sleep_with_wayland(struct wl_display *display, int msec);
 void wait_with_wayland(struct wl_display *display, int msec, int *endflag);
@@ -34,5 +49,9 @@ EGLSurface opengl_create_window(struct wl_display *display, struct wl_surface *s
                                 const int width, const int height, const int color);
 void opengl_clear_window(const unsigned int color);
 void opengl_swap_buffer(struct wl_display *display, EGLDisplay dpy, EGLSurface egl_surface);
+void opengl_thumbnail(struct wl_display *display, uint32_t surfaceid, EGLDisplay dpy,
+                      EGLConfig conf, EGLSurface egl_surface, EGLContext ctx, uint32_t name,
+                      int width, int height, int stride, uint32_t format);
 
 #endif /*_TEST_COMMON_H_*/
+
index bb761a3..1e2949e 100644 (file)
@@ -1,13 +1,27 @@
 /*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright Â© 2012 Intel Corporation
+ * Copyright Â© 2013 TOYOTA MOTOR CORPORATION
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
  *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
  */
 /**
- * @brief   HomeScreen for uint test of Weston(Wayland) IVI plugins
+ * @brief   HomeScreen for unit test of Weston(Wayland) IVI plugins
  *
  * @date    Feb-08-2013
  */
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <signal.h>
+#include <fcntl.h>
 #include <linux/input.h>
 #include <wayland-client.h>
-#include "ico_ivi_shell-client-protocol.h"
 #include "ico_window_mgr-client-protocol.h"
 #include "ico_input_mgr-client-protocol.h"
+#include "ico_input_mgr.h"
 #include "test-common.h"
 
 #define MAX_APPID   128
-#define ICO_IVI_MAX_COORDINATE  16383
+#define SHM_SIZE    (16*1024*1024)
+#define MAX_CON_NAME    127
+#define MAX_OUTPUT      8
 
 struct surface_name {
     struct surface_name *next;
     int     surfaceid;
     int     pid;
     char    appid[MAX_APPID];
+    int     node;
     int     x;
     int     y;
     int     width;
@@ -48,20 +67,18 @@ struct surface_name {
     int     visible;
 };
 
-#define MAX_CON_NAME    127
-
 struct display {
     struct wl_display *display;
     struct wl_registry *registry;
     struct wl_compositor *compositor;
     struct wl_shell *shell;
-    struct ico_ivi_shell *ico_ivi_shell;
     struct ico_window_mgr *ico_window_mgr;
     struct ico_input_mgr_control *ico_input_mgr;
     struct ico_input_mgr_device *ico_input_device;
     struct ico_exinput *ico_exinput;
     struct input *input;
-    struct output *output;
+    int    num_output;
+    struct output *output[MAX_OUTPUT];
     struct surface *surface;
     struct surface_name *surface_name;
     struct surface_name *bgsurface_name;
@@ -81,6 +98,7 @@ struct input {
     struct wl_seat *seat;
     struct wl_pointer *pointer;
     struct wl_keyboard *keyboard;
+    struct wl_touch *touch;
     float x, y;
     uint32_t button_mask;
     struct surface *pointer_focus;
@@ -216,6 +234,39 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
     print_log("HOMESCREEN: got keyboard modifier");
 }
 
+static void
+touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+                  struct wl_surface *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+    print_log("HOMESCREEN: got touch down %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time,
+                int32_t id)
+{
+    print_log("HOMESCREEN: got touch up %d", id);
+}
+
+static void
+touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time,
+                    int32_t id, wl_fixed_t x, wl_fixed_t y)
+{
+    print_log("HOMESCREEN: got touch motion %d (%d,%d)", id, x/256, y/256);
+}
+
+static void
+touch_handle_frame(void *data, struct wl_touch *wl_touch)
+{
+    print_log("HOMESCREEN: got touch frame");
+}
+
+static void
+touch_handle_cancel(void *data, struct wl_touch *wl_touch)
+{
+    print_log("HOMESCREEN: got touch cancel");
+}
+
 static const struct wl_pointer_listener pointer_listener = {
     pointer_handle_enter,
     pointer_handle_leave,
@@ -232,33 +283,57 @@ static const struct wl_keyboard_listener keyboard_listener = {
     keyboard_handle_modifiers,
 };
 
+static const struct wl_touch_listener touch_listener = {
+    touch_handle_down,
+    touch_handle_up,
+    touch_handle_motion,
+    touch_handle_frame,
+    touch_handle_cancel
+};
+
 static void
 seat_handle_capabilities(void *data, struct wl_seat *seat,
                          enum wl_seat_capability caps)
 {
     struct input *input = data;
 
+    print_log("HOMESCREEN: seat_handle_capabilities caps=%x", caps);
+
     if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
         input->pointer = wl_seat_get_pointer(seat);
+        print_log("HOMESCREEN: seat_handle_capabilities add pointer=%x", (int)input->pointer);
         wl_pointer_set_user_data(input->pointer, input);
-        wl_pointer_add_listener(input->pointer, &pointer_listener,
-                    input);
+        wl_pointer_add_listener(input->pointer, &pointer_listener, input);
     }
     else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
+        print_log("HOMESCREEN: seat_handle_capabilities delete pointer");
         wl_pointer_destroy(input->pointer);
         input->pointer = NULL;
     }
 
     if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
         input->keyboard = wl_seat_get_keyboard(seat);
+        print_log("HOMESCREEN: seat_handle_capabilities add keyboard=%x", (int)input->keyboard);
         wl_keyboard_set_user_data(input->keyboard, input);
-        wl_keyboard_add_listener(input->keyboard, &keyboard_listener,
-                     input);
+        wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input);
     }
     else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
+        print_log("HOMESCREEN: seat_handle_capabilities delete keyboard");
         wl_keyboard_destroy(input->keyboard);
         input->keyboard = NULL;
     }
+
+    if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
+        input->touch = wl_seat_get_touch(seat);
+        print_log("HOMESCREEN: seat_handle_capabilities add touch=%x", (int)input->touch);
+        wl_touch_set_user_data(input->touch, input);
+        wl_touch_add_listener(input->touch, &touch_listener, input);
+    }
+    else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
+        print_log("HOMESCREEN: seat_handle_capabilities delete touch");
+        wl_touch_destroy(input->touch);
+        input->touch = NULL;
+    }
 }
 
 static const struct wl_seat_listener seat_listener = {
@@ -292,7 +367,7 @@ static const struct wl_surface_listener surface_listener = {
 };
 
 static void
-create_surface(struct display *display)
+create_surface(struct display *display, const char *title)
 {
     struct surface *surface;
     int id;
@@ -309,6 +384,7 @@ create_surface(struct display *display)
             wl_shell_get_shell_surface(display->shell, surface->surface);
         if (surface->shell_surface) {
             wl_shell_surface_set_toplevel(surface->shell_surface);
+            wl_shell_surface_set_title(surface->shell_surface, title);
         }
     }
     wl_display_flush(display->display);
@@ -325,7 +401,8 @@ create_surface(struct display *display)
         surface->egl_surface = opengl_create_window(display->display, surface->surface,
                                                     surface->dpy, surface->conf,
                                                     surface->ctx, display->init_width,
-                                                    display->init_height, display->init_color);
+                                                    display->init_height,
+                                                    display->init_color);
         clear_surface(display);
         print_log("HOMESCREEN: created egl_surface %08x", (int)surface->egl_surface);
     }
@@ -335,7 +412,7 @@ static void
 clear_surface(struct display *display)
 {
     if (! display->surface) {
-        create_surface(display);
+        create_surface(display, "HomeScreen-BG");
     }
     else    {
         opengl_clear_window(display->init_color);
@@ -351,6 +428,9 @@ output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
 {
     struct output *output = data;
 
+    print_log("HOMESCREEN: Event[handle_geometry] %08x x/y=%d/%d p.w/h=%d/%d trans=%d",
+              (int)wl_output, x, y, physical_width, physical_height, transform);
+
     output->x = x;
     output->y = y;
 }
@@ -361,26 +441,26 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
 {
     struct output *output = data;
 
+    print_log("HOMESCREEN: Event[handle_mode] %08x x/y=%d/%d flags=%08x refresh=%d",
+              (int)wl_output, width, height, flags, refresh);
+
     if (flags & WL_OUTPUT_MODE_CURRENT) {
         struct display  *display = output->display;
 
         output->width = width;
         output->height = height;
 
-        print_log("HOMESCREEN: Event[handle_mode] x/y=%d/%d bgsurf=%08x",
-                  width, height, (int)display->bgsurface_name);
-
         display->init_width = width;
         display->init_height = height;
 
         if (display->bgsurface_name)    {
             ico_window_mgr_set_positionsize(display->ico_window_mgr,
                                             display->bgsurface_name->surfaceid,
-                                            0, 0, width, height);
+                                            0, 0, 0, 0, width, height);
         }
         else if (display->bg_created == 0)  {
             display->bg_created = 9;
-            create_surface(output->display);
+            create_surface(display, "HomeScreen-BG");
         }
     }
 }
@@ -402,10 +482,14 @@ search_surface(struct display *display, const char *surfname)
     }
 
     if (p)  {
-        return(p->surfaceid);
+        return p->surfaceid;
     }
     else    {
-        return(-1);
+        if ((strcasecmp(surfname, "all") == 0) ||
+            (strcasecmp(surfname, "main") == 0))    {
+            return ICO_WINDOW_MGR_V_MAINSURFACE;
+        }
+        return -1;
     }
 }
 
@@ -419,7 +503,10 @@ search_surfacename(struct display *display, const char *surfname)
         if (strcmp(p->appid, surfname) == 0)    break;
         p = p->next;
     }
-    return(p);
+    if (! p)    {
+        print_log("HOMESCREEN: app(%s) dose not exist", surfname);
+    }
+    return p;
 }
 
 static struct surface_name *
@@ -430,16 +517,16 @@ search_surfaceid(struct display *display, const int surfaceid)
     p = display->surface_name;
     while (p)   {
         if (p->surfaceid == surfaceid)  {
-            return(p);
+            return p;
         }
         p = p->next;
     }
-    return(NULL);
+    return NULL;
 }
 
 static void
 window_created(void *data, struct ico_window_mgr *ico_window_mgr,
-               uint32_t surfaceid, int32_t pid, const char *appid)
+               uint32_t surfaceid, const char *winname, int32_t pid, const char *appid)
 {
     struct display *display = data;
     struct surface_name     *p;
@@ -454,12 +541,12 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
         p = p->next;
     }
     if (p)  {
-        print_log("HOMESCREEN: Event[window_created] surface=%08x(app=%s) exist",
-                  (int)surfaceid, appid);
+        print_log("HOMESCREEN: Event[window_created] surface=%08x(app=%s,name=%s) exist",
+                  (int)surfaceid, appid, winname);
     }
     else    {
-        print_log("HOMESCREEN: Event[window_created] new surface=%08x(app=%s)",
-                  (int)surfaceid, appid);
+        print_log("HOMESCREEN: Event[window_created] new surface=%08x(app=%s) winname=%s",
+                  (int)surfaceid, appid, winname);
         p = malloc(sizeof(struct surface_name));
         if (! p)    {
             return;
@@ -479,7 +566,7 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
     /* Set default size and show        */
     if (p->width > 0)   {
         ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
-                                    p->x, p->y, p->width, p->height);
+                                        0, p->x, p->y, p->width, p->height, 0);
     }
 
     print_log("HOMESCREEN: Created window[%08x] (app=%s)", (int)surfaceid, appid);
@@ -489,9 +576,10 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
         if (display->bg_created == 1)   {
             display->bg_created = 9;
             ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
-                                            0, 0, display->init_width, display->init_height);
+                                            0, 0, 0,
+                                            display->init_width, display->init_height, 0);
         }
-        ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 0);
+        ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 0, 0);
         print_log("HOMESCREEN: Created window[%08x] (app=%s) Visible",
                   (int)surfaceid, appid);
         p->visible = 1;
@@ -499,6 +587,13 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr,
 }
 
 static void
+window_name(void *data, struct ico_window_mgr *ico_window_mgr,
+            uint32_t surfaceid, const char *winname)
+{
+    print_log("HOMESCREEN: Window Name[%08x] (name=%s)", (int)surfaceid, winname);
+}
+
+static void
 window_destroyed(void *data, struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid)
 {
     struct display *display = data;
@@ -544,54 +639,111 @@ window_visible(void *data, struct ico_window_mgr *ico_window_mgr,
     }
     else    {
         print_log("HOMESCREEN: Event[window_visible] surface=%08x "
-                  "visible=%d raise=%d hint=%d",
-                  (int)surfaceid, visible, raise, hint);
+                  "visible=%d raise=%d hint=%d", (int)surfaceid, visible, raise, hint);
         p->visible = visible;
-        if (hint == 0)  {
-            ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, visible, 9);
+        if (hint == 1)  {
+            ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+                                       visible, ICO_WINDOW_MGR_V_NOCHANGE, 0);
         }
     }
 }
 
 static void
 window_configure(void *data, struct ico_window_mgr *ico_window_mgr,
-                 uint32_t surfaceid, const char *appid, int32_t layer,
+                 uint32_t surfaceid, uint32_t node, uint32_t layer,
                  int32_t x, int32_t y, int32_t width, int32_t height, int32_t hint)
 {
     struct display *display = data;
     struct surface_name     *p;
 
     print_log("HOMESCREEN: Event[window_configure] surface=%08x "
-              "app=%s x/y=%d/%d w/h=%d/%d hint=%d",
-              (int)surfaceid, appid, x, y, width, height, hint);
+              "node=%x x/y=%d/%d w/h=%d/%d hint=%d",
+              (int)surfaceid, node, x, y, width, height, hint);
 
     p = search_surfaceid(display, (int)surfaceid);
     if (! p)    {
-        print_log("HOMESCREEN: Event[window_configure] surface=%08x(app=%s) new create",
-                  (int)surfaceid, appid);
-        window_created(data, ico_window_mgr, surfaceid, 0, appid);
-        p = search_surfaceid(display, (int)surfaceid);
-        if (! p)    {
-            print_log("HOMESCREEN: Event[window_configure] can not make table");
-            return;
-        }
+        print_log("HOMESCREEN: Event[window_configure] surface=%08x dose not exist",
+                  (int)surfaceid);
+    }
+    else    {
+        p->node = node;
     }
 }
 
 static void
+window_layer_visible(void *data, struct ico_window_mgr *ico_window_mgr,
+                     uint32_t layer, int32_t visible)
+{
+    print_log("HOMESCREEN: Event[layer_visible]layer=%x visible=%d",
+              (int)layer, visible);
+}
+
+static void
 window_active(void *data, struct ico_window_mgr *ico_window_mgr,
-              uint32_t surfaceid, const uint32_t active)
+              uint32_t surfaceid, const int32_t active)
 {
     print_log("HOMESCREEN: Event[window_active] surface=%08x acive=%d",
               (int)surfaceid, (int)active);
+    if ((surfaceid & 0x0000ffff) == 0x0001) {
+        ico_window_mgr_set_visible(ico_window_mgr, surfaceid,
+                                   ICO_WINDOW_MGR_V_NOCHANGE, 0, 0);
+    }
+}
+
+static void
+window_surfaces(void *data, struct ico_window_mgr *ico_window_mgr,
+                const char *appid, struct wl_array *surfaces)
+{
+    print_log("HOMESCREEN: Event[app_surfaces] app=%s", appid);
+}
+
+static void
+window_map(void *data, struct ico_window_mgr *ico_window_mgr,
+           int32_t event, uint32_t surfaceid, uint32_t type, uint32_t target,
+           int32_t width, int32_t height, int32_t stride, uint32_t format)
+{
+#if 0
+    struct display *display = data;
+#endif
+    char    sevt[16];
+
+    switch (event)  {
+    case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS:
+        strcpy(sevt, "Contents");   break;
+    case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE:
+        strcpy(sevt, "Resize"); break;
+    case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP:
+        strcpy(sevt, "Map");    break;
+    case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP:
+        strcpy(sevt, "Unmap");  break;
+    case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR:
+        sprintf(sevt, "Error %d", type);  break;
+    default:
+        sprintf(sevt, "??%d??", event); break;
+    }
+    print_log("HOMESCREEN: Event[map_surface] ev=%s(%d) surf=%08x type=%d target=%x "
+              "w/h/s/f=%d/%d/%d/%x",
+              sevt, event, (int)surfaceid, type, target, width, height, stride, format);
+#if 0
+    if ((event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP) ||
+        (event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS))   {
+        opengl_thumbnail(display->display, surfaceid, display->surface->dpy,
+                         display->surface->conf, display->surface->egl_surface,
+                         display->surface->ctx, target, width, height, stride, format);
+    }
+#endif
 }
 
 static const struct ico_window_mgr_listener window_mgr_listener = {
     window_created,
+    window_name,
     window_destroyed,
     window_visible,
     window_configure,
-    window_active
+    window_active,
+    window_layer_visible,
+    window_surfaces,
+    window_map
 };
 
 static void
@@ -626,6 +778,56 @@ static const struct ico_exinput_listener exinput_listener = {
 };
 
 static void
+cb_input_regions(void *data, struct ico_input_mgr_device *ico_input_mgr_device,
+                 struct wl_array *regions)
+{
+    struct ico_uifw_input_region    *region;
+    int     n;
+    char    schange[16];
+
+    n = 0;
+    if (regions)    {
+        wl_array_for_each(region, regions)  {
+            n ++;
+            print_log("HOMESCREEN: Event[input_regions] number of regions=%d", n);
+        }
+        n = 0;
+        wl_array_for_each(region, regions)  {
+            n ++;
+            switch (region->change) {
+            case ICO_INPUT_MGR_DEVICE_REGION_ADD:
+                strcpy(schange, "Add");
+                break;
+            case ICO_INPUT_MGR_DEVICE_REGION_REMOVE:
+                strcpy(schange, "Remove");
+                break;
+            case ICO_INPUT_MGR_DEVICE_REGION_REMOVEALL:
+                strcpy(schange, "RemoveAll");
+                break;
+            default:
+                sprintf(schange, "?%d?", region->change);
+                break;
+            }
+            print_log("HOMESCREEN:%2d. %s %d.%08(%d/%d) &d/%d-%d/%d "
+                      "hot=%d/%d cur=%d/%d-%d/%d attr=%x",
+                      n, schange, region->node, region->surfaceid, region->surface_x,
+                      region->surface_y, region->x, region->y, region->width,
+                      region->height, region->hotspot_x, region->hotspot_y,
+                      region->cursor_x, region->cursor_y, region->cursor_width,
+                      region->cursor_height, region->attr);
+        }
+    }
+    else    {
+        print_log("HOMESCREEN: Event[input_regions] no region");
+    }
+}
+
+static const struct ico_input_mgr_device_listener device_listener = {
+    cb_input_regions
+};
+
+
+static void
 handle_global(void *data, struct wl_registry *registry, uint32_t id,
               const char *interface, uint32_t version)
 {
@@ -637,14 +839,12 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
 
     if (strcmp(interface, "wl_compositor") == 0) {
         display->compositor =
-            wl_registry_bind(display->registry,
-                     id, &wl_compositor_interface, 1);
+            wl_registry_bind(display->registry, id, &wl_compositor_interface, 1);
     }
     else if (strcmp(interface, "wl_seat") == 0) {
         input = calloc(1, sizeof *input);
         input->display = display;
-        input->seat = wl_registry_bind(display->registry, id,
-                           &wl_seat_interface, 1);
+        input->seat = wl_registry_bind(display->registry, id, &wl_seat_interface, 1);
         input->pointer_focus = NULL;
         input->keyboard_focus = NULL;
 
@@ -652,60 +852,52 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id,
         display->input = input;
     }
     else if (strcmp(interface, "wl_output") == 0) {
-        output = malloc(sizeof *output);
-        output->display = display;
-        output->output = wl_registry_bind(display->registry,
-                          id, &wl_output_interface, 1);
-        wl_output_add_listener(output->output,
-                       &output_listener, output);
-        display->output = output;
+        if (display->num_output < MAX_OUTPUT)   {
+            output = malloc(sizeof *output);
+            output->display = display;
+            output->output = wl_registry_bind(display->registry, id, &wl_output_interface, 1);
+            wl_output_add_listener(output->output, &output_listener, output);
+            display->output[display->num_output] = output;
 
-        print_log("HOMESCREEN: created output global %p", display->output);
+            print_log("HOMESCREEN: created output[%d] global %p",
+                      display->num_output, display->output[display->num_output]);
+            display->num_output ++;
+        }
     }
     else if (strcmp(interface, "wl_shell") == 0)    {
         display->shell =
-            wl_registry_bind(display->registry,
-                     id, &wl_shell_interface, 1);
-    }
-    else if (strcmp(interface, "ico_ivi_shell") == 0)   {
-        display->ico_ivi_shell =
-            wl_registry_bind(display->registry,
-                     id, &ico_ivi_shell_interface, 1);
+            wl_registry_bind(display->registry, id, &wl_shell_interface, 1);
     }
     else if (strcmp(interface, "ico_window_mgr") == 0)  {
         display->ico_window_mgr =
-            wl_registry_bind(display->registry,
-                     id, &ico_window_mgr_interface, 1);
-        ico_window_mgr_add_listener(display->ico_window_mgr,
-                                    &window_mgr_listener, display);
+            wl_registry_bind(display->registry, id, &ico_window_mgr_interface, 1);
+        ico_window_mgr_add_listener(display->ico_window_mgr, &window_mgr_listener, display);
         print_log("HOMESCREEN: created window_mgr global %p", display->ico_window_mgr);
 
-        ico_window_mgr_set_eventcb(display->ico_window_mgr, 1);
+        ico_window_mgr_declare_manager(display->ico_window_mgr, 1);
     }
     else if (strcmp(interface, "ico_input_mgr_control") == 0)   {
-        display->ico_input_mgr =
-            wl_registry_bind(display->registry,
-                             id, &ico_input_mgr_control_interface, 1);
+        display->ico_input_mgr = wl_registry_bind(display->registry, id,
+                                                  &ico_input_mgr_control_interface, 1);
         print_log("HOMESCREEN: created input_mgr global %p", display->ico_input_mgr);
     }
     else if (strcmp(interface, "ico_input_mgr_device") == 0)   {
-        display->ico_input_device =
-            wl_registry_bind(display->registry,
-                             id, &ico_input_mgr_device_interface, 1);
+        display->ico_input_device = wl_registry_bind(display->registry, id,
+                                                     &ico_input_mgr_device_interface, 1);
+        ico_input_mgr_device_add_listener(display->ico_input_device,
+                                          &device_listener, display);
         print_log("HOMESCREEN: created input_device global %p", display->ico_input_device);
     }
     else if (strcmp(interface, "ico_exinput") == 0)   {
         display->ico_exinput =
-            wl_registry_bind(display->registry,
-                             id, &ico_exinput_interface, 1);
-        ico_exinput_add_listener(display->ico_exinput,
-                                 &exinput_listener, display);
+            wl_registry_bind(display->registry, id, &ico_exinput_interface, 1);
+        ico_exinput_add_listener(display->ico_exinput, &exinput_listener, display);
         print_log("HOMESCREEN: created exinput global %p", display->ico_exinput);
 
-        ico_window_mgr_set_eventcb(display->ico_window_mgr, 1);
+        ico_window_mgr_declare_manager(display->ico_window_mgr, 1);
 
         display->bg_created = 1;
-        create_surface(display);
+        create_surface(display, "HomeScreen-BG");
     }
 }
 
@@ -713,41 +905,6 @@ static const struct wl_registry_listener registry_listener = {
     handle_global
 };
 
-static char *
-skip_spaces(char *buf)
-{
-    while ((*buf == ' ') || (*buf == '\t')) {
-        buf++;
-    }
-    return(buf);
-}
-
-static int
-pars_command(char *buf, char *pt[], const int len)
-{
-    char    *p;
-    int     narg;
-
-    memset(pt, 0, sizeof(int *)*10);
-    p = buf;
-    for (narg = 0; narg < len; narg++)  {
-        p = skip_spaces(p);
-        if (*p == 0)    break;
-        pt[narg] = p;
-        for (; *p; p++) {
-            if ((*p == ' ') || (*p == '\t') ||
-                (*p == '=') || (*p == ',')) break;
-        }
-        if (*p == 0)    {
-            narg++;
-            break;
-        }
-        *p = 0;
-        p++;
-    }
-    return (narg);
-}
-
 static void
 launch_app(struct display *display, char *buf)
 {
@@ -775,7 +932,10 @@ kill_app(struct display *display, char *buf)
     narg = pars_command(buf, args, 10);
     if (narg >= 1)  {
         p = search_surfacename(display, args[0]);
-        if (kill(p->pid, SIGINT) < 0)   {
+        if (! p)    {
+            print_log("HOMESCREEN: kill[%s] Application dose not exist", args[0]);
+        }
+        else if (kill(p->pid, SIGINT) < 0)   {
             print_log("HOMESCREEN: kill[%s.%d] Application dose not exist",
                       p->appid, p->pid);
         }
@@ -843,31 +1003,46 @@ static void
 positionsize_surface(struct display *display, char *buf)
 {
     char    *args[10];
+    struct surface_name     *p;
     int     narg;
     int     surfaceid;
     int     x, y, width, height;
+    int     anima = 0;
+    int     node = 0;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 5)  {
         surfaceid = search_surface(display, args[0]);
+        p = search_surfacename(display, args[0]);
         x = strtol(args[1], (char **)0, 0);
         y = strtol(args[2], (char **)0, 0);
         width = strtol(args[3], (char **)0, 0);
         height = strtol(args[4], (char **)0, 0);
+        if (narg >= 6)  {
+            node = strtol(args[5], (char **)0, 0);
+            if (p)  {
+                p->node = node;
+            }
+        }
+        else if (p) {
+            node = p->node;
+        }
+        if (narg >= 7)  {
+            anima = strtol(args[6], (char **)0, 0);
+        }
         if ((surfaceid >= 0) && (x >= 0) && (y >=0) && (width >= 0) && (height >=0))    {
-            print_log("HOMESCREEN: set_positionsize(%s,%08x,%d,%d,%d,%d)",
-                args[0], surfaceid, x, y, width, height);
+            print_log("HOMESCREEN: set_positionsize(%s,%08x,%d,%d,%d,%d,%d)",
+                      args[0], surfaceid, node, x, y, width, height);
             ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
-                                            x, y, width, height);
+                                            node, x, y, width, height, anima);
         }
         else    {
-            print_log("HOMESCREEN: Unknown surface(%s) at positionsize command",
-                      args[0]);
+            print_log("HOMESCREEN: Unknown surface(%s) at positionsize command", args[0]);
         }
     }
     else    {
         print_log("HOMESCREEN: positionsize command"
-                  "[positionsize appid x y width heigh] has no argument");
+                  "[positionsize appid x y width heigh node anima] has no argument");
     }
 }
 
@@ -875,27 +1050,48 @@ static void
 move_surface(struct display *display, char *buf)
 {
     char    *args[10];
+    struct surface_name     *p;
     int     narg;
     int     surfaceid;
     int     x, y;
+    int     anima = 0;
+    int     node = 0;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 3)  {
         surfaceid = search_surface(display, args[0]);
+        p = search_surfacename(display, args[0]);
         x = strtol(args[1], (char **)0, 0);
         y = strtol(args[2], (char **)0, 0);
+        if (narg >= 4)  {
+            node = strtol(args[3], (char **)0, 0);
+            if (node < 0)   {
+                if (p)  node = p->node;
+                else    node = 0;
+            }
+            if (p)  p->node = node;
+        }
+        else if (p) {
+            node = p->node;
+        }
+        if (narg >= 5)  {
+            anima = strtol(args[4], (char **)0, 0);
+        }
+
         if ((surfaceid >= 0) && (x >= 0) && (y >=0))    {
-            print_log("HOMESCREEN: move(%s,%08x,%d,%d)", args[0], surfaceid, x, y);
+            print_log("HOMESCREEN: move(%s,%08x,%d.%d,%d anima=%d)", args[0], surfaceid,
+                      node, x, y, anima);
             ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
-                                            x, y,
-                                            ICO_IVI_MAX_COORDINATE+1, ICO_IVI_MAX_COORDINATE+1);
+                                            node, x, y,
+                                            ICO_WINDOW_MGR_V_NOCHANGE,
+                                            ICO_WINDOW_MGR_V_NOCHANGE, anima);
         }
         else    {
             print_log("HOMESCREEN: Unknown surface(%s) at move command", args[0]);
         }
     }
     else    {
-        print_log("HOMESCREEN: move command[positionsize appid x y] has no argument");
+        print_log("HOMESCREEN: move command[positionsize appid x y node anima] has no argument");
     }
 }
 
@@ -903,20 +1099,32 @@ static void
 resize_surface(struct display *display, char *buf)
 {
     char    *args[10];
+    struct surface_name     *p;
     int     narg;
     int     surfaceid;
     int     width, height;
+    int     anima = 0;
+    int     node = 0;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 3)  {
         surfaceid = search_surface(display, args[0]);
+        p = search_surfacename(display, args[0]);
+        if (p)  {
+            node = p->node;
+        }
         width = strtol(args[1], (char **)0, 0);
         height = strtol(args[2], (char **)0, 0);
+        if (narg >= 4)  {
+            anima = strtol(args[3], (char **)0, 0);
+        }
+
         if ((surfaceid >= 0) && (width >= 0) && (height >=0))   {
-            print_log("HOMESCREEN: resize(%s,%08x,%d,%d)", args[0], surfaceid, width, height);
+            print_log("HOMESCREEN: resize(%s,%08x,%d.%d,%d,anima=%d)",
+                      args[0], surfaceid, node, width, height, anima);
             ico_window_mgr_set_positionsize(display->ico_window_mgr, surfaceid,
-                                            ICO_IVI_MAX_COORDINATE+1, ICO_IVI_MAX_COORDINATE+1,
-                                            width, height);
+                                            node, ICO_WINDOW_MGR_V_NOCHANGE,
+                                            ICO_WINDOW_MGR_V_NOCHANGE, width, height, anima);
         }
         else    {
             print_log("HOMESCREEN: Unknown surface(%s) at resize command", args[0]);
@@ -924,7 +1132,7 @@ resize_surface(struct display *display, char *buf)
     }
     else    {
         print_log("HOMESCREEN: positionsize command"
-                  "[resize appid width heigh] has no argument");
+                  "[resize appid width heigh anima] has no argument");
     }
 }
 
@@ -936,24 +1144,29 @@ visible_surface(struct display *display, char *buf)
     int     surfaceid;
     int     visible;
     int     raise;
+    int     anima = 0;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 3)  {
         surfaceid = search_surface(display, args[0]);
         visible = strtol(args[1], (char **)0, 0);
         raise = strtol(args[2], (char **)0, 0);
+        if (narg >= 4)  {
+            anima = strtol(args[3], (char **)0, 0);
+        }
         if ((surfaceid >= 0) && (visible >= 0) && (raise >=0))  {
-            print_log("HOMESCREEN: visible(%s,%08x,%d,%d)",
-                      args[0], surfaceid, visible, raise);
+            print_log("HOMESCREEN: visible(%s,%08x,%d,%d,%d)",
+                      args[0], surfaceid, visible, raise, anima);
             ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
-                                       visible, raise);
+                                       visible, raise, anima);
         }
         else    {
             print_log("HOMESCREEN: Unknown surface(%s) at visible command", args[0]);
         }
     }
     else    {
-        print_log("HOMESCREEN: visible command[visible appid visible raise] has no argument");
+        print_log("HOMESCREEN: visible command[visible appid visible raise] "
+                  "has no argument");
     }
 }
 
@@ -963,18 +1176,56 @@ show_surface(struct display *display, char *buf, const int show)
     char    *args[10];
     int     narg;
     int     surfaceid;
+    int     anima = 0;
+    int     ax = 0;
+    int     ay = 0;
+    int     awidth = 1;
+    int     aheight = 1;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 1)  {
         surfaceid = search_surface(display, args[0]);
+        if (narg >= 2)  {
+            anima = strtol(args[1], (char **)0, 0);
+            if (anima >= 2) {
+                ax = 0;
+                ay = 0;
+                awidth = 1;
+                aheight = 1;
+                if (narg >= 3)  ax = strtol(args[2], (char **)0, 0);
+                if (narg >= 4)  ay = strtol(args[3], (char **)0, 0);
+                if (narg >= 5)  awidth = strtol(args[4], (char **)0, 0);
+                if (narg >= 6)  aheight = strtol(args[5], (char **)0, 0);
+            }
+        }
         if (surfaceid >= 0) {
             if (show)   {
-                print_log("HOMESCREEN: show(%s,%08x)", args[0], surfaceid);
-                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 1, 9);
+                if (anima >= 2) {
+                    print_log("HOMESCREEN: show anima(%s,%08x,x/y=%d/%d,w/h=%d/%d)",
+                              args[0], surfaceid, ax, ay, awidth, aheight);
+                    ico_window_mgr_visible_animation(display->ico_window_mgr, surfaceid,
+                                                     1, ax, ay, awidth, aheight);
+                }
+                else    {
+                    print_log("HOMESCREEN: show(%s,%08x,anima=%d)",
+                              args[0], surfaceid, anima);
+                    ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+                                               1, ICO_WINDOW_MGR_V_NOCHANGE, anima);
+                }
             }
             else    {
-                print_log("HOMESCREEN: hide(%s,%08x)", args[0], surfaceid);
-                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 0, 9);
+                if (anima >= 2) {
+                    print_log("HOMESCREEN: hide anima(%s,%08x,x/y=%d/%d,w/h=%d/%d)",
+                              args[0], surfaceid, ax, ay, awidth, aheight);
+                    ico_window_mgr_visible_animation(display->ico_window_mgr, surfaceid,
+                                                     0, ax, ay, awidth, aheight);
+                }
+                else    {
+                    print_log("HOMESCREEN: hide(%s,%08x,anima=%d)",
+                              args[0], surfaceid, anima);
+                    ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+                                               0, ICO_WINDOW_MGR_V_NOCHANGE, anima);
+                }
             }
         }
         else    {
@@ -982,7 +1233,8 @@ show_surface(struct display *display, char *buf, const int show)
         }
     }
     else    {
-        print_log("HOMESCREEN: show command[show/hide appid] has no argument");
+        print_log("HOMESCREEN: show command[show/hide appid anima x y width height]"
+                  " has no argument");
     }
 }
 
@@ -992,18 +1244,24 @@ raise_surface(struct display *display, char *buf, const int raise)
     char    *args[10];
     int     narg;
     int     surfaceid;
+    int     anima = 0;
 
     narg = pars_command(buf, args, 10);
     if (narg >= 1)  {
         surfaceid = search_surface(display, args[0]);
+        if (narg >= 2)  {
+            anima = strtol(args[1], (char **)0, 0);
+        }
         if (surfaceid >= 0) {
             if (raise)  {
-                print_log("HOMESCREEN: raise(%s,%08x)", args[0], surfaceid);
-                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 9, 1);
+                print_log("HOMESCREEN: raise(%s,%08x,anima=%d)", args[0], surfaceid, anima);
+                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+                                           ICO_WINDOW_MGR_V_NOCHANGE, 1, anima);
             }
             else    {
-                print_log("HOMESCREEN: lower(%s,%08x)", args[0], surfaceid);
-                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid, 9, 0);
+                print_log("HOMESCREEN: lower(%s,%08x,anima=%d)", args[0], surfaceid, anima);
+                ico_window_mgr_set_visible(display->ico_window_mgr, surfaceid,
+                                           ICO_WINDOW_MGR_V_NOCHANGE, 0, anima);
             }
         }
         else    {
@@ -1011,7 +1269,116 @@ raise_surface(struct display *display, char *buf, const int raise)
         }
     }
     else    {
-        print_log("HOMESCREEN: show command[raise/lower appid] has no argument");
+        print_log("HOMESCREEN: show command[raise/lower appid anima] has no argument");
+    }
+}
+
+static void
+active_window(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     surfaceid;
+    int     target;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 1)  {
+        surfaceid = search_surface(display, args[0]);
+        if (narg >= 2)  {
+            target = strtol(args[1], (char **)0, 0);
+        }
+        else    {
+            target = ICO_WINDOW_MGR_ACTIVE_POINTER | ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
+        }
+        if (surfaceid >= 0) {
+            print_log("HOMESCREEN: active(%s,%08x,target=%x)", args[0], surfaceid, target);
+            ico_window_mgr_set_active(display->ico_window_mgr, surfaceid, target);
+        }
+        else    {
+            print_log("HOMESCREEN: Unknown surface(%s) at active command", args[0]);
+        }
+    }
+    else    {
+        print_log("HOMESCREEN: active command[active appid[target]] has no argument");
+    }
+}
+
+
+static void
+animation_surface(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     surfaceid;
+    int     time;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 2)  {
+        surfaceid = search_surface(display, args[0]);
+        if (surfaceid >= 0) {
+            if (narg >= 3)  {
+                time = strtol(args[2], (char **)0, 0);
+            }
+            else    {
+                time = 0;
+            }
+            print_log("HOMESCREEN: animation(%s,%08x,%s,%d)",
+                      args[0], surfaceid, args[1], time);
+            ico_window_mgr_set_animation(display->ico_window_mgr, surfaceid, 0x7fffffff,
+                                         args[1], time);
+        }
+        else    {
+            print_log("HOMESCREEN: Unknown surface(%s) at animation command", args[0]);
+        }
+    }
+    else    {
+        print_log("HOMESCREEN: animation command"
+                  "[animation appid animation time] has no argument");
+    }
+}
+
+static void
+map_surface(struct display *display, char *buf, int map)
+{
+    char    *args[10];
+    int     narg;
+    int     surfaceid;
+    int     fps;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 1)  {
+        surfaceid = search_surface(display, args[0]);
+        if (surfaceid >= 0) {
+            if (narg >= 2)  {
+                fps = strtol(args[1], (char **)0, 0);
+            }
+            else    {
+                fps = 0;
+            }
+            if (map)    {
+                print_log("HOMESCREEN: map surface(%s,%08x,%d)",
+                          args[0], surfaceid, fps);
+                ico_window_mgr_map_surface(display->ico_window_mgr, surfaceid, fps);
+            }
+            else    {
+                print_log("HOMESCREEN: unmap surface(%s,%08x)", args[0], surfaceid);
+                ico_window_mgr_unmap_surface(display->ico_window_mgr, surfaceid);
+            }
+        }
+        else    {
+            print_log("HOMESCREEN: Unknown surface(%s) at %s command", args[0],
+                      map ? "map" : "unmap");
+        }
+    }
+    else    {
+        if (map)    {
+            print_log("HOMESCREEN: map surface command"
+                      "[map surface framerate] has no argument");
+        }
+        else    {
+            print_log("HOMESCREEN: unmap surface command"
+                      "[unmap surface] has no argument");
+        }
     }
 }
 
@@ -1053,9 +1420,10 @@ input_add(struct display *display, char *buf)
             fix = 0;
         }
         if ((input >= 0) && (fix >=0))  {
-            print_log("HOMESCREEN: input_add(%s.%d to %s[%d])", args[0], input, args[2], fix);
+            print_log("HOMESCREEN: input_add(%s.%d to %s[%d])",
+                      args[0], input, args[2], fix);
             ico_input_mgr_control_add_input_app(display->ico_input_mgr,
-                                                args[2], args[0], input, fix);
+                                                args[2], args[0], input, fix, 0);
         }
         else    {
             print_log("HOMESCREEN: Unknown input(%s) at input_add command", args[1]);
@@ -1097,6 +1465,98 @@ input_del(struct display *display, char *buf)
 }
 
 static void
+input_send(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     surfaceid;
+    int     type;
+    int     no;
+    int     code;
+    int     value;
+    char    appid[64];
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 5)  {
+        memset(appid, 0, sizeof(appid));
+        if (args[0][0] == '@')  {
+            strncpy(appid, &args[0][1], sizeof(appid)-1);
+            surfaceid = 0;
+        }
+        else    {
+            surfaceid = search_surface(display, args[0]);
+        }
+        if (strcasecmp(args[1], "POINTER") == 0)    {
+            type = ICO_INPUT_MGR_DEVICE_TYPE_POINTER;
+        }
+        else if (strcasecmp(args[1], "KEYBOARD") == 0)  {
+            type = ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD;
+        }
+        else if (strcasecmp(args[1], "TOUCH") == 0) {
+            type = ICO_INPUT_MGR_DEVICE_TYPE_TOUCH;
+        }
+        else if (strcasecmp(args[1], "SWITCH") == 0)    {
+            type = ICO_INPUT_MGR_DEVICE_TYPE_SWITCH;
+        }
+        else if (strcasecmp(args[1], "HAPTIC") == 0)    {
+            type = ICO_INPUT_MGR_DEVICE_TYPE_HAPTIC;
+        }
+        else    {
+            type = strtol(args[1], (char **)0, 0);
+        }
+        no = strtol(args[2], (char **)0, 0);
+        if (strcasecmp(args[3], "ABS_X") == 0)  {
+            code = ABS_X;
+        }
+        else if (strcasecmp(args[3], "ABS_Y") == 0) {
+            code = ABS_Y;
+        }
+        else if (strcasecmp(args[3], "ABS_Z") == 0) {
+            code = ABS_Z;
+        }
+        else if (strcasecmp(args[3], "REL_X") == 0) {
+            code = REL_X | (EV_REL << 16);
+        }
+        else if (strcasecmp(args[3], "REL_Y") == 0) {
+            code = REL_Y | (EV_REL << 16);
+        }
+        else if (strcasecmp(args[3], "REL_Z") == 0) {
+            code = REL_Z | (EV_REL << 16);
+        }
+        else if (strcasecmp(args[3], "BTN_TOUCH") == 0) {
+            code = BTN_TOUCH;
+        }
+        else if (strcasecmp(args[3], "BTN_LEFT") == 0)  {
+            code = BTN_LEFT;
+        }
+        else if (strcasecmp(args[3], "BTN_RIGHT") == 0) {
+            code = BTN_RIGHT;
+        }
+        else if (strcasecmp(args[3], "BTN_MIDDLE") == 0)    {
+            code = BTN_MIDDLE;
+        }
+        else if (strcasecmp(args[3], "BTN_RIGHT") == 0) {
+            code = BTN_RIGHT;
+        }
+        else    {
+            code = strtol(args[3], (char **)0, 0);
+        }
+        value = strtol(args[4], (char **)0, 0);
+        if (narg >= 6)  {
+            value = (value << 16) + strtol(args[5], (char **)0, 0);
+        }
+        print_log("HOMESCREEN: input_send(%s.%x,%d,%d,%x,%d)",
+                  appid, surfaceid, type, no, code, value);
+        ico_input_mgr_control_send_input_event(display->ico_input_mgr,
+                                               appid, surfaceid, type, no, code, value);
+    }
+    else    {
+        print_log("HOMESCREEN: input_send command[input_send {@app/serface} type no code "
+                  "value [value2]] has no argument");
+    }
+}
+
+static void
 input_conf(struct display *display, char *buf)
 {
     char    *args[10];
@@ -1257,11 +1717,93 @@ send_event(const char *cmd)
 
     if (msgsnd(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0) < 0)    {
         fprintf(stderr, "HOMESCREEN: message queue(%d(0x%x)) send error[%d]\n",
-                        mqkey, mqkey, errno);
+                mqkey, mqkey, errno);
         return;
     }
 }
 
+static void
+set_region(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     x, y, width, height;
+    int     hot_x, hot_y;
+    int     c_x, c_y, c_width, c_height;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 5)  {
+        x = strtol(args[1], (char **)0, 0);
+        y = strtol(args[2], (char **)0, 0);
+        width = strtol(args[3], (char **)0, 0);
+        height = strtol(args[4], (char **)0, 0);
+        hot_x = x + (width / 2);
+        hot_y = y + (height / 2);
+        c_x = x + 5;
+        c_y = y + 5;
+        c_width = width - 10;
+        if (c_width <= 0)   c_width = 2;
+        c_height = height - 10;
+        if (c_height <= 0)  c_height = 2;
+        print_log("HOMESCREEN: ico_exinput_set_input_region(%s,%d,%d-%d,%d,"
+                  "hot=%d,%d,cur=%d,%d-%d,%d,attr=0)",
+                  args[0] ? args[0] : "(null)", x, y, width, height,
+                  hot_x, hot_y, c_x, c_y, c_width, c_height);
+        if (strcasecmp(args[0], "NULL") == 0)   {
+            ico_exinput_set_input_region(display->ico_exinput, "", x, y,
+                                         width, height, hot_x, hot_y, c_x, c_y,
+                                         c_width, c_height, 0);
+        }
+        else    {
+            ico_exinput_set_input_region(display->ico_exinput, args[0], x, y,
+                                         width, height, hot_x, hot_y, c_x, c_y,
+                                         c_width, c_height, 0);
+        }
+    }
+    else    {
+        print_log("HOMESCREEN: set_region command[set_region winname@appid x y "
+                  "width height] has no argument");
+    }
+}
+
+static void
+unset_region(struct display *display, char *buf)
+{
+    char    *args[10];
+    int     narg;
+    int     x, y, width, height;
+
+    narg = pars_command(buf, args, 10);
+    if (narg >= 1)  {
+        if (narg >= 5) {
+            x = strtol(args[1], (char **)0, 0);
+            y = strtol(args[2], (char **)0, 0);
+            width = strtol(args[3], (char **)0, 0);
+            height = strtol(args[4], (char **)0, 0);
+        }
+        else    {
+            x = 0;
+            y = 0;
+            width = 0;
+            height = 0;
+        }
+        print_log("HOMESCREEN: ico_exinput_unset_input_region(%s,08x,%d,%d-%d,%d)",
+                  args[0] ? args[0] : "(null)", x, y, width, height);
+        if (strcasecmp(args[0], "NULL") == 0)   {
+            ico_exinput_unset_input_region(display->ico_exinput, "", x, y,
+                                           width, height);
+        }
+        else    {
+            ico_exinput_unset_input_region(display->ico_exinput, args[0],
+                                           x, y, width, height);
+        }
+    }
+    else    {
+        print_log("HOMESCREEN: unset_region command[unset_region winname@appid x y "
+                  "width height] has no argument");
+    }
+}
+
 /*
  * Main Program
  *
@@ -1274,6 +1816,11 @@ int main(int argc, char *argv[])
     char buf[256];
     int ret, fd;
     int msec;
+#if 1           /* use mkostemp */
+    extern int  mkostemp(char *template, int flags);
+#else           /* use mkostemp */
+    long flags;
+#endif          /* use mkostemp */
 
     display = malloc(sizeof *display);
     assert(display);
@@ -1306,8 +1853,7 @@ int main(int argc, char *argv[])
     assert(display->display);
 
     display->registry = wl_display_get_registry(display->display);
-    wl_registry_add_listener(display->registry,
-                 &registry_listener, display);
+    wl_registry_add_listener(display->registry, &registry_listener, display);
     wl_display_dispatch(display->display);
 
     fd = 0;
@@ -1315,12 +1861,11 @@ int main(int argc, char *argv[])
     while (1) {
         sleep_with_wayland(display->display, 20);
         if (display->prompt)    {
-            printf("HOMESCREEN: "); fflush(stdout);
+            printf("HOMESCREEN> "); fflush(stdout);
         }
-        ret = getdata(display->ico_window_mgr, "HOMESCREEN: ", fd, buf, sizeof(buf));
+        ret = getdata(display->ico_window_mgr, "HOMESCREEN> ", fd, buf, sizeof(buf));
         if (ret < 0) {
-            fprintf(stderr, "HOMESCREEN: read error: fd %d, %m\n",
-                fd);
+            fprintf(stderr, "HOMESCREEN: read error: fd %d, %m\n", fd);
             return -1;
         }
         if (ret == 0)   continue;
@@ -1380,6 +1925,22 @@ int main(int argc, char *argv[])
             /* Raise/Lower surface window   */
             raise_surface(display, &buf[5], 0);
         }
+        else if (strncasecmp(buf, "active", 6) == 0) {
+            /* Active surface window        */
+            active_window(display, &buf[6]);
+        }
+        else if (strncasecmp(buf, "animation", 9) == 0) {
+            /* Set animation surface window */
+            animation_surface(display, &buf[9]);
+        }
+        else if (strncasecmp(buf, "map", 3) == 0) {
+            /* map surface                  */
+            map_surface(display, &buf[3], 1);
+        }
+        else if (strncasecmp(buf, "unmap", 5) == 0) {
+            /* unmap surface                */
+            map_surface(display, &buf[5], 0);
+        }
         else if (strncasecmp(buf, "input_add", 9) == 0) {
             /* Set input switch to application */
             input_add(display, &buf[9]);
@@ -1388,6 +1949,10 @@ int main(int argc, char *argv[])
             /* Reset input switch to application*/
             input_del(display, &buf[9]);
         }
+        else if (strncasecmp(buf, "input_send", 10) == 0) {
+            /* Input event send to application*/
+            input_send(display, &buf[10]);
+        }
         else if (strncasecmp(buf, "input_conf", 10) == 0) {
             /* input switch configuration       */
             input_conf(display, &buf[10]);
@@ -1400,6 +1965,18 @@ int main(int argc, char *argv[])
             /* input switch event               */
             input_sw(display, &buf[8]);
         }
+        else if (strncasecmp(buf, "set_region", 10) == 0) {
+            /* set input region                 */
+            set_region(display, &buf[10]);
+        }
+        else if (strncasecmp(buf, "unset_region", 12) == 0) {
+            /* unset input region               */
+            unset_region(display, &buf[12]);
+        }
+        else if (strncasecmp(buf, "input_sw", 8) == 0) {
+            /* input switch event               */
+            input_sw(display, &buf[8]);
+        }
         else if (strncasecmp(buf, "sleep", 5) == 0) {
             /* Sleep                            */
             msec = sec_str_2_value(&buf[6]);
@@ -1429,6 +2006,6 @@ int main(int argc, char *argv[])
 
     send_event(NULL);
 
-    return(0);
+    return 0;
 }
 
index 9165aa3..6aa0b7b 100644 (file)
@@ -1,10 +1,23 @@
 /*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ * Copyright Â© 2013 TOYOTA MOTOR CORPORATION.
  *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  The copyright holders make
+ * no representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
  *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 /**
  * @brief   System Test Tool for send device input event
@@ -343,11 +356,13 @@ send_event(const char *cmd)
                     print_log("Send Event Y=%d\t %d.%03d", event.value,
                               (int)event.time.tv_sec, (int)(event.time.tv_usec/1000));
                 }
-                else if ((event.type == EV_KEY) && (event.code == BTN_LEFT) && (event.value == 1))    {
+                else if ((event.type == EV_KEY) &&
+                         (event.code == BTN_LEFT) && (event.value == 1))    {
                     print_log("Send Event BTN_LEFT=Down\t# %d.%03d",
                               (int)event.time.tv_sec, (int)(event.time.tv_usec/1000));
                 }
-                else if ((event.type == EV_KEY) && (event.code == BTN_LEFT) && (event.value == 0))   {
+                else if ((event.type == EV_KEY) &&
+                         (event.code == BTN_LEFT) && (event.value == 0))   {
                     print_log("Send Event BTN_LEFT=Up\t# %d.%03d",
                               (int)event.time.tv_sec, (int)(event.time.tv_usec/1000));
                 }
@@ -401,7 +416,8 @@ send_event(const char *cmd)
 static void
 usage(const char *prog)
 {
-    fprintf(stderr, "Usage: %s [-device=device] [{-m/-t/-j}] [-mq[=key]] [-d] [event=value] [event=value] ...\n", prog);
+    fprintf(stderr, "Usage: %s [-device=device] [{-m/-t/-j}] [-mq[=key]] "
+            "[-d] [event=value] [event=value] ...\n", prog);
     exit(0);
 }
 
diff --git a/tests/weston.ini b/tests/weston.ini
deleted file mode 100644 (file)
index 5be1667..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[core]
-modules=ico_plugin_loader.so
-
-#[output]
-#name=HDMI3
-#mode=1680x945
-#mode=1920x1080
-#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
-#transform=90
-
-#[output]
-#name=LVDS1
-#mode=1680x1050
-#transform=90
-
-#[output]
-#name=VGA1
-#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
-#transform=90
-
-#[output]
-#name=X1
-#mode=1024x768
-#transform=flipped-270
diff --git a/tests/weston_ivi_plugin.ini b/tests/weston_ivi_plugin.ini
deleted file mode 100644 (file)
index 89798d3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-[plugin]
-modules=ico_ivi_common.so,ico_ivi_shell.so,ico_window_mgr.so,ico_input_mgr.so
-
-[shell]
-animation=none
-#animation=zoom
-# 0=hide on surface create(for with HomeScreen)/1=show on surface create(for Debug)
-visible_on_create=0
-
-[debug]
-# option flag
-#  0x00000001 : =1, At the time of unvisible of surface, it travels surface outside a screen.
-#             : =0, Exclude surface of the unvisible from a list of surface of Westons.
-option_flag=1
-
-# 0=no debug write(1=err/2=warn/3=info/4=debug)
-ivi_debug=4
-
diff --git a/touch_egalax/Makefile.am b/touch_egalax/Makefile.am
deleted file mode 100644 (file)
index ea6be86..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-export abs_builddir
-
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/src $(COMPOSITOR_CFLAGS)
-
-bin_PROGRAMS =         \
-       ico_ictl-touch_egalax   \
-       ico_ictl-egalax_calibration
-
-check_LTLIBRARIES = $(TESTS)
-check_PROGRAMS = \
-       ico_ictl-touch_egalax   \
-       ico_ictl-egalax_calibration
-
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
-
-ico_ictl_touch_egalax_SOURCES = \
-       ico_ictl-touch_egalax.c
-ico_ictl_touch_egalax_LDADD = $(SIMPLE_CLIENT_LIBS)
-
-ico_ictl_egalax_calibration_SOURCES = \
-       ico_ictl-egalax_calibration.c
-ico_ictl_egalax_calibration_LDADD = $(SIMPLE_CLIENT_LIBS)
-
diff --git a/touch_egalax/ico_ictl-egalax_calibration.c b/touch_egalax/ico_ictl-egalax_calibration.c
deleted file mode 100644 (file)
index 2c12c5f..0000000
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   Touchpanel(eGalax) Calibration Tool
- *
- * @date    Feb-20-2013
- */
-
-#include "ico_ictl-touch_egalax.h"
-
-/* Number of times to repeat a touch about each point   */
-#define CALIBCONF_READ_NUM  (5)
-#define XY_COORDNATE_DELTA  (50)
-
-/* Macro for adjust coordinate      */
-#define delta_add(x)    \
-    (x) > 256 ? (x) + XY_COORDNATE_DELTA : ((x) > XY_COORDNATE_DELTA ? (x) - XY_COORDNATE_DELTA : 0);
-
-static void print_usage(const char *pName);
-static char *find_event_device(void);
-static FILE *open_conffile(void);
-static void get_coordinates(int evfd);
-static void read_event(int evfd, int *x, int *y);
-static void sort_data(int buff[], int left, int right);
-
-int             mDispWidth = CALIBRATION_DISP_WIDTH;
-int             mDispHeight = CALIBRATION_DISP_HEIGHT;
-int             mPosX[4];
-int             mPosY[4];
-
-int             mDebug = 0;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   Touchpanel(eGalax) Calibration Tool main routine
- *
- * @param   arguments of standard main routeins(argc, argv)
- * @return  result
- * @retval  0       sucess
- * @retval  8       configuration file Error
- * @retval  9       can not open event device(touchpanel)
- */
-/*--------------------------------------------------------------------------*/
-int
-main(int argc, char *argv[])
-{
-    int     ii, cnt;
-    int     evfd;                               /* event device fd */
-    char    *eventDeviceName = NULL;            /* event device name to hook */
-    FILE    *fp;
-    char    buff[128];
-
-    /* Get options                      */
-    for (ii = 1; ii < argc; ii++) {
-        if (strcasecmp(argv[ii], "-h") == 0) {
-            /* Help                     */
-            print_usage(argv[0]);
-            exit(0);
-        }
-        else if (strcasecmp(argv[ii], "-width") == 0)   {
-            /* Screen width             */
-            ii++;
-            if (ii >= argc) {
-                print_usage(argv[0]);
-                exit(0);
-            }
-            mDispWidth = strtol(argv[ii], (char **)0, 0);
-            if ((mDispWidth <= 0) || (mDispWidth > 8192))   {
-                print_usage(argv[0]);
-                exit(0);
-            }
-        }
-        else if (strcasecmp(argv[ii], "-height") == 0)  {
-            /* Screen height            */
-            ii++;
-            if (ii >= argc) {
-                print_usage(argv[0]);
-                exit(0);
-            }
-            mDispHeight = strtol(argv[ii], (char **)0, 0);
-            if ((mDispHeight <= 0) || (mDispHeight > 8192)) {
-                print_usage(argv[0]);
-                exit(0);
-            }
-        }
-        else {
-            /* Input event device name  */
-            eventDeviceName = argv[ii];
-        }
-    }
-
-    if (eventDeviceName == NULL) {
-        /* If event device not present, get default device  */
-        eventDeviceName = find_event_device();
-        if (eventDeviceName == NULL) {
-            /* System has no touchpanel, Error  */
-            exit(9);
-        }
-    }
-
-    evfd = open(eventDeviceName, O_RDONLY);
-    if (evfd < 0) {
-        perror("Open event device");
-        exit(9);
-    }
-
-    /* Open configuration file for output   */
-    fp = open_conffile();
-    if (fp == NULL) {
-        fprintf(stderr, "%s: Can not open config file\n", argv[0]);
-        close(evfd);
-        exit(8);
-    }
-
-    CALIBRATION_PRINT("\n");
-    CALIBRATION_PRINT("+================================================+\n");
-    CALIBRATION_PRINT("| Configration Tool for Calibration Touch ver0.1 |\n");
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-    CALIBRATION_PRINT("| use display width = %d\n", CALIBRATION_DISP_WIDTH);
-    CALIBRATION_PRINT("| use display height = %d\n", CALIBRATION_DISP_HEIGHT);
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-
-    get_coordinates(evfd);
-
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-    CALIBRATION_PRINT("| save config                                    |\n");
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-
-    cnt = sprintf(buff, "%s=%d\n", CALIBRATOIN_STR_DISP_W, mDispWidth);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    cnt = sprintf(buff, "%s=%d\n", CALIBRATOIN_STR_DISP_H, mDispHeight);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    cnt = sprintf(buff, "%s=%d*%d\n", CALIBRATOIN_STR_POS1, mPosX[0], mPosY[0]);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    cnt = sprintf(buff, "%s=%d*%d\n", CALIBRATOIN_STR_POS2, mPosX[1], mPosY[1]);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    cnt = sprintf(buff, "%s=%d*%d\n", CALIBRATOIN_STR_POS3, mPosX[2], mPosY[2]);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    cnt = sprintf(buff, "%s=%d*%d\n", CALIBRATOIN_STR_POS4, mPosX[3], mPosY[3]);
-    fwrite(buff, sizeof(char), cnt, fp);
-    CALIBRATION_PRINT("| %s", buff);
-
-    if (evfd >= 0) {
-        close(evfd);
-    }
-
-    /* Close outputed configuration file    */
-    fclose(fp);
-
-    CALIBRATION_PRINT("|                                                |\n");
-    CALIBRATION_PRINT("| finish Tools                                   |\n");
-
-    exit(0);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   find_event_device: Find eGalax touchpanel device
- *
- * @param       nothing
- * @return      device name
- * @retval      != NULL     device name string
- * @retvel      == NULL     system has no eGalax touchpanel
- */
-/*--------------------------------------------------------------------------*/
-static char *
-find_event_device(void)
-{
-    FILE    *fp;
-    int     eGalax = 0;
-    int     i, j, k;
-    char    buf[240];
-    static char edevice[64];
-
-    /* Search input device      */
-    fp = fopen("/proc/bus/input/devices", "r");
-    if (!fp)    {
-        CALIBRATION_INFO("find_event_device: /proc/bus/input/devices Open Error\n");
-        return(NULL);
-    }
-
-    while (fgets(buf, sizeof(buf), fp)) {
-        if (eGalax == 0)    {
-            for (i = 0; buf[i]; i++)    {
-                if (strncmp(&buf[i], "eGalax", 6) == 0) {
-                    /* Find eGalax touchpanel device    */
-                    eGalax = 1;
-                    break;
-                }
-            }
-        }
-        else    {
-            for (i = 0; buf[i]; i++)    {
-                if (strncmp(&buf[i], "Handlers", 8) == 0)   {
-                    /* Find eGalax device and Handlers  */
-                    for (j = i+8; buf[j]; j++)  {
-                        if (buf[j] != ' ')  continue;
-                        strcpy(edevice, "/dev/input/");
-                        for (k = strlen(edevice); k < (int)sizeof(edevice); k++)    {
-                            j++;
-                            if ((buf[j] == 0) || (buf[j] == ' ') ||
-                                (buf[j] == '\t') || (buf[j] == '\n') ||
-                                (buf[j] == '\r'))   break;
-                            edevice[k] = buf[j];
-                        }
-                        edevice[k] = 0;
-                        CALIBRATION_INFO("Event device of eGalax=<%s>\n", edevice);
-                        fclose(fp);
-                        return(edevice);
-                    }
-                    break;
-                }
-            }
-        }
-    }
-    fclose(fp);
-
-    CALIBRATION_PRINT("System has no eGalax Touchpanel\n");
-    return(NULL);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       read coordinates form touchpanel
- *
- * @param[in]   evfd        touchpanel event device
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-get_coordinates(int evfd)
-{
-    int     bufX[CALIBCONF_READ_NUM];
-    int     bufY[CALIBCONF_READ_NUM];
-    int     x, y;
-    int     ii;
-
-    CALIBRATION_PRINT("| Touch the Top-Left corner of the screen %d times\n",
-                      CALIBCONF_READ_NUM);
-    for (ii = 0; ii < CALIBCONF_READ_NUM; ii++) {
-        read_event(evfd, &x, &y);
-        bufX[ii] = x;
-        bufY[ii] = y;
-        CALIBRATION_PRINT("| # %d: %dx%d \n", ii, x, y);
-    }
-    sort_data(bufX, 0, CALIBCONF_READ_NUM - 1);
-    sort_data(bufY, 0, CALIBCONF_READ_NUM - 1);
-    mPosX[0] = delta_add(bufX[CALIBCONF_READ_NUM / 2]);
-    mPosY[0] = delta_add(bufY[CALIBCONF_READ_NUM / 2]);
-
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-    CALIBRATION_PRINT("| Touch the Top-Right corner of the screen %d times\n",
-                      CALIBCONF_READ_NUM);
-    for (ii = 0; ii < CALIBCONF_READ_NUM; ii++) {
-        read_event(evfd, &x, &y);
-        bufX[ii] = x;
-        bufY[ii] = y;
-        CALIBRATION_PRINT("| # %d: %dx%d \n", ii, x, y);
-    }
-    sort_data(bufX, 0, CALIBCONF_READ_NUM - 1);
-    sort_data(bufY, 0, CALIBCONF_READ_NUM - 1);
-    mPosX[1] = delta_add(bufX[CALIBCONF_READ_NUM / 2]);
-    mPosY[1] = delta_add(bufY[CALIBCONF_READ_NUM / 2]);
-
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-    CALIBRATION_PRINT("| Touch the Bottom-Left corner of the screen %d times\n",
-                      CALIBCONF_READ_NUM);
-    for (ii = 0; ii < CALIBCONF_READ_NUM; ii++) {
-        read_event(evfd, &x, &y);
-        bufX[ii] = x;
-        bufY[ii] = y;
-        CALIBRATION_PRINT("| # %d: %dx%d \n", ii, x, y);
-    }
-    sort_data(bufX, 0, CALIBCONF_READ_NUM - 1);
-    sort_data(bufY, 0, CALIBCONF_READ_NUM - 1);
-    mPosX[2] = delta_add(bufX[CALIBCONF_READ_NUM / 2]);
-    mPosY[2] = delta_add(bufY[CALIBCONF_READ_NUM / 2]);
-
-    CALIBRATION_PRINT("+------------------------------------------------+\n");
-    CALIBRATION_PRINT("| Touch the Bottom-Right corner of the screen %d times\n",
-                      CALIBCONF_READ_NUM);
-    for (ii = 0; ii < CALIBCONF_READ_NUM; ii++) {
-        read_event(evfd, &x, &y);
-        bufX[ii] = x;
-        bufY[ii] = y;
-        CALIBRATION_PRINT("| # %d: %dx%d \n", ii, x, y);
-    }
-    sort_data(bufX, 0, CALIBCONF_READ_NUM - 1);
-    sort_data(bufY, 0, CALIBCONF_READ_NUM - 1);
-    mPosX[3] = delta_add(bufX[CALIBCONF_READ_NUM / 2]);
-    mPosY[3] = delta_add(bufY[CALIBCONF_READ_NUM / 2]);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       sort integer dates
- *
- * @param[in]   buff    array of integer datas
- * @param[in]   left    array start index
- * @param[in]   right   array end index
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-sort_data(int buff[], int left, int right)
-{
-    int     ii, jj, pivot;
-    int     tmp;
-
-    ii = left;
-    jj = right;
-
-    pivot = buff[(left + right) / 2];
-    while (1) {
-        while (buff[ii] < pivot) {
-            ii++;
-        }
-        while (pivot < buff[jj]) {
-            jj--;
-        }
-        if (ii >= jj) {
-            break;
-        }
-        tmp = buff[ii];
-        buff[ii] = buff[jj];
-        buff[jj] = tmp;
-        ii++;
-        jj--;
-    }
-
-    if (left < (ii - 1)) {
-        sort_data(buff, left, ii - 1);
-    }
-    if ((jj + 1) < right) {
-        sort_data(buff, jj + 1, right);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       event read from touchpanel
- *
- * @param[in]   evfd        touchpanel event device
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-read_event(int evfd, int *x, int *y)
-{
-    fd_set      fds;
-    int         ret;
-    int         rsize;
-    int         ii;
-    int         flagX = 0;
-    int         flagY = 0;
-    struct timeval  delay;
-    struct input_event events[64];
-
-    while (1) {
-        /* select timeoutt value    */
-        delay.tv_sec = 0;
-        delay.tv_usec = 100*1000;
-        /* fs_set                   */
-        FD_ZERO(&fds);
-        FD_SET(evfd, &fds);
-
-        /* wait for event read or timedout  */
-        ret = select(evfd + 1, &fds, NULL, NULL, &delay);
-        if (ret <= 0) {
-            continue;
-        }
-        if (FD_ISSET(evfd, &fds)) {
-            /* event read           */
-            rsize = read(evfd, events, sizeof(events) );
-            for (ii = 0; ii < (int)(rsize/sizeof(struct input_event)); ii++) {
-                if ((events[ii].type == EV_ABS) && (events[ii].code == ABS_X)) {
-                    /* X       */
-                    flagX++;
-                    *x = events[ii].value;
-                }
-                else if ((events[ii].type == EV_ABS) && (events[ii].code == ABS_Y)) {
-                    /* Y       */
-                    flagY++;
-                    *y = events[ii].value;
-                }
-            }
-        }
-        /* Input 2 times (Touch On and Off) */
-        if ((flagX >= 2) && (flagY >= 2)) {
-            break;
-        }
-    }
-
-    while (1) {
-        delay.tv_sec = 0;
-        delay.tv_usec = 200*1000;
-        FD_ZERO(&fds);
-        FD_SET(evfd, &fds);
-
-        /* wait for input (or timedout) */
-        ret = select(evfd + 1, &fds, NULL, NULL, &delay);
-        if (ret == 0) {
-            break;
-        }
-        else if (ret < 0) {
-            continue;
-        }
-        rsize = read(evfd, events, sizeof(events));
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       open configuration file
- *
- * @param       nothing
- * @return      file descriptor
- * @retval      != NULL     file descriptor
- * @retval      NULL        open error
- */
-/*--------------------------------------------------------------------------*/
-static FILE *
-open_conffile(void)
-{
-    char    *confp;
-    FILE    *fp;
-
-    /* Get configuration file path  */
-    confp = getenv(CALIBRATOIN_CONF_ENV);
-    if (! confp)  {
-        confp = CALIBRATOIN_CONF_FILE;
-    }
-
-    /* Open configuration file      */
-    fp = fopen(confp, "w");
-    if (fp == NULL) {
-        perror(confp);
-        return fp;
-    }
-    return fp;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       print help
- *
- * @param[in]   pName       program name
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-print_usage(const char *pName)
-{
-    fprintf(stderr, "Usage: %s [-h][-width width][-height height] [device]\n", pName);
-}
-
diff --git a/touch_egalax/ico_ictl-touch_egalax.c b/touch_egalax/ico_ictl-touch_egalax.c
deleted file mode 100644 (file)
index 3118abf..0000000
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   Device Input Controller(eGalax Touchpanel)
- *          Send touchpanel input enevt to Weston
- *
- * @date    Feb-20-2013
- */
-
-#include "ico_ictl-touch_egalax.h"
-
-/* Change touch event       */
-#define REPLACE_TOUCH_EVENT 1       /* Change touch event to mouse left button event*/
-
-/* Program name             */
-#define     CALIBDAE_DEV_NAME       "ico_ictl-touch_egalax"
-
-static void print_usage(const char *pName);
-static char *find_event_device(void);
-static int setup_uinput(char *uinputDeviceName);
-static void set_eventbit(int uifd);
-static int open_uinput(char *uinputDeviceName);
-static void close_uinput(int uifd);
-static void event_iterate(int uifd, int evfd);
-static void setup_sighandler(void);
-static void terminate_program(const int signal);
-static int setup_program(void);
-static int calibration_event(struct input_event *in, struct input_event *out);
-static void push_event(struct input_event *ev);
-static void push_eventlog(const char *cmd, const int value, struct timeval *tp);
-
-int             mRunning = -1;          /* Running flag             */
-int             mDebug = 0;             /* Debug flag               */
-int             mEventLog = 0;          /* event input log          */
-struct timeval  lastEvent = { 0, 0 };   /* last input event time    */
-
-/* Configurations               */
-int             mDispWidth = CALIBRATION_DISP_WIDTH;
-int             mDispHeight = CALIBRATION_DISP_HEIGHT;
-int             mPosX[4] = { 0, 0, 0, 0 };
-int             mPosY[4] = { 0, 0, 0, 0 };
-int             mXlow = 0;
-int             mXheigh = 0;
-int             mYlow = 0;
-int             mYheigh = 0;
-
-/* Optiones                     */
-int             mTrans = 0;             /* Rotate(0,90,180 or 270)  */
-int             mRevX = 0;              /* Reverse X coordinate     */
-int             mRevY = 0;              /* Reverse Y coordinate     */
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   Device Input Controller: For eGalax TouchPanel
- *          main routine
- *
- * @param   main() finction's standard parameter (argc,argv)
- * @return  result
- * @retval  0       success
- * @retval  8       failed(configuration error)
- * @retval  9       failed(event device error)
- */
-/*--------------------------------------------------------------------------*/
-int
-main(int argc, char *argv[])
-{
-    int     ii;
-    int     err;
-    int     uifd;                               /* uinput fd */
-    int     evfd;                               /* event device fd */
-    char    *eventDeviceName = NULL;            /* event device name to hook */
-    char    *uinputDeviceName = "/dev/uinput";  /* User Input module */
-
-    for (ii = 1; ii < argc; ii++) {
-        if (strcmp(argv[ii], "-h") == 0)    {
-            print_usage(argv[0]);
-            exit(0);
-        }
-        else if (strcmp(argv[ii], "-d") == 0) {
-            mDebug = 1;
-        }
-        else if (strcmp(argv[ii], "-t") == 0) {
-            if ((ii < (argc-1)) && (argv[ii+1][0] != '-'))  {
-                ii++;
-                mTrans = strtol(argv[ii], (char **)0, 0);
-            }
-            else    {
-                mTrans = 90;
-            }
-        }
-        else if (strcmp(argv[ii], "-l") == 0) {
-            mEventLog = 1;                  /* Input Log for System Test    */
-        }
-        else if (strcmp(argv[ii], "-L") == 0) {
-            mEventLog = 2;                  /* Output Log for Unit Test     */
-        }
-        else {
-            eventDeviceName = argv[ii];
-        }
-    }
-
-    if (eventDeviceName == NULL) {
-        /* If event device not present, get default device  */
-        eventDeviceName = find_event_device();
-        if (eventDeviceName == NULL) {
-            /* System has no touchpanel, Error  */
-            exit(9);
-        }
-    }
-
-    err = setup_program();
-    if (err < 0) {
-        if (err == -2)  {
-            fprintf(stderr, "%s: Illegal config value\n", argv[0]);
-        }
-        else    {
-            fprintf(stderr, "%s: Can not read config file\n", argv[0]);
-        }
-        exit(8);
-    }
-
-    if (! mDebug) {
-        if (daemon(0, 1) < 0) {
-            fprintf(stderr, "%s: Can not Create Daemon\n", argv[0]);
-            exit(1);
-        }
-    }
-
-    /* setup uinput device      */
-    uifd = setup_uinput(uinputDeviceName);
-    if (uifd < 0) {
-        fprintf(stderr, "uinput(%s) initialize failed. Continue anyway\n", uinputDeviceName);
-        exit(9);
-    }
-
-    evfd = open(eventDeviceName, O_RDONLY);
-    if (evfd < 0) {
-        fprintf(stderr, "event device(%s) Open Error[%d]\n", eventDeviceName, errno);
-        close_uinput(uifd);
-        exit(9);
-    }
-    CALIBRATION_DEBUG("main: input device(%s) = %d\n", eventDeviceName, evfd);
-
-    setup_sighandler();
-
-    /* event read               */
-    mRunning = 1;
-    event_iterate(uifd, evfd);
-
-    if (evfd >= 0)  {
-        close(evfd);
-    }
-
-    close_uinput(uifd);
-
-    exit(0);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       initialize with get configurations
- *
- * @param       nothing
- * @return      result
- * @retval      0           sucess
- * @retval      -1          config file read error
- * @retval      -2          illegal config value
- */
-/*--------------------------------------------------------------------------*/
-static int
-setup_program(void)
-{
-    char    *confp;
-    char    buff[128];
-    FILE    *fp;
-    int     work;
-
-    /* Get configuration file path  */
-    confp = getenv(CALIBRATOIN_CONF_ENV);
-    if (! confp)  {
-        confp = CALIBRATOIN_CONF_FILE;
-    }
-
-    /* Open configuration file      */
-    fp = fopen(confp, "r");
-    if (fp == NULL) {
-        perror(confp);
-        return -1;
-    }
-
-    while (fgets(buff, sizeof(buff), fp)) {
-        if (buff[0] == '#') {
-            /* comment line, skip       */
-            continue;
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_DISP_W,
-                         sizeof(CALIBRATOIN_STR_DISP_W) - 1) == 0) {
-            /* screen width             */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mDispWidth = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("mDispWidth = %d\n", mDispWidth);
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_DISP_H,
-                         sizeof(CALIBRATOIN_STR_DISP_H) - 1) == 0) {
-            /* screen height            */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mDispHeight = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("mDispHeight = %d\n", mDispHeight);
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_POS1,
-                         sizeof(CALIBRATOIN_STR_POS1) - 1) == 0) {
-            /* position1 : Top-Left     */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mPosX[0] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            mPosY[0] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("POS1 = %dx%d\n", mPosX[0], mPosY[0]);
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_POS2,
-                         sizeof(CALIBRATOIN_STR_POS2) - 1) == 0) {
-            /* position2 : Top-Right    */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mPosX[1] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            mPosY[1] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("POS2 = %dx%d\n", mPosX[1], mPosY[1]);
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_POS3,
-                         sizeof(CALIBRATOIN_STR_POS3) - 1) == 0) {
-            /* position3 : Bottom-Left  */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mPosX[2] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            mPosY[2] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("POS3 = %dx%d\n", mPosX[2], mPosY[2]);
-        }
-        else if (strncmp(buff,
-                         CALIBRATOIN_STR_POS4,
-                         sizeof(CALIBRATOIN_STR_POS4) - 1) == 0) {
-            /* position4 : Bottom-Right */
-            strtok(buff, CALIBRATOIN_STR_SEPAR);
-            mPosX[3] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            mPosY[3] = atoi(strtok(NULL, CALIBRATOIN_STR_SEPAR));
-            CALIBRATION_INFO("POS4 = %dx%d\n", mPosX[3], mPosY[3]);
-        }
-    }
-    fclose(fp);
-
-    /* Reverse X coordinate, if need    */
-    if (mPosX[0] > mPosX[1])    {
-        int     work;
-        work = mPosX[0];
-        mPosX[0] = mPosX[1];
-        mPosX[1] = work;
-        work = mPosX[2];
-        mPosX[2] = mPosX[3];
-        mPosX[3] = work;
-        mRevX = 1;
-        CALIBRATION_INFO("Reverse X\n");
-    }
-
-    /* Reverse Y coordinate, if need    */
-    if (mPosY[0] > mPosY[2])    {
-        work = mPosY[0];
-        mPosY[0] = mPosY[2];
-        mPosY[2] = work;
-        work = mPosY[1];
-        mPosY[1] = mPosY[3];
-        mPosY[3] = work;
-        mRevY = 1;
-        CALIBRATION_INFO("Reverse Y\n");
-    }
-
-    if ((mRevX != 0) || (mRevY != 0))   {
-        CALIBRATION_INFO("Changed POS1 = %dx%d\n", mPosX[0], mPosY[0]);
-        CALIBRATION_INFO("Changed POS2 = %dx%d\n", mPosX[1], mPosY[1]);
-        CALIBRATION_INFO("Changed POS3 = %dx%d\n", mPosX[2], mPosY[2]);
-        CALIBRATION_INFO("Changed POS4 = %dx%d\n", mPosX[3], mPosY[3]);
-    }
-
-    mXlow = (mPosX[0] + mPosX[2]) / 2;
-    mXheigh = (mPosX[1] + mPosX[3]) / 2;
-    if (mXheigh <= mXlow)   {
-        return -2;
-    }
-
-    mYlow = (mPosY[0] + mPosY[1]) / 2;
-    mYheigh = (mPosY[2] + mPosY[3]) / 2;
-    if (mYheigh <= mYlow)   {
-        return -2;
-    }
-    return 1;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       signal handler
- *
- *
- * @param[in]   signal  signal numnber
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-terminate_program(const int signal)
-{
-    mRunning = -signal;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       setup signal handler
- *
- * @param       nothing
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-setup_sighandler(void)
-{
-    sigset_t    mask;
-
-    sigemptyset(&mask);
-
-    signal(SIGTERM, terminate_program);
-
-    sigaddset(&mask, SIGTERM);
-    sigprocmask(SIG_UNBLOCK, &mask, NULL);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   find_event_device: Find eGalax touchpanel device
- *
- *
- * @param       nothing
- * @return      device name
- * @retval      != NULL     device name string
- * @retvel      == NULL     system has no eGalax touchpanel
- */
-/*--------------------------------------------------------------------------*/
-static char *
-find_event_device(void)
-{
-    FILE    *fp;
-    int     eGalax = 0;
-    int     i, j, k;
-    char    buf[240];
-    static char edevice[64];
-
-    char *pdev = getenv(CALIBRATOIN_INPUT_DEV);
-
-    if ((pdev != NULL) && (*pdev != 0)) {
-        /* Search pseudo input device for Debug */
-        int     fd;
-        for (i = 0; i < 16; i++) {
-            snprintf(edevice, 64, "/dev/input/event%d", i);
-            fd = open(edevice, O_RDONLY | O_NONBLOCK);
-            if (fd < 0)     continue;
-
-            memset(buf, 0, sizeof(buf));
-            ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);
-            close(fd);
-            k = 0;
-            for (j = 0; buf[j]; j++) {
-                if (buf[j] != ' ') {
-                    buf[k++] = buf[j];
-                }
-            }
-            buf[k] = 0;
-
-            if (strncasecmp(buf, pdev, sizeof(buf)) == 0)   {
-                CALIBRATION_INFO("Event device of eGalax=<%s>\n", edevice);
-                return edevice;
-            }
-        }
-    }
-    else    {
-        /* Search input device      */
-        fp = fopen("/proc/bus/input/devices", "r");
-        if (!fp)    {
-            CALIBRATION_PRINT("find_event_device: /proc/bus/input/devices Open Error\n");
-            return NULL;
-        }
-
-        while (fgets(buf, sizeof(buf), fp)) {
-            if (eGalax == 0)    {
-                for (i = 0; buf[i]; i++)    {
-                    if (strncmp(&buf[i], "eGalax", 6) == 0) {
-                        /* Find eGalax touchpanel device    */
-                        eGalax = 1;
-                        break;
-                    }
-                }
-            }
-            else    {
-                for (i = 0; buf[i]; i++)    {
-                    if (strncmp(&buf[i], "Handlers", 8) == 0)   {
-                        /* Find eGalax device and Handlers  */
-                        for (j = i+8; buf[j]; j++)  {
-                            if (buf[j] != ' ')  continue;
-                            strcpy(edevice, "/dev/input/");
-                            for (k = strlen(edevice); k < (int)sizeof(edevice); k++)    {
-                                j++;
-                                if ((buf[j] == 0) || (buf[j] == ' ') ||
-                                    (buf[j] == '\t') || (buf[j] == '\n') ||
-                                    (buf[j] == '\r'))   break;
-                                edevice[k] = buf[j];
-                            }
-                            edevice[k] = 0;
-                            CALIBRATION_INFO("Event device of eGalax=<%s>\n", edevice);
-                            fclose(fp);
-                            return edevice;
-                        }
-                        break;
-                    }
-                }
-            }
-        }
-        fclose(fp);
-    }
-    CALIBRATION_PRINT("%s: System has no eGalax Touchpanel\n", CALIBDAE_DEV_NAME);
-    return NULL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       event input and convert (main loop)
- *
- *
- * @param[in]   uifd        event output file descriptor
- * @param[in]   evfd        event input file descriptor
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-event_iterate(int uifd, int evfd)
-{
-    fd_set      fds;
-    int         ret;
-    int         rsize;
-    int         ii;
-    int         retry;
-    struct timeval  delay;
-    struct input_event events[128];
-    struct input_event event;
-
-    ioctl(evfd, EVIOCGRAB, 1);
-
-    retry = 0;
-
-    while (mRunning > 0) {
-        delay.tv_sec = 1;
-        delay.tv_usec = 0;
-
-        FD_ZERO(&fds);
-        FD_SET(evfd, &fds);
-
-        ret = select(evfd + 1, &fds, NULL, NULL, &delay);
-        if (ret <= 0) {
-            continue;
-        }
-        if (FD_ISSET(evfd, &fds)) {
-            rsize = read(evfd, events, sizeof(events));
-            if (rsize <= 0) {
-                if (rsize < 0)  {
-                    CALIBRATION_PRINT("event_iterate: input device(%d) end<%d>\n", evfd, errno);
-                    retry ++;
-                    if (retry > CALIBRATOIN_RETRY_COUNT)    {
-                        return;
-                    }
-                }
-                usleep(CALIBRATOIN_RETRY_WAIT * 1000);
-                continue;
-            }
-            retry = 0;
-            for (ii = 0; ii < (int)(rsize/sizeof(struct input_event)); ii++) {
-                ret = calibration_event(&events[ii], &event);
-#ifdef  REPLACE_TOUCH_EVENT
-                if (ret >= 0)   {
-                    if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-                        CALIBRATION_PRINT("%s: Event write error %d[%d]\n",
-                                          CALIBDAE_DEV_NAME, uifd, errno);
-                    }
-                    if (mEventLog == 2) {
-                        push_event(&event);
-                    }
-                    if (ret > 0)   {
-                        event.type = EV_SYN;
-                        event.code = SYN_REPORT;
-                        event.value = 0;
-                        write(uifd, &event, sizeof(struct input_event));
-
-                        event.type = EV_KEY;
-                        event.code = BTN_LEFT;
-                        event.value = 1;
-                        if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-                            CALIBRATION_PRINT("%s: Event write error %d[%d]\n",
-                                              CALIBDAE_DEV_NAME, uifd, errno);
-                        }
-                        else    {
-                            CALIBRATION_DEBUG("EV_KEY=BTN_LEFT\n");
-                        }
-                        if (mEventLog == 2) {
-                            push_event(&event);
-                        }
-                    }
-                }
-#else  /*REPLACE_TOUCH_EVENT*/
-                ret = write(uifd, &event, sizeof(struct input_event));
-                if (mEventLog == 2) {
-                    push_event(&event);
-                }
-#endif /*REPLACE_TOUCH_EVENT*/
-            }
-        }
-    }
-    ioctl(evfd, EVIOCGRAB, 0);
-}
-
-static void
-push_eventlog(const char *event, const int value, struct timeval *tp)
-{
-    struct timeval  curtime;
-
-    gettimeofday(&curtime, NULL);
-
-    if (lastEvent.tv_sec)   {
-        int     sec, usec;
-
-        sec = curtime.tv_sec - lastEvent.tv_sec;
-        usec = curtime.tv_usec - lastEvent.tv_usec;
-
-        if (usec < 0)   {
-            sec -= 1;
-            usec += 1000000;
-        }
-        usec += 500;
-        if( usec >= 1000000 )   {
-            usec -= 1000000;
-            sec += 1;
-        }
-        if ((sec > 0) || ((sec == 0) && (usec >= 10000)))   {
-            printf("sleep %d.%03d\n", sec, usec / 1000);
-            lastEvent.tv_sec = curtime.tv_sec;
-            lastEvent.tv_usec = curtime.tv_usec;
-        }
-    }
-    else    {
-        lastEvent.tv_sec = curtime.tv_sec;
-        lastEvent.tv_usec = curtime.tv_usec;
-    }
-    printf("%s=%d\t# %d.%03d\n", event, value, (int)tp->tv_sec, (int)(tp->tv_usec/1000));
-    fflush(stdout);
-}
-
-static void
-push_event(struct input_event *ev)
-{
-    switch(ev->type)    {
-    case EV_ABS:
-        switch(ev->code)    {
-        case ABS_X:
-            push_eventlog("X", ev->value, &(ev->time));
-            break;
-        case ABS_Y:
-            push_eventlog("Y", ev->value, &(ev->time));
-            break;
-        default:
-            break;
-        }
-        break;
-    case EV_KEY:
-        switch(ev->code)    {
-        case BTN_TOUCH:
-            push_eventlog("Touch", ev->value, &(ev->time));
-            break;
-        case BTN_LEFT:
-            push_eventlog("Button", ev->value, &(ev->time));
-            break;
-        default:
-            break;
-        }
-        break;
-    default:
-        break;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       convert x/y coordinates
- *
- * @param[in]   in          input event
- * @param[in]   out         output converted event
- * @return      result
- * @retval      -1          input event queued(no output)
- * @retval      0           no input event
- * @retval      1           event converted
- */
-/*--------------------------------------------------------------------------*/
-static int
-calibration_event(struct input_event *in, struct input_event *out)
-{
-    int     ret = 0;
-#ifdef  REPLACE_TOUCH_EVENT
-    static int queue_touch = 0;
-#endif /*REPLACE_TOUCH_EVENT*/
-
-    memcpy(out, in, sizeof(struct input_event) );
-
-    switch (in->type) {
-    case EV_ABS:
-        /* absolute coordinate      */
-        switch (in->code) {
-            /* X/Y coordinate       */
-        case ABS_X:
-            out->value = mDispWidth * (in->value - mXlow) / (mXheigh - mXlow);
-            if (mRevX)  {
-                out->value = mDispWidth - out->value;
-            }
-            if (out->value < 0)             out->value = 0;
-            if (out->value >= mDispWidth)   out->value = mDispWidth - 1;
-
-            if (mTrans == 90)   {
-                out->code = ABS_Y;
-                out->value = mDispWidth - out->value - 1;
-            }
-            else if (mTrans == 180) {
-                out->value = mDispWidth - out->value - 1;
-            }
-            else if (mTrans == 270) {
-                out->code = ABS_Y;
-            }
-            if (mEventLog == 1) {
-                push_eventlog("X", in->value, &(in->time));
-            }
-#ifdef  REPLACE_TOUCH_EVENT
-            if (queue_touch & 1)    {
-                queue_touch &= ~1;
-                if (queue_touch == 0)   {
-                    ret = 1;
-                }
-            }
-#endif /*REPLACE_TOUCH_EVENT*/
-            CALIBRATION_DEBUG("ABS_X=%s %d=>%d\n",
-                              (out->code == ABS_X) ? "X" : "Y",
-                              in->value, out->value);
-            break;
-
-        case ABS_Y:
-            out->value = mDispHeight * (in->value - mYlow) / (mYheigh - mYlow);
-            if (mRevY)  {
-                out->value = mDispHeight - out->value;
-            }
-            if (out->value < 0)             out->value = 0;
-            if (out->value >= mDispHeight)  out->value = mDispHeight - 1;
-
-            if (mTrans == 90)   {
-                out->code = ABS_X;
-            }
-            else if (mTrans == 180) {
-                out->value = mDispHeight - out->value - 1;
-            }
-            else if (mTrans == 270) {
-                out->code = ABS_X;
-                out->value = mDispHeight - out->value - 1;
-            }
-            if (mEventLog == 1) {
-                push_eventlog("Y", in->value, &(in->time));
-            }
-#ifdef  REPLACE_TOUCH_EVENT
-            if (queue_touch & 2)    {
-                queue_touch &= ~2;
-                if (queue_touch == 0)   {
-                    ret = 1;
-                }
-            }
-#endif /*REPLACE_TOUCH_EVENT*/
-            CALIBRATION_DEBUG("ABS_Y=%s %d=>%d\n",
-                              (out->code == ABS_X) ? "X" : "Y",
-                              in->value, out->value);
-            break;
-
-        default:
-            CALIBRATION_DEBUG("calibration_event: Unknown code(0x%x)\n", (int)in->code);
-            break;
-        }
-        break;
-
-#ifdef  REPLACE_TOUCH_EVENT
-    case EV_KEY:
-        if (in->code == BTN_TOUCH)  {
-            if (mEventLog == 1) {
-                push_eventlog("Touch", in->value, &(in->time));
-            }
-            /* Touch event change to mouse left button event    */
-            out->code = BTN_LEFT;
-            if (out->value != 0)    {
-                queue_touch = 3;
-                ret = -1;
-                CALIBRATION_DEBUG("BTN_TOUCH=LEFT, queue(%d)\n", out->value);
-            }
-            else    {
-                ret = 0;
-                CALIBRATION_DEBUG("BTN_TOUCH=LEFT(%d)\n", out->value);
-            }
-        }
-        break;
-#endif /*REPLACE_TOUCH_EVENT*/
-
-    case EV_SYN:
-        CALIBRATION_DEBUG("calibration_event: SYN\n");
-        break;
-
-    default:
-        CALIBRATION_DEBUG("calibration_event: Unknown type(0x%x)\n", (int)in->type);
-        break;
-    }
-    if (out->value < 0) {
-        out->value = 0;
-    }
-
-    return ret;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       setup uinput device for event output
- *
- * @param[in]   uinputDeviceName        uinput device node name
- * @return      uinput file descriptor
- * @retval      >= 0    file descriptor
- * @retval      < 0     error
- */
-/*--------------------------------------------------------------------------*/
-static int
-setup_uinput(char *uinputDeviceName)
-{
-    int     uifd;
-    struct uinput_user_dev  uinputDevice;
-
-    uifd = open_uinput(uinputDeviceName);
-    if (uifd < 0)   {
-        perror("Open uinput");
-        return -1;
-    }
-
-    memset(&uinputDevice, 0, sizeof(uinputDevice));
-    strcpy(uinputDevice.name, CALIBDAE_DEV_NAME);
-    uinputDevice.absmax[ABS_X] = mDispWidth;
-    uinputDevice.absmax[ABS_Y] = mDispHeight;
-
-    /* uinput device configuration  */
-    if (write(uifd, &uinputDevice, sizeof(uinputDevice)) < (int)sizeof(uinputDevice)) {
-        perror("Regist uinput");
-        CALIBRATION_PRINT("setup_uinput: write(%d) Error[%d]\n", uifd, errno);
-        close(uifd);
-        return -1;
-    }
-
-    /* uinput set event bits        */
-    set_eventbit(uifd);
-
-    if (ioctl(uifd, UI_DEV_CREATE, NULL) < 0)   {
-        CALIBRATION_PRINT("setup_uinput: ioclt(%d,UI_DEV_CREATE,) Error[%d]\n", uifd, errno);
-    }
-    return uifd;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       event bit set
- *
- * @param[in]   uifd        uinput file descriptor
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-set_eventbit(int uifd)
-{
-    ioctl(uifd, UI_SET_EVBIT, EV_SYN);
-
-    ioctl(uifd, UI_SET_EVBIT, EV_ABS);
-    ioctl(uifd, UI_SET_ABSBIT, ABS_X);
-    ioctl(uifd, UI_SET_ABSBIT, ABS_Y);
-
-    ioctl(uifd, UI_SET_EVBIT, EV_KEY);
-#ifdef  REPLACE_TOUCH_EVENT
-    ioctl(uifd, UI_SET_KEYBIT, BTN_LEFT);
-#else  /*REPLACE_TOUCH_EVENT*/
-    ioctl(uifd, UI_SET_KEYBIT, BTN_TOUCH);
-    ioctl(uifd, UI_SET_KEYBIT, BTN_TOOL_PEN);
-#endif /*REPLACE_TOUCH_EVENT*/
-
-    ioctl(uifd, UI_SET_EVBIT, EV_MSC);
-    ioctl(uifd, UI_SET_MSCBIT, MSC_SCAN);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       open uinput device
- *
- * @param[in]   uinputDeviceName    uinput device name
- * @return      uinput file descriptor
- * @retval      >= 0        file descriptor
- * @retval      < 0         error
- */
-/*--------------------------------------------------------------------------*/
-static int
-open_uinput(char *uinputDeviceName)
-{
-    return open(uinputDeviceName, O_RDWR);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       close uinput device
- *
- * @param[in]   uifd        uinput file descriptor
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-close_uinput(int uifd)
-{
-    if (uifd >= 0) {
-        ioctl(uifd, UI_DEV_DESTROY, NULL);
-        close(uifd);
-        uifd = -1;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief       print help message
- *
- * @param[in]   pName       program name
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-static void
-print_usage(const char *pName)
-{
-    fprintf(stderr, "Usage: %s [-h][-d][-t [rotate]] [device]\n", pName );
-}
-
diff --git a/touch_egalax/ico_ictl-touch_egalax.h b/touch_egalax/ico_ictl-touch_egalax.h
deleted file mode 100644 (file)
index 47af5d0..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   Device Input Controller(cartouch Touchpanel)
- *          Program common include file
- *
- * @date    Feb-20-2013
- */
-
-#ifndef _ICO_ICTL_TOUCH_EGALAX_H_
-#define _ICO_ICTL_TOUCH_EGALAX_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/input.h>
-#include <linux/uinput.h>
-
-/* Default screen size      */
-#define CALIBRATION_DISP_WIDTH     1920
-#define CALIBRATION_DISP_HEIGHT    1080
-
-/* Configuration file       */
-#define CALIBRATOIN_CONF_LEN_MAX    128
-#define CALIBRATOIN_CONF_ENV        "CALIBRATOIN_CONF"
-#define CALIBRATOIN_INPUT_DEV       "ICTL_TOUCH_DEV"
-#define CALIBRATOIN_CONF_FILE   \
-                        "/opt/etc/ico-uxf-device-input-controller/egalax_calibration.conf"
-
-/* Configuration items      */
-#define CALIBRATOIN_STR_SEPAR       "=*"            /* Delimitor                */
-#define CALIBRATOIN_STR_DISP_W      "DWIDTH"        /* Screen width             */
-#define CALIBRATOIN_STR_DISP_H      "DHEIGHT"       /* Scneen height            */
-#define CALIBRATOIN_STR_POS1        "POSITION1"     /* Top-Left position        */
-#define CALIBRATOIN_STR_POS2        "POSITION2"     /* Top-Right position       */
-#define CALIBRATOIN_STR_POS3        "POSITION3"     /* Bottom-Left position     */
-#define CALIBRATOIN_STR_POS4        "POSITION4"     /* Bottom-Right position    */
-
-/* Error retry              */
-#define CALIBRATOIN_RETRY_COUNT     10              /* number of error retry    */
-#define CALIBRATOIN_RETRY_WAIT      10              /* wait time(ms) for retry  */
-
-/* Debug macros             */
-#define CALIBRATION_DEBUG(fmt, ...) {if (mDebug) {fprintf(stdout, "%s:%d "fmt, __func__, __LINE__, ##__VA_ARGS__); fflush(stdout);}}
-#define CALIBRATION_INFO(fmt, ...)  {if (mDebug) {fprintf(stdout, "%s:%d "fmt, __func__, __LINE__, ##__VA_ARGS__); fflush(stdout);}}
-#define CALIBRATION_PRINT(...)       {fprintf(stdout, ##__VA_ARGS__); fflush(stdout);}
-
-#endif /*_ICO_ICTL_TOUCH_EGALAX_H_*/
-