Add the tool ico_pseudo_input_device which generates those pseudo devices for a syste... 64/18564/1 accepted/tizen/ivi/panda/20140326.234219 submit/tizen/20140326.084841
authorMasayuki Sasaki <masayuki.sasaki@mail.toyota-td.jp>
Wed, 26 Mar 2014 06:16:19 +0000 (15:16 +0900)
committerMasayuki Sasaki <masayuki.sasaki@mail.toyota-td.jp>
Wed, 26 Mar 2014 07:01:32 +0000 (16:01 +0900)
bug fix: Weston crashes at the time of deletion of surface.
Add surface operation interface for a privilege program.
Add interface which does not update a thumbnail.
bug fix: TIVI-2946 - Incorrect weston.ini with DP output after manually inst
all ico-uxf-homescreen.

Change-Id: Idd2a1da846b34853a3f05463c98dc5979027caf2
Signed-off-by: Masayuki Sasaki <masayuki.sasaki@mail.toyota-td.jp>
16 files changed:
packaging/ico-uxf-weston-plugin.changes
packaging/ico-uxf-weston-plugin.spec
protocol/ico_window_mgr.xml
protocol/ivi-application.xml [deleted file]
protocol/ivi-controller.xml [deleted file]
settings/ico-pseudo-input-device.service [new file with mode: 0644]
settings/weston.ini
src/Makefile.am
src/ico_plugin_loader.c
src/ico_plugin_version.h
src/ico_window_animation.c
src/ico_window_mgr.c
src/ico_window_mgr_private.h
tools/Makefile.am
tools/ico_pseudo_input_device.c [new file with mode: 0644]
tools/ico_send_inputevent.c

index ca63b36..e82fa37 100644 (file)
@@ -1,3 +1,14 @@
+* Wed Mar 26 2014 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/ivi/release/20140312.121542@98097de
+- bug fix: A setup to surface for "no animation" does not function normally.
+- Test tool The name of test_send_input is changed into ico_send_inputevent.
+- Add the tool ico_pseudo_input_device which generates those pseudo devices for a system without a mouse, a touch panel, and a keyboard.
+- The keyboard event function was added to the ico_send_inputevent tool.
+- bug fix: Weston crashes at the time of deletion of surface.
+- Add surface operation interface for a privilege program.
+- Add interface which does not update a thumbnail.
+- Correction of the review indication from a Tizen team.
+- bug fix: TIVI-2946 - Incorrect weston.ini with DP output after manually install ico-uxf-homescreen.
+
 * Fri Feb 28 2014 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/ivi/20140214.223342@8dc903b
 - 0.9.21 release
 -- Some interfaces were added for SystemController corresponding to GENIVI layer management.
index 933b806..7a3573d 100644 (file)
@@ -22,8 +22,10 @@ BuildRequires: genivi-shell-devel
 BuildRequires: weston-ivi-shell-devel
 Requires: weston >= 1.4.0
 Requires: genivi-shell
+Requires: weston-ivi-shell
 Requires: weekeyboard
 Conflicts: weston-ivi-config
+Conflicts: weston-ivi-shell-config
 
 %description
 Weston Plugins for IVI
@@ -50,8 +52,12 @@ make %{?_smp_mflags}
 
 # configurations
 %define weston_conf %{_sysconfdir}/xdg/weston
+%define systemddir /usr/lib/systemd
 mkdir -p %{buildroot}%{weston_conf} > /dev/null 2>&1
+mkdir -p %{buildroot}%{systemddir}/system/multi-user.target.wants > /dev/null 2>&1
 install -m 0644 settings/weston.ini %{buildroot}%{weston_conf}
+install -m 0644 settings/ico-pseudo-input-device.service %{buildroot}%{systemddir}/system/ico-pseudo-input-device.service
+ln -s %{systemddir}/system/ico-pseudo-input-device.service %{buildroot}%{systemddir}/system/multi-user.target.wants/ico-pseudo-input-device.service
 
 %post -p /sbin/ldconfig
 
@@ -64,6 +70,10 @@ install -m 0644 settings/weston.ini %{buildroot}%{weston_conf}
 %dir %{_libdir}/weston/
 %{_libdir}/weston/*.so
 %{_libdir}/libico-uxf-weston-plugin.so.*
+%{_bindir}/ico_send_inputevent
+%{_bindir}/ico_pseudo_input_device
+%{systemddir}/system/ico-pseudo-input-device.service
+%{systemddir}/system/multi-user.target.wants/ico-pseudo-input-device.service
 %{weston_conf}/weston.ini
 
 %files devel
@@ -72,5 +82,4 @@ install -m 0644 settings/weston.ini %{buildroot}%{weston_conf}
 %{_includedir}/%{name}/ico_input_mgr-client-protocol.h
 %{_includedir}/%{name}/ico_window_mgr-client-protocol.h
 %{_includedir}/%{name}/ico_input_mgr.h
-%{_bindir}/ico_send_inputevent
 %{_libdir}/libico-uxf-weston-plugin.so
index cc2a71b..34a2d74 100644 (file)
@@ -13,6 +13,7 @@
       <entry name="show" value="2" summary="animation for shwo surface"/>
       <entry name="move" value="4" summary="animation for move surface"/>
       <entry name="resize" value="8" summary="animation for resize surface"/>
+      <entry name="oneshot" value="0x80" summary="animation chaneg oneshot"/>
     </enum>
 
     <request name="set_animation">
       <arg name="surfaceid" type="uint"/>
     </request>
 
+    <request name="layout_surface">
+      <description summary="set surface layout for privilege application">
+       Set surface layout for privilege application.
+      </description>
+      <arg name="surfaceid" type="uint"/>
+      <arg name="layerid" type="uint"/>
+      <arg name="x" type="int"/>
+      <arg name="y" type="int"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="visible" type="int"/>
+    </request>
+
     <event name="map_surface">
       <description summary="event of surface changed">
        Event of shared surface.
diff --git a/protocol/ivi-application.xml b/protocol/ivi-application.xml
deleted file mode 100644 (file)
index 5dd619b..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="ivi_application">
-
-    <copyright>
-    Copyright (C) 2013 DENSO CORPORATION
-    Copyright (c) 2013 BMW Car IT GmbH
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy
-    of this software and associated documentation files (the "Software"), to deal
-    in the Software without restriction, including without limitation the rights
-    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-    copies of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-    THE SOFTWARE.
-    </copyright>
-
-    <interface name="ivi_surface" version="1">
-        <description summary="application interface to surface in ivi compositor"/>
-
-        <request name="destroy" type="destructor">
-            <description summary="destroy ivi_surface"/>
-        </request>
-
-        <event name="visibility">
-            <description summary="visibility of surface in ivi compositor has changed">
-                The new visibility state is provided in argument visibility.
-                If visibility is 0, the surface has become invisible.
-                If visibility is not 0, the surface has become visible.
-            </description>
-            <arg name="visibility" type="int"/>
-        </event>
-
-    </interface>
-
-    <interface name="ivi_application" version="1">
-        <description summary="interface for ivi applications to use ivi compositor features"/>
-
-        <request name="surface_create">
-            <description summary="create surface in ivi compositor">
-                surface_create will create a new surface with surface_id in ivi compositor,
-                if it does not yet exists. If the surface with surface_id already exists in
-                ivi compositor, the application content provided in argument surface will
-                be used as surface content. If an other ivi application already registered
-                content for surface with surface_id, an error event will indicate the problem.
-            </description>
-            <arg name="id_surface" type="uint"/>
-            <arg name="surface" type="object" interface="wl_surface"/>
-            <arg name="id" type="new_id" interface="ivi_surface"/>
-        </request>
-
-        <enum name="error_code">
-            <description summary="possible error codes returned by ivi compositor">
-                These error codes define all possible error codes returned by ivi compositor
-                on server-side errors.
-            </description>
-            <entry name="unknown_error"   value="1" summary="unknown error encountered"/>
-            <entry name="resource_in_use" value="2" summary="resource is in use and can not be shared"/>
-        </enum>
-
-        <event name="error">
-            <description summary="server-side error detected">
-                The ivi compositor encountered error while processing a request by this
-                application. The error is defined by argument error_code and optional
-                error_text.
-                If the application requires to associate this error event to a request,
-                it can
-                    1. send request
-                    2. force display roundtrip
-                    3. check, if error event was received
-                 but this restricts the application to have only one open request at a time.
-            </description>
-            <arg name="error_code" type="int"/>
-            <arg name="error_text" type="string" allow-null="true"/>
-        </event>
-
-        <event name="wl_shell_info">
-            <arg name="pid" type="int"/>
-            <arg name="title" type="string" allow-null="true"/>
-        </event>
-
-    </interface>
-
-</protocol>
diff --git a/protocol/ivi-controller.xml b/protocol/ivi-controller.xml
deleted file mode 100644 (file)
index 7c6aa0b..0000000
+++ /dev/null
@@ -1,636 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="ivi_controller">
-
-    <copyright>
-    Copyright (C) 2013 DENSO CORPORATION
-    Copyright (c) 2013 BMW Car IT GmbH
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy
-    of this software and associated documentation files (the "Software"), to deal
-    in the Software without restriction, including without limitation the rights
-    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-    copies of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-    THE SOFTWARE.
-    </copyright>
-
-    <interface name="ivi_controller_surface" version="1">
-        <description summary="controller interface to surface in ivi compositor"/>
-
-        <request name="set_visibility">
-            <description summary="set the visibility of a surface in ivi compositor">
-                 If visibility argument is 0, the surface in the ivi compositor is set to invisible.
-                 If visibility argument is not 0, the surface in the ivi compositor is set to visible.
-            </description>
-            <arg name="visibility" type="uint"/>
-        </request>
-
-        <request name="set_opacity">
-            <description summary="set the opacity of a surface in ivi compositor">
-                 The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque).
-            </description>
-            <arg name="opacity" type="fixed"/>
-        </request>
-
-        <request name="set_source_rectangle">
-            <description summary="set the scanout area of a surface in ivi compositor">
-                The source rectangle defines the part of the surface content, that is used for
-                compositing the surface. It can be used, if valid content of the surface is smaller
-                than the surface. Effectively it can be used to zoom the content of the surface.
-                x:      horizontal start position of scanout area within the surface
-                y:      vertical start position of scanout area within the surface
-                width:  width of scanout area within the surface
-                height: height of scanout area within the surface
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_destination_rectangle">
-            <description summary="Set the destination area of a surface within a layer">
-                The destination rectangle defines the position and size of a surface on a layer.
-                The surface will be scaled to this rectangle for rendering.
-                x:      horizontal start position of surface within the layer
-                y:      vertical start position of surface within the layer
-                width : width of surface within the layer
-                height: height of surface within the layer
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_configuration">
-            <description summary="request new buffer size for application content">
-                Request the client providing content for this surface, to resize of the buffers
-                provided as surface content.
-            </description>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_orientation">
-            <description summary="set the orientation of a surface in ivi compositor">
-                The orientation of a surface in ivi compositor can be rotated in 90 degree steps,
-                as defined in orientation enum.
-            </description>
-            <arg name="orientation" type="int"/>
-        </request>
-
-        <request name="screenshot">
-            <description summary="take screenshot of surface">
-                Store a screenshot of the surface content in the file provided by argument filename.
-            </description>
-            <arg name="filename" type="string"/>
-        </request>
-
-        <event name="visibility">
-            <description summary="the visibility of the surface in ivi compositor has changed">
-                The new visibility state is provided in argument visibility.
-                If visibility is 0, the surface has become invisible.
-                If visibility is not 0, the surface has become visible.
-            </description>
-            <arg name="visibility" type="int"/>
-        </event>
-
-        <event name="opacity">
-            <description summary="the opacity of surface in ivi compositor has changed">
-                The new opacity state is provided in argument opacity.
-                The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque).
-            </description>
-            <arg name="opacity" type="fixed"/>
-        </event>
-
-        <event name="source_rectangle">
-            <description summary="the source rectangle of surface in ivi compositor has changed">
-                The scanout region of the surface content has changed.
-                The new values for source rectangle are provided by
-                x:      new horizontal start position of scanout area within the surface
-                y:      new vertical start position of scanout area within the surface
-                width:  new width of scanout area within the surface
-                height: new height of scanout area within the surface
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <event name="destination_rectangle">
-            <description summary="the destination rectangle of surface in ivi compositor has changed">
-                The new values for source rectangle are provided by
-                x:      new horizontal start position of surface within the layer
-                y:      new vertical start position of surface within the layer
-                width : new width of surface within the layer
-                height: new height of surface within the layer
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <event name="configuration">
-            <description summary="the configuration of surface in ivi compositor has changed">
-                The client providing content for this surface was requested to resize the buffer
-                provided as surface content. The requested buffer size is provided by arguments
-                width and height.
-            </description>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <enum name="orientation">
-            <description summary="orientation presets in degrees">
-                The surfaces in ivi controller can be rotated in 90 degrees steps.
-                This enum defines all valid orientations for surfaces.
-            </description>
-            <entry name="0_degrees"   value="0" summary="not rotated"/>
-            <entry name="90_degrees"  value="1" summary="rotated 90 degrees clockwise"/>
-            <entry name="180_degrees" value="2" summary="rotated 180 degrees clockwise"/>
-            <entry name="270_degrees" value="3" summary="rotated 270 degrees clockwise"/>
-        </enum>
-
-        <event name="orientation">
-            <description summary="the orientation of surface in ivi compositor has changed">
-                The new orientation status is provided by argument orientation.
-            </description>
-            <arg name="orientation" type="int"/>
-        </event>
-
-        <enum name="pixelformat">
-            <description summary="pixel format values">
-                Applications can provide buffers as surface content with differernt buffer
-                properties. This enum defines all supported buffer configurations.
-            </description>
-            <entry name="r_8"       value="0" summary="8 bit luminance surface"/>
-            <entry name="rgb_888"   value="1" summary="24 bit rgb surface"/>
-            <entry name="rgba_8888" value="2" summary="24 bit rgb surface with 8 bit alpha"/>
-            <entry name="rgb_565"   value="3" summary="16 bit rgb surface"/>
-            <entry name="rgba_5551" value="4" summary="16 bit rgb surface with binary mask"/>
-            <entry name="rgba_6661" value="5" summary="18 bit rgb surface with binary mask"/>
-            <entry name="rgba_4444" value="6" summary="12 bit rgb surface with 4 bit alpha"/>
-            <entry name="unknown"   value="7" summary="unknown"/>
-        </enum>
-
-        <event name="pixelformat">
-            <description summary="pixelformat for surface in ivi compositor has changed">
-                When client attach buffers as surface content, these buffers have a pixelformat
-                configuration. If the pixelformat of a newly attached buffer is different from
-                the previous buffer configuration, this event is raised.
-                This is also done, when the first buffer is provided by application.
-            </description>
-            <arg name="pixelformat" type="int"/>
-        </event>
-
-        <event name="layer">
-            <description summary="surface in ivi compositor was added to a layer">
-                This surface was added to the render order of the layer defined by argument layer.
-                This is essential for a surface to become visible on screen, since ivi compositors
-                will only render layers (or more precise all surfaces in the render order of a layer).
-            </description>
-            <arg name="layer" type="object" interface="ivi_controller_layer" allow-null="true"/>
-        </event>
-
-        <request name="send_stats">
-            <description summary="request statistics for surface in ivi compositor">
-                These stats contain information required for monitoring, debugging, logging
-                and tracing.
-            </description>
-        </request>
-
-        <event name="stats">
-            <description summary="receive updated statistics for surface in ivi compositor">
-                The information contained in this event is essential for monitoring, debugging,
-                logging and tracing support in IVI systems.
-            </description>
-            <arg name="redraw_count" type="uint"/>
-            <arg name="frame_count" type="uint"/>
-            <arg name="update_count" type="uint"/>
-            <arg name="pid" type="uint"/>
-            <arg name="process_name" type="string" allow-null="true"/>
-        </event>
-
-        <request name="destroy" type="destructor">
-            <description summary="destroy ivi_controller_surface">
-                Request to destroy the ivi_controller_surface. If argument
-                destroy_scene_object id not 0, the surface will be destroyed in
-                ivi compositor. If argument is 0, only the proxy object is destroyed.
-            </description>
-            <arg name="destroy_scene_object" type="int"/>
-        </request>
-
-        <event name="destroyed">
-            <description summary="ivi_controller_surface was destroyed"/>
-        </event>
-
-        <enum name="content_state">
-            <description summary="all possible states of content for a surface">
-                This enum defines all possible content states of a surface. This is
-                required, since surfaces in ivi compositor can exist without applications
-                providing content for them.
-            </description>
-            <entry name="content_available" value="1"
-                   summary="application provided wl_surface for this surface"/>
-            <entry name="content_removed" value="2"
-                   summary="wl_surface was removed for this surface"/>
-        </enum>
-
-        <event name="content">
-            <description summary="content state for surface has changed">
-                Surfaces in ivi compositor can exist without any application or controller
-                referencing it. All surfaces initially have no content. This event indicates
-                when content state has changed. All possible content states are defined
-                in enum content_state.
-            </description>
-            <arg name="content_state" type="int"/>
-        </event>
-
-        <request name="set_input_focus">
-            <description summary="set input focus to this surface">
-                Set input focus state of surface in ivi compositor. If the surface has input
-                focus, all non-graphical inputs (e.g. keyboard) are directed to the application
-                providing the content for this surface.
-                Only one surface can have input focus at a time, so if input focus is enabled
-                for one surface, any other surface with input focus will loose focus.
-                If argument enabled is 0, the input focus from this surface is removed, no
-                surface will have input focus.
-                If argument enabled is not 0, input focus for this surface is enabled.
-            </description>
-            <arg name="enabled" type="int"/>
-        </request>
-
-        <event name="input_focus">
-            <description summary="input focus of surface in ivi compositor has changed">
-                The new input focus state is provided in argument enabled: If enabled is 0,
-                this surface has no longer the input focus. If enbaled is not 0, this surface
-                now has input focus enabled.
-            </description>
-            <arg name="enabled" type="int"/>
-        </event>
-
-    </interface>
-
-    <interface name="ivi_controller_layer" version="1">
-        <description summary="controller interface to layer in ivi compositor"/>
-
-        <request name="set_visibility">
-            <description summary="set visibility of layer in ivi compositor">
-                If visibility argument is 0, the layer in the ivi compositor is set to invisible.
-                If visibility argument is not 0, the layer in the ivi compositor is set to visible.
-            </description>
-            <arg name="visibility" type="uint"/>
-        </request>
-
-        <request name="set_opacity">
-            <description summary="set opacity of layer in ivi compositor">
-                The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque).
-            </description>
-            <arg name="opacity" type="fixed"/>
-        </request>
-
-        <request name="set_source_rectangle">
-            <description summary="set the scanout area of a layer in ivi compositor">
-                The source rectangle defines the part of the layer content, that is used for
-                compositing the screen. It can be used, if valid content of the layer is smaller
-                than the layer. Effectively it can be used to zoom the content of the layer.
-                x:      horizontal start position of scanout area within the layer
-                y:      vertical start position of scanout area within the layer
-                width:  width of scanout area within the layer
-                height: height of scanout area within the layer
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_destination_rectangle">
-           <description summary="Set the destination area of a layer within a screen">
-                The destination rectangle defines the position and size of a layer on a screen.
-                The layer will be scaled to this rectangle for rendering.
-                x:      horizontal start position of layer within the screen
-                y:      vertical start position of layer within the screen
-                width : width of surface within the screen
-                height: height of surface within the screen
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_configuration">
-            <description summary="request new size for layer">
-                Layers are created with an initial size, but they can be resized at runtime.
-                This request changes the widht and height of a layer.
-            </description>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </request>
-
-        <request name="set_orientation">
-            <description summary="set the orientation of a layer in ivi compositor">
-                The orientation of a layer in ivi compositor can be rotated in 90 degree steps,
-                as defined in orientation enum.
-            </description>
-            <arg name="orientation" type="int"/>
-        </request>
-
-        <request name="screenshot">
-            <description summary="take screenshot of layer">
-                Store a screenshot of the layer content in the file provided by argument filename.
-            </description>
-            <arg name="filename" type="string"/>
-        </request>
-
-        <request name="clear_surfaces">
-            <description summary="remove all surfaces from layer render order">
-                A layer has no content assigned to itself, it is a container for surfaces.
-                This request removes all surfaces from the layer render order.
-                Note: the surfaces are not destroyed, they are just no longer contained by
-                the layer.
-            </description>
-        </request>
-
-        <request name="add_surface">
-            <description summary="add a surface to layer render order at nearest z-position">
-                A layer has no content assigned to itself, it is a container for surfaces.
-                This request adds a surface to the topmost position of the layer render order.
-                The added surface will cover all other surfaces of the layer.
-            </description>
-            <arg name="surface" type="object" interface="ivi_controller_surface"/>
-        </request>
-
-        <request name="remove_surface">
-            <description summary="remove a surface from layer render order">
-                A layer has no content assigned to itself, it is a container for surfaces.
-                This request removes one surfaces from the layer render order.
-                Note: the surface is not destroyed, it is just no longer contained by
-                the layer.
-            </description>
-            <arg name="surface" type="object" interface="ivi_controller_surface"/>
-        </request>
-
-        <request name="set_render_order">
-            <description summary="set render order of layer">
-                A layer has no content assigned to itself, it is a container for surfaces.
-                This request removes all surfaces from the layer render order and set a
-                completely new render order.
-            </description>
-            <arg name="id_surfaces" type="array"/>
-        </request>
-
-        <event name="visibility">
-            <description summary="the visibility of the layer in ivi compositor has changed">
-                The new visibility state is provided in argument visibility.
-                If visibility is 0, the layer has become invisible.
-                If visibility is not 0, the layer has become visible.
-            </description>
-            <arg name="visibility" type="int"/>
-        </event>
-
-        <event name="opacity">
-            <description summary="the opacity of layer in ivi compositor has changed">
-                The new opacity state is provided in argument opacity.
-                The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque).
-            </description>
-            <arg name="opacity" type="fixed"/>
-        </event>
-
-        <event name="source_rectangle">
-            <description summary="the source rectangle of layer in ivi compositor has changed">
-                The scanout region of the layer content has changed.
-                The new values for source rectangle are provided by
-                x:      new horizontal start position of scanout area within the layer
-                y:      new vertical start position of scanout area within the layer
-                width:  new width of scanout area within the layer
-                height: new height of scanout area within the layer
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <event name="destination_rectangle">
-            <description summary="the destination rectangle of layer in ivi compositor has changed">
-                The new values for source rectangle are provided by
-                x:      new horizontal start position of layer within the screen
-                y:      new vertical start position of layer within the screen
-                width : new width of layer within the screen
-                height: new height of layer within the screen
-            </description>
-            <arg name="x" type="int"/>
-            <arg name="y" type="int"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <event name="configuration">
-            <description summary="the configuration of layer in ivi compositor has changed">
-                The layer was resized. The new layer size is provided by arguments
-                width and height.
-            </description>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-        </event>
-
-        <event name="orientation">
-            <description summary="the orientation of layer in ivi compositor has changed">
-                The new orientation status is provided by argument orientation.
-            </description>
-            <arg name="orientation" type="int"/>
-        </event>
-
-        <event name="screen">
-            <description summary="layer in ivi compositor was added to a screen">
-                This layer was added to the render order of the screen defined by argument screen.
-                This is essential for a layer to become visible on screen, since ivi compositors
-                will only render screens (or more precise all layers in the render order of a screen).
-            </description>
-            <arg name="screen" type="object" interface="wl_output" allow-null="true"/>
-        </event>
-
-        <request name="destroy" type="destructor">
-            <description summary="destroy ivi_controller_layer">
-                Request to destroy the ivi_controller_layer. If argument
-                destroy_scene_object id not 0, the layer will be destroyed in
-                ivi compositor. If argument is 0, only the proxy object is destroyed.
-            </description>
-            <arg name="destroy_scene_object" type="int"/>
-        </request>
-
-        <event name="destroyed">
-            <description summary="destroyed layer event"/>
-        </event>
-
-    </interface>
-
-    <interface name="ivi_controller_screen" version="1">
-        <description summary="controller interface to screen in ivi compositor"/>
-
-        <request name="destroy" type="destructor">
-            <description summary="destroy ivi_controller_screen"/>
-        </request>
-
-        <request name="clear">
-            <description summary="remove all layers from screen render order">
-                A screen has no content assigned to itself, it is a container for layers.
-                This request removes all layers from the screen render order.
-                Note: the layers are not destroyed, they are just no longer contained by
-                the screen.
-            </description>
-        </request>
-
-        <request name="add_layer">
-            <description summary="add a layer to screen render order at nearest z-position">
-                A screen has no content assigned to itself, it is a container for layers.
-                This request adds a layers to the topmost position of the screen render order.
-                The added layer will cover all other layers of the screen.
-            </description>
-            <arg name="layer" type="object" interface="ivi_controller_layer"/>
-        </request>
-
-        <request name="screenshot">
-            <description summary="take screenshot of screen">
-                Store a screenshot of the screen content in the file provided by argument filename.
-            </description>
-            <arg name="filename" type="string"/>
-        </request>
-
-        <request name="set_render_order">
-            <description summary="set render order of screen">
-                A screen has no content assigned to itself, it is a container for layers.
-                This request removes all layers from the screen render order and set a
-                completely new render order.
-            </description>
-            <arg name="id_layers" type="array"/>
-        </request>
-
-    </interface>
-
-    <interface name="ivi_controller" version="1">
-        <description summary="interface for ivi controllers to use ivi compositor features"/>
-
-        <request name="commit_changes">
-            <description summary="commit all changes requested by client">
-                All requests are not applied directly to scene object, so a controller
-                can set different properties and apply the changes all at once.
-                Note: there's an exception to this. Creation and destruction of
-                scene objects is executed immediately.
-            </description>
-        </request>
-
-        <event name="screen">
-            <description summary="new screen is available">
-                A new screen is announced to the controller. This is typically
-                the case in two cases:
-                    1. controller was just started, ivi compositor announces existing screen
-                    2. a new screen was added to the system at runtime
-            </description>
-            <arg name="id_screen" type="uint"/>
-            <arg name="screen" type="new_id" interface="ivi_controller_screen"/>
-        </event>
-
-        <request name="layer_create">
-            <description summary="create layer in ivi compositor">
-                layer_create will create a new layer with id_layer in ivi compositor,
-                if it does not yet exists. If the layer with id_layer already exists in
-                ivi compositor, a handle to the existing layer is returned and width and
-                height properties are ignored.
-            </description>
-            <arg name="id_layer" type="uint"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
-            <arg name="id" type="new_id" interface="ivi_controller_layer"/>
-        </request>
-
-        <event name="layer">
-            <description summary="new layer is available">
-                A new layer is announced to the controller.
-            </description>
-            <arg name="id_layer" type="uint"/>
-        </event>
-
-        <request name="surface_create">
-            <description summary="create surface in ivi compositor">
-                surface_create will create a new surface with id_surface in ivi compositor,
-                if it does not yet exists. If the surface with id_surface already exists in
-                ivi compositor, a handle to the existing surface is returned.
-            </description>
-            <arg name="id_surface" type="uint"/>
-            <arg name="id" type="new_id" interface="ivi_controller_surface"/>
-        </request>
-
-        <event name="surface">
-            <description summary="new surface is available">
-                A new surface is announced to the controller.
-            </description>
-            <arg name="id_surface" type="uint"/>
-        </event>
-
-        <enum name="object_type">
-            <description summary="available object types in ivi compositor scene">
-                This enum defines all scene object available in ivi compositor.
-            </description>
-            <entry name="surface" value="1" summary="surface object type"/>
-            <entry name="layer"   value="2" summary="layer object type"/>
-            <entry name="screen"  value="3" summary="screen object type"/>
-        </enum>
-
-        <enum name="error_code">
-            <description summary="possible error codes returned in error event">
-                These error codes define all possible error codes returned by ivi compositor
-                on server-side errors.
-            </description>
-            <entry name="unknown_error" value="1" summary="unknown error encountered"/>
-            <entry name="file_error"    value="2" summary="file i/o error encountered"/>
-            <entry name="native_handle_end" value="3" summary="end get_native_handle event"/>
-        </enum>
-
-        <event name="error">
-            <description summary="server-side error detected">
-                The ivi compositor encountered error while processing a request by this
-                controller. The error is defined by argument error_code and optional
-                error_text. Additionally the object type and id is contained in the error
-                event to provide some detailes to handle the error.
-                If the controller requires to associate this error event to a request,
-                it can
-                    1. send request
-                    2. force display roundtrip
-                    3. check, if error event was received
-                 but this restricts the controller to have only one open request at a time.
-            </description>
-            <arg name="object_id" type="int"/>
-            <arg name="object_type" type="int"/>
-            <arg name="error_code" type="int"/>
-            <arg name="error_text" type="string" allow-null="true"/>
-        </event>
-
-        <request name="get_native_handle">
-            <arg name="id_process" type="uint"/>
-            <arg name="title" type="string" allow-null="true"/>
-        </request>
-
-        <event name="native_handle">
-            <arg name="surface" type="new_id" interface="wl_surface"/>
-        </event>
-
-    </interface>
-
-</protocol>
-
diff --git a/settings/ico-pseudo-input-device.service b/settings/ico-pseudo-input-device.service
new file mode 100644 (file)
index 0000000..14ca574
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=Pseude Input Devices for ico-uxf-weston-plugin
+
+[Service]
+Type=simple
+User=root
+Group=root
+ExecStart=/usr/bin/ico_pseudo_input_device -w=1920 -h=1080
+KillSignal=SIGTERM
+
+[Install]
+WantedBy=multi-user.target
index 404ded7..8b6ce12 100644 (file)
@@ -9,9 +9,35 @@ locking=false
 animation=fade
 startup-animation=fade
 
+[ivi-shell]
+cursor-theme=default
+cursor-size=32
+desktop-layer-id=1000
+workspace-background-layer-id=2000
+workspace-layer-id=3000
+application-layer-id=4000
+
+background-image=/usr/share/weston/background.png
+background-id=1001
+panel-image=/usr/share/weston/panel.png
+panel-id=1002
+tiling-image=/usr/share/weston/tiling.png
+tiling-id=1003
+sidebyside-image=/usr/share/weston/sidebyside.png
+sidebyside-id=1004
+fullscreen-image=/usr/share/weston/fullscreen.png
+fullscreen-id=1005
+random-image=/usr/share/weston/random.png
+random-id=1006
+home-image=/usr/share/weston/home.png
+home-id=1007
+workspace-background-color=0x99000000
+workspace-background-id=2001
+
+ivi-surface-creator-path=/usr/bin/IVISurfaceCreator
+
 [input-method]
-#path=/bin/weekeyboard
-path=
+path=/bin/weekeyboard
 
 #[output]
 #name=LVDS1
@@ -40,12 +66,17 @@ name=HDMI3
 transform=90
 
 [output]
+name=DP1
+#mode=1920x1080
+transform=90
+
+[output]
 name=UNKNOWN1
 #mode=1920x1080
 transform=90
 
 [ivi-plugin]
-modules=ivi-shell.so,ivi-controller.so,ico_window_mgr.so,ico_window_animation.so,ico_input_mgr.so
+modules=ivi-shell.so,ivi-shell-ext.so,ivi-controller.so,ico_window_mgr.so,ico_window_animation.so,ico_input_mgr.so
 
 [ivi-display]
 # logical display number list
index 35ff2b8..48eaf76 100644 (file)
@@ -8,8 +8,6 @@ pkginclude_HEADERS =               \
 libico_uxf_weston_plugin_la_LIBADD = -ldrm_intel -lrt -lm
 libico_uxf_weston_plugin_la_LDFLAGS = -version-info 0:9:0
 libico_uxf_weston_plugin_la_SOURCES =          \
-       ivi-application-protocol.c              \
-       ivi-controller-protocol.c               \
        ico_window_mgr-protocol.c               \
        ico_input_mgr-protocol.c
 
@@ -81,12 +79,6 @@ ico_input_mgr_la_SOURCES =                   \
 
 # Wayland protocol(Build by wayland-scanner)
 BUILT_SOURCES =                                                \
-       ivi-application-protocol.c              \
-       ivi-application-server-protocol.h       \
-       ivi-application-client-protocol.h       \
-       ivi-controller-protocol.c               \
-       ivi-controller-server-protocol.h        \
-       ivi-controller-client-protocol.h        \
        ico_window_mgr-protocol.c               \
        ico_window_mgr-server-protocol.h        \
        ico_window_mgr-client-protocol.h        \
index e826ee9..36fd545 100644 (file)
@@ -173,12 +173,12 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[])
 
     if (modules == NULL)    {
         uifw_error("ico_plugin_loader: Leave(No Plugin in config)");
-        if (moddir) free(moddir);
+        free(moddir);
         return -1;
     }
     p = getenv("WESTON_IVI_PLUGIN_DIR");
     if (p)  {
-        if (moddir) free(moddir);
+        free(moddir);
         moddir = strdup(p);
     }
 
@@ -200,7 +200,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[])
             p++;
         }
     }
-    if (moddir) free(moddir);
+    free(moddir);
     free(modules);
     uifw_info("ico_plugin_loader: Leave(module_init)");
 
index 63de2ff..fb5c623 100644 (file)
@@ -1 +1 @@
-#define ICO_PLUIGN_VERSION  "0.9.21 (Mar-11-2014)"
+#define ICO_PLUIGN_VERSION  "0.9.21 (Mar-26-2014)"
index ae7e3b3..0489486 100644 (file)
@@ -320,6 +320,20 @@ ico_window_animation(const int op, void *data)
             usurf->animation.anima = 0;
             wl_list_remove(&usurf->animation.animation.link);
             ret = ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA;
+            if (usurf->org_animation.saved) {
+                usurf->animation.type = usurf->org_animation.type;
+                usurf->animation.anima = usurf->org_animation.anima;
+                usurf->animation.next_anima = usurf->org_animation.next_anima;
+                usurf->animation.hide_anima = usurf->org_animation.hide_anima;
+                usurf->animation.hide_time = usurf->org_animation.hide_time;
+                usurf->animation.show_anima = usurf->org_animation.show_anima;
+                usurf->animation.show_time = usurf->org_animation.show_time;
+                usurf->animation.move_anima = usurf->org_animation.move_anima;
+                usurf->animation.move_time = usurf->org_animation.move_time;
+                usurf->animation.resize_anima = usurf->org_animation.resize_anima;
+                usurf->animation.resize_time = usurf->org_animation.resize_time;
+                usurf->org_animation.saved = 0;
+            }
         }
         usurf->animation.type = op;
 #if  PERFORMANCE_EVALUATIONS > 0
@@ -435,6 +449,20 @@ animation_end(struct uifw_win_surface *usurf, const int disp)
     struct weston_view      *ev;
 
     usurf->animation.state = ICO_WINDOW_MGR_ANIMATION_STATE_NONE;
+    if (usurf->org_animation.saved) {
+        usurf->animation.type = usurf->org_animation.type;
+        usurf->animation.anima = usurf->org_animation.anima;
+        usurf->animation.next_anima = usurf->org_animation.next_anima;
+        usurf->animation.hide_anima = usurf->org_animation.hide_anima;
+        usurf->animation.hide_time = usurf->org_animation.hide_time;
+        usurf->animation.show_anima = usurf->org_animation.show_anima;
+        usurf->animation.show_time = usurf->org_animation.show_time;
+        usurf->animation.move_anima = usurf->org_animation.move_anima;
+        usurf->animation.move_time = usurf->org_animation.move_time;
+        usurf->animation.resize_anima = usurf->org_animation.resize_anima;
+        usurf->animation.resize_time = usurf->org_animation.resize_time;
+        usurf->org_animation.saved = 0;
+    }
     animadata = (struct animation_data *)usurf->animation.animadata;
 
     if (animation_count > 0)    {
index 2b52cb8..ffeac62 100644 (file)
@@ -174,6 +174,10 @@ static void uifw_map_surface(struct wl_client *client, struct wl_resource *resou
                                             /* unmap surface                        */
 static void uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
                                uint32_t surfaceid);
+                                            /* direct layout surface                */
+static void uifw_layout_surface(struct wl_client *client, struct wl_resource *resource,
+                                uint32_t surfaceid, uint32_t layerid, int x, int y,
+                                int width, int height, int visible);
                                             /* bind manager                         */
 static void bind_ico_win_mgr(struct wl_client *client,
                              void *data, uint32_t version, uint32_t id);
@@ -218,7 +222,8 @@ static void (*win_mgr_hook_inputregion)(int set, struct uifw_win_surface *usurf,
 static const struct ico_window_mgr_interface ico_window_mgr_implementation = {
     uifw_set_animation,
     uifw_map_surface,
-    uifw_unmap_surface
+    uifw_unmap_surface,
+    uifw_layout_surface
 };
 
 
@@ -585,8 +590,26 @@ WL_EXPORT   struct uifw_win_surface *
 ico_window_mgr_get_usurf_client(const uint32_t surfaceid, struct wl_client *client)
 {
     struct uifw_win_surface *usurf;
+    struct uifw_client      *uclient;
 
     usurf = ico_window_mgr_get_usurf(surfaceid);
+
+    if (! usurf)    {
+        uclient = ico_window_mgr_find_uclient(client);
+        if (! uclient)  {
+            /* client dose not exist, error         */
+            uifw_trace("ico_window_mgr_get_usurf_client: client=%08x dose not exist",
+                       (int)client);
+            return NULL;
+        }
+        if (&uclient->surface_link == uclient->surface_link.next)   {
+            /* client has no surface                */
+            uifw_trace("ico_window_mgr_get_usurf_client: client=%08x has no surface",
+                       (int)client);
+            return NULL;
+        }
+        usurf = (struct uifw_win_surface *)uclient->surface_link.next;
+    }
     return usurf;
 }
 
@@ -761,13 +784,19 @@ static void
 win_mgr_destroy_client(struct wl_listener *listener, void *data)
 {
     struct uifw_client  *uclient;
+    struct uifw_win_surface *usurf;
+    struct uifw_win_surface *usurf_tmp;
 
     uclient = container_of(listener, struct uifw_client, destroy_listener);
 
     uifw_trace("win_mgr_destroy_client: Enter(uclient=%08x)", (int)uclient);
 
     if (uclient)    {
-        /* Client exist, Destory client management table             */
+        /* Client exist, Destory client surfaces            */
+        wl_list_for_each_safe (usurf, usurf_tmp, &uclient->surface_link, client_link)   {
+            win_mgr_destroy_surface(usurf->surface);
+        }
+        /* Destory client management table                  */
         wl_list_remove(&uclient->link);
         free(uclient);
     }
@@ -1029,7 +1058,8 @@ win_mgr_send_event(int event, uint32_t surfaceid, uint32_t arg1)
             ico_window_mgr_send_window_active(mgr->resource, surfaceid, arg1);
             break;
         case ICO_WINDOW_MGR_DESTROY_SURFACE:    /* surface destroy event    */
-            uifw_trace("win_mgr_send_event: Send DESTROY_SURFACE(surf=%08x)", surfaceid);
+            uifw_trace("win_mgr_send_event: Send DESTROY_SURFACE(surf=%08x) mgr=%08x",
+                       surfaceid, (int)mgr);
             ico_window_mgr_send_destroy_surface(mgr->resource, surfaceid);
             break;
         default:
@@ -1525,53 +1555,93 @@ uifw_set_animation(struct wl_client *client, struct wl_resource *resource,
         if ((*animation != 0) && (*animation != ' '))   {
             animaid = ico_get_animation_name(animation);
             uifw_trace("uifw_set_animation: Leave(OK) type=%d", animaid);
+            if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT)   {
+                if (! usurf->org_animation.saved) {
+                    usurf->org_animation.type = usurf->animation.type;
+                    usurf->org_animation.anima = usurf->animation.anima;
+                    usurf->org_animation.next_anima = usurf->animation.next_anima;
+                    usurf->org_animation.hide_anima = usurf->animation.hide_anima;
+                    usurf->org_animation.hide_time = usurf->animation.hide_time;
+                    usurf->org_animation.show_anima = usurf->animation.show_anima;
+                    usurf->org_animation.show_time = usurf->animation.show_time;
+                    usurf->org_animation.move_anima = usurf->animation.move_anima;
+                    usurf->org_animation.move_time = usurf->animation.move_time;
+                    usurf->org_animation.resize_anima = usurf->animation.resize_anima;
+                    usurf->org_animation.resize_time = usurf->animation.resize_time;
+                    usurf->org_animation.saved = 1;
+                }
+            }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE)  {
                 if ((usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPHIDE) ||
                     (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS))  {
                     usurf->animation.next_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.next_anima = animaid;
                 }
                 else    {
                     usurf->animation.hide_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.hide_anima = animaid;
                 }
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW)  {
                 if ((usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPSHOW) ||
                     (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS))  {
                     usurf->animation.next_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.next_anima = animaid;
                 }
                 else    {
                     usurf->animation.show_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.show_anima = animaid;
                 }
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE)  {
                 if (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPMOVE)    {
                     usurf->animation.next_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.next_anima = animaid;
                 }
                 else    {
                     usurf->animation.move_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.move_anima = animaid;
                 }
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE)    {
                 if (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPRESIZE)  {
                     usurf->animation.next_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.next_anima = animaid;
                 }
                 else    {
                     usurf->animation.resize_anima = animaid;
+                    if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                        usurf->org_animation.resize_anima = animaid;
                 }
             }
         }
         if ((time > 0) && (time < 10000))   {
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE)  {
                 usurf->animation.hide_time = time;
+                if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                    usurf->org_animation.hide_time = time;
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW)  {
                 usurf->animation.show_time = time;
+                if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                    usurf->org_animation.show_time = time;
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE)  {
                 usurf->animation.move_time = time;
+                if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                    usurf->org_animation.move_time = time;
             }
             if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE)    {
                 usurf->animation.resize_time = time;
+                if ((type & ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT) == 0)
+                    usurf->org_animation.resize_time = time;
             }
         }
     }
@@ -1615,8 +1685,10 @@ win_mgr_check_mapsurface(struct weston_animation *animation,
         uifw_detail("win_mgr_check_mapsurface: sm=%08x surf=%08x",
                     (int)sm, sm->usurf->surfaceid);
 #endif
-        win_mgr_change_mapsurface(sm, 0, curtime);
-        if (sm->eventque)   {
+        if ((sm->interval >= 0) || (sm->eventque == 0)) {
+            win_mgr_change_mapsurface(sm, 0, curtime);
+        }
+        if ((sm->interval >= 0) && (sm->eventque != 0)) {
             if (sm->interval < wait)    {
                 wait = sm->interval;
             }
@@ -1666,7 +1738,7 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curti
     int         width;
     int         height;
     uint32_t    format;
-    uint32_t    dtime;
+    int         dtime;
 
 #if 0   /* too many log */
     uifw_detail("win_mgr_change_mapsurface: surf=%08x event=%d", sm->usurf->surfaceid, event);
@@ -1755,17 +1827,28 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curti
                         uifw_perf("SWAP_BUFFER appid=%s surface=%08x CONTENTS",
                                   sm->usurf->uclient->appid, sm->usurf->surfaceid);
 #endif /*PERFORMANCE_EVALUATIONS*/
-                        dtime = curtime - sm->lasttime;
-                        if ((sm->interval > 0) && (dtime < sm->interval))   {
+                        if (sm->interval < 0)   {
                             sm->eventque = 1;
                             event = 0;
                         }
+                        else if (sm->interval > 0)  {
+                            dtime = (int)(curtime - sm->lasttime);
+                            if (dtime < sm->interval)   {
+                                sm->eventque = 1;
+                                event = 0;
+                            }
+                        }
                     }
                     else if (sm->eventque)  {
-                        dtime = curtime - sm->lasttime;
-                        if ((sm->interval > 0) && (dtime < sm->interval))   {
+                        if (sm->interval < 0)   {
                             event = 0;
                         }
+                        else if (sm->interval > 0)  {
+                            dtime = (int)(curtime - sm->lasttime);
+                            if (dtime < sm->interval)   {
+                                event = 0;
+                            }
+                        }
                     }
                     else    {
                         event =0;
@@ -1814,19 +1897,15 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curti
                             event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE;
                         }
                         else    {
-                            dtime = curtime - sm->lasttime;
-                            if ((sm->interval > 0) && (dtime < sm->interval))   {
+                            if (sm->interval < 0)   {
                                 sm->eventque = 1;
                                 event = 0;
-                                uifw_detail("win_mgr_change_mapsurface: PIX %08x new queue",
-                                            sm->usurf->surfaceid);
                             }
-                            else if (sm->eventque)  {
-                                dtime = curtime - sm->lasttime;
-                                if ((sm->interval > 0) && (dtime < sm->interval))   {
+                            else if (sm->interval > 0)  {
+                                dtime = (int)(curtime - sm->lasttime);
+                                if (dtime < sm->interval)   {
+                                    sm->eventque = 1;
                                     event = 0;
-                                    uifw_detail("win_mgr_change_mapsurface: PIX %08x queued",
-                                                sm->usurf->surfaceid);
                                 }
                             }
                         }
@@ -1866,8 +1945,8 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curti
                 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR;
             }
             else    {
-                uifw_warn("win_mgr_change_mapsurface: surface.%08x image read(%s) OK",
-                          sm->usurf->surfaceid, sm->filepath);
+                uifw_trace("win_mgr_change_mapsurface: surface.%08x image read(%s) OK",
+                           sm->usurf->surfaceid, sm->filepath);
             }
         }
         ico_window_mgr_send_map_surface(sm->uclient->mgr->resource, event,
@@ -1891,6 +1970,7 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curti
  * @param[in]   resource    resource of request
  * @param[in]   surfaceid   surface id
  * @param[in]   framerate   frame rate of surface update(frame/sec)
+ *                          if over 999, no change
  * @param[in]   filepath    surface image file path(if NULL, not create file)
  * @return      none
  */
@@ -1975,13 +2055,13 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource,
     }
 
     /* maximum framerate        */
-    if (maptype == ICO_WINDOW_MGR_MAP_TYPE_EGL) {
-        if ((framerate <= 0) || (framerate > 15))
-            framerate = 15;
-    }
-    else    {
-        if ((framerate <= 0) || (framerate > 5))
-            framerate = 5;
+    if (framerate >= 0) {
+        if (maptype == ICO_WINDOW_MGR_MAP_TYPE_EGL) {
+            if (framerate > 30)     framerate = 30;
+        }
+        else    {
+            if ((framerate <= 0) || (framerate > 5))    framerate = 5;
+        }
     }
 
     /* check same surface       */
@@ -2015,7 +2095,8 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource,
         sm->uclient = uclient;
         sm->type = maptype;
         sm->framerate = framerate;
-        sm->interval = (1000 / sm->framerate) - 1;
+        if (framerate < 0)  sm->interval = -1;
+        else                sm->interval = (1000 / sm->framerate) - 1;
         wl_list_insert(_ico_win_mgr->map_list.next, &sm->map_link);
         wl_list_insert(usurf->surf_map.prev, &sm->surf_link);
     }
@@ -2025,7 +2106,8 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource,
                    sm->framerate, framerate);
         if (sm->framerate != framerate) {
             sm->framerate = framerate;
-            sm->interval = (1000 / sm->framerate) - 1;
+            if (framerate < 0)  sm->interval = -1;
+            else                sm->interval = (1000 / sm->framerate) - 1;
             win_mgr_change_mapsurface(sm, 0, weston_compositor_get_time());
         }
         return;
@@ -2153,6 +2235,104 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   uifw_layout_surface: direct layout surface
+ *
+ * @param[in]   client      Weyland client
+ * @param[in]   resource    resource of request
+ * @param[in]   surfaceid   surface id
+ * @param[in]   layerid     layer id
+ * @param[in]   x           X
+ * @param[in]   y           Y
+ * @param[in]   width       width
+ * @param[in]   height      height
+ * @param[in]   visible     visiblity
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+uifw_layout_surface(struct wl_client *client, struct wl_resource *resource,
+                    uint32_t surfaceid, uint32_t layerid, int x, int y,
+                    int width, int height, int visible)
+{
+    struct uifw_win_surface     *usurf;
+    struct weston_layout_layer  *layout_layer;
+    int32_t                     position[2];
+    uint32_t                    dimension[2];
+
+    uifw_trace("uifw_layout_surface: Enter(surf=%08x,layer=%d,x/y=%d/%d,w/h=%d,%d,vis=%d)",
+               surfaceid, layerid, x, y, width, height, visible);
+
+    usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
+    if (! usurf)    {
+        /* surface dose not exist, error        */
+        uifw_trace("uifw_layout_surface: Leave(surface=%08x dose not exist)", surfaceid);
+        return;
+    }
+    if (layerid)    {
+        layout_layer = weston_layout_getLayerFromId(layerid);
+        if (! layout_layer) {
+            /* layer dose not exist                 */
+            uifw_trace("uifw_layout_surface: Leave(layer=%d dose not exist)", layerid);
+            return;
+        }
+        if (weston_layout_layerAddSurface(layout_layer, usurf->ivisurf) == 0)   {
+            if (weston_layout_layerSetVisibility(layout_layer, 1) != 0) {
+                uifw_warn("uifw_layout_surface: layer(%d) visible Error", layerid);
+            }
+        }
+        else    {
+            uifw_warn("uifw_layout_surface: can not add surface(%08x) to layer(%d)",
+                      usurf->surfaceid, layerid);
+        }
+    }
+
+    if ((x >= 0) && (y >= 0) && (width > 0) && (height > 0))    {
+        if (weston_layout_surfaceSetSourceRectangle(usurf->ivisurf,
+                                                    0, 0, width, height) != 0)  {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set source",
+                      usurf->surfaceid);
+        }
+        if (weston_layout_surfaceSetDestinationRectangle(usurf->ivisurf,
+                                                         x, y, width, height) != 0) {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set destination",
+                      usurf->surfaceid);
+        }
+    }
+    else if ((x >= 0) && (y >= 0))  {
+        position[0] = x;
+        position[1] = y;
+        if (weston_layout_surfaceSetPosition(usurf->ivisurf, position) != 0)    {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set source position",
+                      usurf->surfaceid);
+        }
+    }
+    else if ((width > 0) && (height > 0))   {
+        if (weston_layout_surfaceSetSourceRectangle(usurf->ivisurf,
+                                                    0, 0, width, height) != 0)  {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set source",
+                      usurf->surfaceid);
+        }
+        dimension[0] = width;
+        dimension[1] = height;
+        if (weston_layout_surfaceSetDimension(usurf->ivisurf, dimension) != 0)  {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set destination size",
+                      usurf->surfaceid);
+        }
+    }
+    if (visible >= 0)   {
+        if (weston_layout_surfaceSetVisibility(usurf->ivisurf, visible) != 0)   {
+            uifw_warn("uifw_layout_surface: surface(%08x) can not set visibility",
+                      usurf->surfaceid);
+        }
+    }
+    if (weston_layout_commitChanges() != 0) {
+        uifw_warn("uifw_layout_surface: surface(%08x) commit Error", usurf->surfaceid);
+    }
+    uifw_trace("uifw_layout_surface: Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   win_mgr_destroy_surface: surface destroy
  *
  * @param[in]   surface     Weston surface
@@ -2174,6 +2354,12 @@ win_mgr_destroy_surface(struct weston_surface *surface)
     }
     uifw_trace("win_mgr_destroy_surface: Enter(%08x) %08x", (int)surface, usurf->surfaceid);
 
+    /* remove notification listener */
+    if (weston_layout_surfaceRemoveNotification(usurf->ivisurf) != 0)   {
+        uifw_warn("win_mgr_destroy_surface: weston_layout_surfaceRemoveNotification(%08x)"
+                  " Error", usurf->surfaceid);
+    }
+
     /* destory input region         */
     if (win_mgr_hook_destory)   {
         (*win_mgr_hook_destory)(usurf);
@@ -2312,7 +2498,7 @@ win_mgr_takeSurfaceScreenshot(const char *filename, struct uifw_win_surface *usu
     if (fd < 0) {
         uifw_warn("win_mgr_takeSurfaceScreenshot: Leave(file<%s> open Error<%d>)",
                   filename, errno);
-        if (wkbuf)  free(wkbuf);
+        free(wkbuf);
         return -1;
     }
 
@@ -2325,7 +2511,7 @@ win_mgr_takeSurfaceScreenshot(const char *filename, struct uifw_win_surface *usu
                                             0, 0, width, height) != 0)  {
         close(fd);
         uifw_warn("win_mgr_takeSurfaceScreenshot: Leave(read_surface_pixels Error)");
-        if (wkbuf)  free(wkbuf);
+        free(wkbuf);
         return -1;
     }
     uifw_detail("win_mgr_takeSurfaceScreenshot: end  read_surface_pixels");
@@ -2363,7 +2549,6 @@ win_mgr_takeSurfaceScreenshot(const char *filename, struct uifw_win_surface *usu
             uifw_warn("win_mgr_takeSurfaceScreenshot: Leave(file<%s> write Error<%d>)",
                       filename, errno);
             close(fd);
-            if (wkbuf)  free(wkbuf);
             return -1;
         }
     }
@@ -2736,7 +2921,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[])
                   _ico_node_table[i].disp_x, _ico_node_table[i].disp_y,
                   _ico_node_table[i].disp_width, _ico_node_table[i].disp_height);
     }
-    if (displayno)  free(displayno);
+    free(displayno);
 
     /* my node Id ... this version fixed 0  */
     nodeId = ico_ivi_get_mynode();
index 99f3b65..6e3aeff 100644 (file)
@@ -78,8 +78,8 @@ struct uifw_surface_map {
     uint16_t    width;                      /* width                                */
     uint16_t    height;                     /* height                               */
     uint16_t    stride;                     /* stride                               */
-    uint16_t    framerate;                  /* update frame rate (frame/sec)        */
-    uint16_t    interval;                   /* interval time (ms)                   */
+    int16_t     framerate;                  /* update frame rate (frame/sec)        */
+    int16_t     interval;                   /* interval time (ms)                   */
     uint32_t    lasttime;                   /* last event time (ms)                 */
     char        initflag;                   /* map event send flag(0=no/1=yes)      */
     char        eventque;                   /* send event queue flag                */
@@ -88,6 +88,51 @@ struct uifw_surface_map {
     struct wl_list  surf_link;              /* surface map list from UIFW surface   */
 };
 
+/* Animation information    */
+struct uifw_win_surface_animation {         /* wndow animation                      */
+    struct weston_animation animation;      /* weston animation control             */
+    uint16_t    type;                       /* current animation type               */
+    uint16_t    anima;                      /* curremt animation Id                 */
+    uint16_t    next_anima;                 /* next animation Id                    */
+    uint16_t    hide_anima;                 /* animation Id for hide                */
+    uint16_t    hide_time;                  /* animation time(ms) for hide          */
+    uint16_t    show_anima;                 /* animation Id for show                */
+    uint16_t    show_time;                  /* animation time(ms) for show          */
+    uint16_t    move_anima;                 /* animation Id for move                */
+    uint16_t    move_time;                  /* animation time(ms) for move          */
+    uint16_t    resize_anima;               /* animation Id for resize              */
+    uint16_t    resize_time;                /* animation time(ms) for resize        */
+    uint16_t    time;                       /* current animation time(ms)           */
+    uint16_t    pos_x;                      /* start/end X-coordinate               */
+    uint16_t    pos_y;                      /* start/end Y-coordinate               */
+    uint16_t    pos_width;                  /* start/end width                      */
+    uint16_t    pos_height;                 /* start/end height                     */
+    float       alpha;                      /* original alpha                       */
+    short       current;                    /* animation current percentage         */
+    char        state;                      /* animation state                      */
+    char        visible;                    /* need hide(1)/show(2) at end of animation*/
+    char        restrain_configure;         /* restrain surface resize              */
+    char        ahalf;                      /* after half                           */
+    char        no_configure;               /* no send configure to client          */
+    char        res;                        /* (unused)                             */
+    uint32_t    starttime;                  /* start time(ms)                       */
+    void        *animadata;                 /* animation data                       */
+};
+struct uifw_win_surface_anima_save  {       /* wndow animation save                 */
+    uint16_t    saved;                      /* flag for original saved              */
+    uint16_t    type;                       /* current animation type               */
+    uint16_t    anima;                      /* curremt animation Id                 */
+    uint16_t    next_anima;                 /* next animation Id                    */
+    uint16_t    hide_anima;                 /* animation Id for hide                */
+    uint16_t    hide_time;                  /* animation time(ms) for hide          */
+    uint16_t    show_anima;                 /* animation Id for show                */
+    uint16_t    show_time;                  /* animation time(ms) for show          */
+    uint16_t    move_anima;                 /* animation Id for move                */
+    uint16_t    move_time;                  /* animation time(ms) for move          */
+    uint16_t    resize_anima;               /* animation Id for resize              */
+    uint16_t    resize_time;                /* animation time(ms) for resize        */
+};
+
 /* UIFW surface                         */
 struct shell_surface;
 struct weston_layout_surface;
@@ -110,35 +155,10 @@ struct uifw_win_surface {
     char        visible;                    /* visibility                           */
     char        restrain_configure;         /* restrant configure event             */
     char        res[1];                     /* (unused)                             */
-    struct  _uifw_win_surface_animation {   /* wndow animation                      */
-        struct weston_animation animation;  /* weston animation control             */
-        uint16_t    type;                   /* current animation type               */
-        uint16_t    anima;                  /* curremt animation Id                 */
-        uint16_t    next_anima;             /* next animation Id                    */
-        uint16_t    hide_anima;             /* animation Id for hide                */
-        uint16_t    hide_time;              /* animation time(ms) for hide          */
-        uint16_t    show_anima;             /* animation Id for show                */
-        uint16_t    show_time;              /* animation time(ms) for show          */
-        uint16_t    move_anima;             /* animation Id for move                */
-        uint16_t    move_time;              /* animation time(ms) for move          */
-        uint16_t    resize_anima;           /* animation Id for resize              */
-        uint16_t    resize_time;            /* animation time(ms) for resize        */
-        uint16_t    time;                   /* current animation time(ms)           */
-        uint16_t    pos_x;                  /* start/end X-coordinate               */
-        uint16_t    pos_y;                  /* start/end Y-coordinate               */
-        uint16_t    pos_width;              /* start/end width                      */
-        uint16_t    pos_height;             /* start/end height                     */
-        float       alpha;                  /* original alpha                       */
-        short       current;                /* animation current percentage         */
-        char        state;                  /* animation state                      */
-        char        visible;                /* need hide(1)/show(2) at end of animation*/
-        char        restrain_configure;     /* restrain surface resize              */
-        char        ahalf;                  /* after half                           */
-        char        no_configure;           /* no send configure to client          */
-        char        res;                    /* (unused)                             */
-        uint32_t    starttime;              /* start time(ms)                       */
-        void        *animadata;             /* animation data                       */
-    }           animation;
+    struct uifw_win_surface_animation
+                animation;                  /* window animation information         */
+    struct uifw_win_surface_anima_save  
+                org_animation;              /* save original wndow animation        */
     struct wl_list  client_link;            /* surface list of same client          */
     struct wl_list  surf_map;               /* surface map list                     */
     struct wl_list  input_region;           /* surface input region list            */
index 3f1fbc7..f2571f7 100644 (file)
@@ -4,6 +4,7 @@ AM_CFLAGS = $(GCC_CFLAGS)
 AM_CPPFLAGS = -I$(top_srcdir)/src -DUNIT_TEST $(COMPOSITOR_CFLAGS)
 
 bin_PROGRAMS =         \
+       ico_pseudo_input_device \
        ico_send_inputevent
 
 check_LTLIBRARIES = $(TESTS)
@@ -11,5 +12,8 @@ check_PROGRAMS = ico_send_inputevent
 
 AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
 
+ico_pseudo_input_device_SOURCES = ico_pseudo_input_device.c
+ico_pseudo_input_device_LDADD = $(SIMPLE_CLIENT_LIBS)
+
 ico_send_inputevent_SOURCES = ico_send_inputevent.c
 ico_send_inputevent_LDADD = $(SIMPLE_CLIENT_LIBS)
diff --git a/tools/ico_pseudo_input_device.c b/tools/ico_pseudo_input_device.c
new file mode 100644 (file)
index 0000000..f82c1d1
--- /dev/null
@@ -0,0 +1,247 @@
+/*
+ * Copyright Â© 2014 TOYOTA MOTOR CORPORATION.
+ *
+ * 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   Create pseudo input device for Multi Input Manager
+ *
+ * @date    Feb-21-2014
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/input.h>
+#include <linux/uinput.h>
+#include <errno.h>
+
+#include "ico_input_mgr.h"
+#include "ico_input_mgr-client-protocol.h"
+
+                                            /* create pseudo input device       */
+static int ico_create_pseudo_device(const char *device, int type);
+
+static int  uifd_pointer = -1;              /* file descriptor of pointer       */
+static int  uifd_touch = -1;                /* file descriptor of touch-panel   */
+static int  uifd_keyboard = -1;             /* file descriptor of keyboard      */
+static int  mWidth = 1920;                  /* screen width                     */
+static int  mHeight = 1080;                 /* screen height                    */
+static int  mRun = 0;                       /* running flag                     */
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_create_pseudo_device: create pseudo input device
+ *
+ * @param[in]   device          event device name
+ * @param[in]   type            device type
+ *                              (ICO_INPUT_MGR_DEVICE_TYPE_POINTER/KEYBOARD/TOUCH)
+ * @return      uinput device file descriptor
+ * @retval      >= 0            file descriptor
+ * @retval      -1              error
+ */
+/*--------------------------------------------------------------------------*/
+static int
+ico_create_pseudo_device(const char *device, int type)
+{
+    int     fd;
+    int     key;
+    char    devFile[64];
+    struct uinput_user_dev  uinputDevice;
+
+    /* check if exist           */
+    for (key = 0; key < 32; key++)  {
+        snprintf(devFile, sizeof(devFile)-1, "/dev/input/event%d", key);
+        fd = open(devFile, O_RDONLY);
+        if (fd < 0)     continue;
+
+        memset(uinputDevice.name, 0, sizeof(uinputDevice.name));
+        ioctl(fd, EVIOCGNAME(sizeof(uinputDevice.name)), uinputDevice.name);
+        close(fd);
+        if (strcmp(uinputDevice.name, device) == 0) {
+            printf("ico_create_pseudo_device: <%s> already exist.\n", device);
+            fflush(stdout);
+            return -1;
+        }
+    }
+
+    fd = open("/dev/uinput", O_RDWR);
+    if (fd < 0)   {
+        printf("ico_create_pseudo_device: <%s> uinput device open Error<%d>\n",
+               device, errno);
+        fflush(stdout);
+        return -1;
+    }
+    memset(&uinputDevice, 0, sizeof(uinputDevice));
+    strncpy(uinputDevice.name, device, UINPUT_MAX_NAME_SIZE-1);
+    uinputDevice.absmax[ABS_X] = mWidth;
+    uinputDevice.absmax[ABS_Y] = mHeight;
+
+    /* uinput device configuration  */
+    if (write(fd, &uinputDevice, sizeof(uinputDevice)) < (int)sizeof(uinputDevice))   {
+        printf("ico_create_pseudo_device: <%s> uinput device regist Error<%d>\n",
+               device, errno);
+        fflush(stdout);
+        close(fd);
+        return -1;
+    }
+
+    /* uinput set event bits        */
+    ioctl(fd, UI_SET_EVBIT, EV_SYN);
+
+    if (type != ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD) {
+        ioctl(fd, UI_SET_EVBIT, EV_ABS);
+        ioctl(fd, UI_SET_ABSBIT, ABS_X);
+        ioctl(fd, UI_SET_ABSBIT, ABS_Y);
+        if (type == ICO_INPUT_MGR_DEVICE_TYPE_POINTER)  {
+            ioctl(fd, UI_SET_EVBIT, EV_REL);
+            ioctl(fd, UI_SET_ABSBIT, REL_X);
+            ioctl(fd, UI_SET_ABSBIT, REL_Y);
+            ioctl(fd, UI_SET_EVBIT, EV_KEY);
+            ioctl(fd, UI_SET_KEYBIT, BTN_LEFT);
+            ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT);
+            ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE);
+        }
+        else    {
+            ioctl(fd, UI_SET_EVBIT, EV_KEY);
+            ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH);
+            ioctl(fd, UI_SET_KEYBIT, BTN_TOOL_PEN);
+        }
+    }
+    else    {
+        ioctl(fd, UI_SET_EVBIT, EV_KEY);
+        for (key = 0; key < 255; key++)  {
+            ioctl(fd, UI_SET_KEYBIT, key);
+        }
+        ioctl(fd, UI_SET_KEYBIT, BTN_LEFT);
+        ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT);
+        ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE);
+        ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH);
+    }
+    ioctl(fd, UI_SET_EVBIT, EV_MSC);
+    ioctl(fd, UI_SET_MSCBIT, MSC_SCAN);
+
+    if (ioctl(fd, UI_DEV_CREATE, NULL) < 0)   {
+        printf("ico_create_pseudo_device: <%s> uinput device create Error<%d>\n",
+               device, errno);
+        fflush(stdout);
+        close(fd);
+        return -1;
+    }
+    return fd;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   signal_int: signal handler
+ *
+ * @param[in]   signum      signal number(unused)
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+static void
+signal_int(int signum)
+{
+    printf("ico_pseudo_input_device: terminate signal(%d)\n", signum);
+    fflush(stdout);
+    mRun = 0;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   main: main routine of ico_create_pseudo_device
+ *
+ * @param[in]   argc            number of arguments
+ * @param[in]   argv            rgument list
+ * @return      result
+ * @retval      0               success
+ * @retval      1               error
+ */
+/*--------------------------------------------------------------------------*/
+int
+main(int argc, char *argv[])
+{
+    int     i;
+
+    printf("ico_pseudo_input_device: Start\n");
+    fflush(stdout);
+
+    /* get screen width/height          */
+    for (i = 1; i < argc; i++)  {
+        if (strncasecmp(argv[i], "-w=", 3) == 0)    {
+            mWidth = (int)strtol(&argv[i][3], (char **)0, 0);
+            if (mWidth <= 0)    mWidth = 1920;
+        }
+        else if (strncasecmp(argv[i], "-h=", 3) == 0)   {
+            mHeight = (int)strtol(&argv[i][3], (char **)0, 0);
+            if (mHeight <= 0)   mHeight = 1080;
+        }
+        else    {
+            printf("usage: ico_pseudo_input_device [-w=width] [-h=height]\n");
+            fflush(stdout);
+            return 1;
+        }
+    }
+
+#if 0           /* A daemon cannot do in starting by systemd.   */
+    /* change to daemon                 */
+    if (daemon(0, 1) < 0) {
+        printf("ico_pseudo_input_device: can not create daemon\n");
+        fflush(stdout);
+        return 1;
+    }
+#endif
+
+    mRun = 1;
+    signal(SIGINT, &signal_int);
+    signal(SIGTERM, &signal_int);
+    signal(SIGHUP, &signal_int);
+
+    /* create pointer(mouse) device     */
+    uifd_pointer = ico_create_pseudo_device(ICO_PSEUDO_INPUT_POINTER,
+                                            ICO_INPUT_MGR_DEVICE_TYPE_POINTER);
+    /* create touch-panel device        */
+    uifd_touch = ico_create_pseudo_device(ICO_PSEUDO_INPUT_TOUCH,
+                                          ICO_INPUT_MGR_DEVICE_TYPE_TOUCH);
+    /* create keyboard device           */
+    uifd_keyboard = ico_create_pseudo_device(ICO_PSEUDO_INPUT_KEY,
+                                             ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD);
+
+    if ((uifd_pointer < 0) && (uifd_touch < 0) && (uifd_keyboard < 0))  {
+        printf("ico_pseudo_input_device: can not create pseude input devices\n");
+        fflush(stdout);
+        return 1;
+    }
+
+    while (mRun)    {
+        sleep(3600);
+    }
+
+    printf("ico_pseudo_input_device: Exit\n");
+    fflush(stdout);
+    return 0;
+}
index bef0f53..8840ca9 100644 (file)
@@ -27,6 +27,7 @@
 
 #include    <stdio.h>
 #include    <stdlib.h>
+#include    <stdint.h>
 #include    <unistd.h>
 #include    <stdarg.h>
 #include    <string.h>
 #include    <linux/input.h>
 #include    <linux/uinput.h>
 #include    <linux/joystick.h>
+#include    "ico_input_mgr.h"
 
 #define DEV_TOUCH   0
+#define DEV_KEY     2
 #define DEV_JS      1
 #define SPECIALTYPE_XY  9991
 
-static const struct {
+static const struct _event_key  {
     char    *prop;
     short   devtype;
     short   type;
@@ -76,13 +79,102 @@ static const struct {
     { "Triangle", DEV_JS, 1, 3, 6 },
     { "\0", 0, 0, 0, 0 } };
 
+static const struct _event_keyboard {
+    char    *prop;
+    short   code;
+}               event_keyboard[] = {
+    { "ESC", KEY_ESC },
+    { "1", KEY_1 },
+    { "2", KEY_2 },
+    { "3", KEY_3 },
+    { "4", KEY_4 },
+    { "5", KEY_5 },
+    { "6", KEY_6 },
+    { "7", KEY_7 },
+    { "8", KEY_8 },
+    { "9", KEY_9 },
+    { "0", KEY_0 },
+    { "-", KEY_MINUS },
+    { "=", KEY_EQUAL },
+    { "BS", KEY_BACKSPACE },
+    { "TAB", KEY_TAB },
+    { "Q", KEY_Q },
+    { "W", KEY_W },
+    { "E", KEY_E },
+    { "R", KEY_R },
+    { "T", KEY_T },
+    { "Y", KEY_Y },
+    { "U", KEY_U },
+    { "I", KEY_I },
+    { "O", KEY_O },
+    { "P", KEY_P },
+    { "[", KEY_LEFTBRACE },
+    { "]", KEY_RIGHTBRACE },
+    { "ENTER", KEY_ENTER },
+    { "CR", KEY_ENTER },
+    { "NL", KEY_ENTER },
+    { "CTRL", KEY_LEFTCTRL },
+    { "CTL", KEY_LEFTCTRL },
+    { "LEFTCTRL", KEY_LEFTCTRL },
+    { "A", KEY_A },
+    { "S", KEY_S },
+    { "D", KEY_D },
+    { "F", KEY_F },
+    { "G", KEY_G },
+    { "H", KEY_H },
+    { "J", KEY_J },
+    { "K", KEY_K },
+    { "L", KEY_L },
+    { ";", KEY_SEMICOLON },
+    { "'", KEY_APOSTROPHE },
+    { "~", KEY_GRAVE },
+    { "SHIFT", KEY_LEFTSHIFT },
+    { "LEFTSHIFT", KEY_LEFTSHIFT },
+    { "\\", KEY_BACKSLASH },
+    { "Z", KEY_Z },
+    { "X", KEY_X },
+    { "C", KEY_C },
+    { "V", KEY_V },
+    { "B", KEY_B },
+    { "N", KEY_N },
+    { "M", KEY_M },
+    { ",", KEY_COMMA },
+    { ".", KEY_DOT },
+    { "/", KEY_SLASH },
+    { "RIGHTSHIFT", KEY_RIGHTSHIFT },
+    { "*", KEY_KPASTERISK },
+    { "ALT", KEY_LEFTALT },
+    { " ", KEY_SPACE },
+    { "SP", KEY_SPACE },
+    { "SPACE", KEY_SPACE },
+    { "CAPS", KEY_CAPSLOCK },
+    { "CAPSLOCK", KEY_CAPSLOCK },
+    { "F1", KEY_F1 },
+    { "F2", KEY_F2 },
+    { "F3", KEY_F3 },
+    { "F4", KEY_F4 },
+    { "F5", KEY_F5 },
+    { "F6", KEY_F6 },
+    { "F7", KEY_F7 },
+    { "F8", KEY_F8 },
+    { "F9", KEY_F9 },
+    { "F10", KEY_F10 },
+    { "NUM", KEY_NUMLOCK },
+    { "NUMLOCK", KEY_NUMLOCK },
+    { "SCROLL", KEY_SCROLLLOCK },
+    { "SCROLLLOCK", KEY_SCROLLLOCK },
+    { "F11", KEY_F11 },
+    { "F12", KEY_F12 },
+    { "\0", -1 } };
+
 static int  uifd = -1;
 static int  mqid = -1;
 static int  mDebug = 0;
 static int  mRun = 1;
 static int  mTouch = 1;
-static int  mWidth = 1080;
-static int  mHeight = 1920;
+static int  mWidth = 1920;
+static int  mHeight = 1080;
+static int  mRotate = 0;
 static int  mConvert = 0;
 
 static void print_log(const char *fmt, ...);
@@ -119,92 +211,112 @@ init_mq(const int mqkey)
 static void
 init_device(const char *device)
 {
-    int     fd;
     int     ii;
     char    devFile[64];
     char    devName[64];
+    char    wkDev[64];
     struct uinput_user_dev  uinputDevice;
-    uifd = open("/dev/uinput", O_RDWR);
 
-    if (uifd < 0)   {
-        print_log("/dev/uinput open error[%d]", errno);
-        fflush(stderr);
-        exit(1);
-    }
+    if (device[0])  {
+        /* create pseudo input device   */
+        uifd = open("/dev/uinput", O_RDWR);
 
-    memset(&uinputDevice, 0, sizeof(uinputDevice));
-    strncpy(uinputDevice.name, device, UINPUT_MAX_NAME_SIZE-1);
-    uinputDevice.absmax[ABS_X] = mHeight;
-    uinputDevice.absmax[ABS_Y] = mWidth;
-
-    /* uinput device configuration  */
-    if (write(uifd, &uinputDevice, sizeof(uinputDevice)) < (int)sizeof(uinputDevice)) {
-        print_log("/dev/uinput regist error[%d]", errno);
-        fflush(stderr);
-        close(uifd);
-        exit(1);
-    }
+        if (uifd < 0)   {
+            print_log("/dev/uinput open error[%d]", errno);
+            fflush(stderr);
+            exit(1);
+        }
+
+        memset(&uinputDevice, 0, sizeof(uinputDevice));
+        strncpy(uinputDevice.name, device, UINPUT_MAX_NAME_SIZE-1);
+        uinputDevice.absmax[ABS_X] = mWidth;
+        uinputDevice.absmax[ABS_Y] = mHeight;
+
+        /* uinput device configuration  */
+        if (write(uifd, &uinputDevice, sizeof(uinputDevice)) < (int)sizeof(uinputDevice)) {
+            print_log("/dev/uinput regist error[%d]", errno);
+            fflush(stderr);
+            close(uifd);
+            exit(1);
+        }
 
-    /* uinput set event bits        */
-    ioctl(uifd, UI_SET_EVBIT, EV_SYN);
+        /* uinput set event bits        */
+        ioctl(uifd, UI_SET_EVBIT, EV_SYN);
 
-    if ((mTouch != 0) && (mTouch != 3)) {
-        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);
-        if (mTouch == 1)    {
-            ioctl(uifd, UI_SET_KEYBIT, BTN_LEFT);
+        if ((mTouch != 0) && (mTouch != 3)) {
+            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);
+            if (mTouch == 1)    {
+                ioctl(uifd, UI_SET_KEYBIT, BTN_LEFT);
+            }
+            else    {
+                ioctl(uifd, UI_SET_KEYBIT, BTN_TOUCH);
+                ioctl(uifd, UI_SET_KEYBIT, BTN_TOOL_PEN);
+            }
         }
         else    {
-            ioctl(uifd, UI_SET_KEYBIT, BTN_TOUCH);
-            ioctl(uifd, UI_SET_KEYBIT, BTN_TOOL_PEN);
+            ioctl(uifd, UI_SET_EVBIT, EV_REL);
+            ioctl(uifd, UI_SET_RELBIT, REL_X);
+            ioctl(uifd, UI_SET_RELBIT, REL_Y);
+            ioctl(uifd, UI_SET_RELBIT, REL_Z);
+            ioctl(uifd, UI_SET_RELBIT, REL_RX);
+            ioctl(uifd, UI_SET_RELBIT, REL_RY);
+            ioctl(uifd, UI_SET_RELBIT, REL_RZ);
+            ioctl(uifd, UI_SET_EVBIT, EV_KEY);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_RESERVED);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_ESC);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_1);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_2);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_3);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_4);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_5);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_6);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_7);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_8);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_9);
+            ioctl(uifd, UI_SET_KEYBIT, KEY_0);
         }
-    }
-    else    {
-        ioctl(uifd, UI_SET_EVBIT, EV_REL);
-        ioctl(uifd, UI_SET_RELBIT, REL_X);
-        ioctl(uifd, UI_SET_RELBIT, REL_Y);
-        ioctl(uifd, UI_SET_RELBIT, REL_Z);
-        ioctl(uifd, UI_SET_RELBIT, REL_RX);
-        ioctl(uifd, UI_SET_RELBIT, REL_RY);
-        ioctl(uifd, UI_SET_RELBIT, REL_RZ);
-        ioctl(uifd, UI_SET_EVBIT, EV_KEY);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_RESERVED);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_ESC);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_1);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_2);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_3);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_4);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_5);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_6);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_7);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_8);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_9);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_0);
-    }
 
-    ioctl(uifd, UI_SET_EVBIT, EV_MSC);
-    ioctl(uifd, UI_SET_MSCBIT, MSC_SCAN);
+        ioctl(uifd, UI_SET_EVBIT, EV_MSC);
+        ioctl(uifd, UI_SET_MSCBIT, MSC_SCAN);
 
-    /* create event device          */
-    if (ioctl(uifd, UI_DEV_CREATE, NULL) < 0)   {
-        print_log("/dev/uinput create error[%d]", errno);
-        fflush(stderr);
-        close(uifd);
-        exit(1);
+        /* create event device          */
+        if (ioctl(uifd, UI_DEV_CREATE, NULL) < 0)   {
+            print_log("/dev/uinput create error[%d]", errno);
+            fflush(stderr);
+            close(uifd);
+            exit(1);
+        }
+        print_log("## created event device %s", device);
     }
-    print_log("## created event device %s", device);
+    else    {
+        if (mTouch == 2)    {
+            strcpy(wkDev, ICO_PSEUDO_INPUT_TOUCH);
+        }
+        else if (mTouch == 4)   {
+            strcpy(wkDev, ICO_PSEUDO_INPUT_KEY);
+        }
+        else    {
+            strcpy(wkDev, ICO_PSEUDO_INPUT_TOUCH);
+        }
 
-    for (ii = 0; ii < 16; ii++) {
-        snprintf(devFile, 64, "/dev/input/event%d", ii);
-        fd = open(devFile, O_RDONLY);
-        if (fd < 0)     continue;
+        for (ii = 0; ii < 32; ii++) {
+            snprintf(devFile, 64, "/dev/input/event%d", ii);
+            uifd = open(devFile, O_RDWR, 0644);
+            if (uifd < 0)     continue;
 
-        memset(devName, 0, sizeof(devName));
-        ioctl(fd, EVIOCGNAME(sizeof(devName)), devName);
-        close(fd);
-        print_log("%d.event device(%s) is %s", ii+1, devFile, devName);
+            memset(devName, 0, sizeof(devName));
+            ioctl(uifd, EVIOCGNAME(sizeof(devName)), devName);
+            if (strcasecmp(devName, wkDev) == 0)    break;
+            close(uifd);
+        }
+        if (ii >= 32)   {
+            print_log("<%s> dose not exist.", wkDev);
+            fflush(stderr);
+            exit(1);
+        }
     }
     usleep(200*1000);
 }
@@ -244,8 +356,10 @@ convert_value(const char *value, char **errp, int base)
 static void
 send_event(const char *cmd)
 {
+    static int  keypress = 0;
     int     i, j;
-    int     key;
+    int     wkpress;
+    int     key, key2;
     char    prop[64];
     char    value[128];
     int     sec, msec;
@@ -300,34 +414,67 @@ send_event(const char *cmd)
         return;
     }
 
+    key2 = 0;
+    wkpress = -1;
     for (key = 0; event_key[key].prop[0]; key++)    {
         if (strcasecmp(prop, event_key[key].prop) == 0) break;
     }
     if (! event_key[key].prop[0])   {
-        print_log("UnKnown Event name[%s]", prop);
-        return;
+        for (key2 = 0; event_keyboard[key2].prop[0]; key2++)    {
+            if (strcasecmp(prop, event_key[key2].prop) == 0) break;
+            if ((strncasecmp(prop, "key.", 4) == 0) &&
+                (strcasecmp(&prop[4], event_key[key2].prop) == 0)) break;
+            wkpress = 1;
+            if ((strncasecmp(prop, "press.", 6) == 0) &&
+                (strcasecmp(&prop[6], event_key[key2].prop) == 0)) break;
+            if ((strncasecmp(prop, "keypress.", 9) == 0) &&
+                (strcasecmp(&prop[9], event_key[key2].prop) == 0)) break;
+            wkpress = 0;
+            if ((strncasecmp(prop, "release.", 8) == 0) &&
+                (strcasecmp(&prop[8], event_key[key2].prop) == 0)) break;
+            if ((strncasecmp(prop, "keyrelease.", 11) == 0) &&
+                (strcasecmp(&prop[11], event_key[key2].prop) == 0)) break;
+        }
+        if (! event_key[key2].prop[0])  {
+            print_log("UnKnown Event name[%s]", prop);
+            return;
+        }
+        if (wkpress < 0)    {
+            if (keypress == 0)  keypress = 1;
+            else                keypress = 0;
+            wkpress = keypress;
+        }
+        key = -1;
     }
 
     if (mTouch != 0)    {
         memset(&event, 0, sizeof(event));
         gettimeofday(&event.time, NULL);
-        if (event_key[key].type == SPECIALTYPE_XY)  {
+        if ((key >= 0) &&(event_key[key].type == SPECIALTYPE_XY))   {
             event.type = EV_ABS;
-            if (mConvert)   event.code = ABS_Y;
+            if (mRotate)    event.code = ABS_Y;
             else            event.code = ABS_X;
             event.value = convert_value(value, &errp, 0);
             if (mDebug) {
-                print_log("Send Event ABS_%c=%d\t# %d.%03d", mConvert ? 'Y' : 'X',
+                print_log("Send Event ABS_%c=%d\t# %d.%03d", mRotate ? 'Y' : 'X',
                           event.value,
                           (int)event.time.tv_sec, (int)(event.time.tv_usec/1000));
                 fflush(stderr);
             }
+            if (mConvert != 0)  {
+                if ((mRotate == 0) && (mWidth != 1920))    {
+                    event.value = event.value * 1920 / mWidth;
+                }
+                if ((mRotate != 0) && (mHeight != 1080))    {
+                    event.value = event.value * 1080 / mHeight;
+                }
+            }
             if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
                 print_log("event write error 1[%d]", errno);
                 fflush(stderr);
                 return;
             }
-            if (mConvert)   event.code = ABS_X;
+            if (mRotate)    event.code = ABS_X;
             else            event.code = ABS_Y;
             if (*errp == ',')   {
                 event.value = convert_value(errp + 1, (char **)0, 0);
@@ -335,8 +482,16 @@ send_event(const char *cmd)
             else    {
                 event.value = 0;
             }
-            if (mConvert)   {
-                event.value = mHeight - event.value - 1;
+            if (mRotate)    {
+                event.value = mWidth - event.value - 1;
+            }
+            if (mConvert != 0)  {
+                if ((mRotate == 0) && (mHeight != 1080))    {
+                    event.value = event.value * 1080 / mHeight;
+                }
+                else if ((mRotate != 0) && (mWidth != 1920))    {
+                    event.value = event.value * 1920 / mWidth;
+                }
             }
             event.time.tv_usec += 200;
             if (event.time.tv_usec >= 1000000)  {
@@ -344,27 +499,34 @@ send_event(const char *cmd)
                 event.time.tv_usec -= 1000000;
             }
             if (mDebug) {
-                print_log("Send Event ABS_%c=%d\t# %d.%03d", mConvert ? 'X' : 'Y',
+                print_log("Send Event ABS_%c=%d\t# %d.%03d", mRotate ? 'X' : 'Y',
                           event.value,
                           (int)event.time.tv_sec, (int)(event.time.tv_usec/1000));
                 fflush(stderr);
             }
         }
         else    {
-            event.type = event_key[key].type;
+            if (key >= 0)   {
+                event.type = event_key[key].type;
 
-            if (event_key[key].code == -1)   {
-                event.code = convert_value(value, (char **)0, 0);
-            }
-            else    {
-                event.code = event_key[key].code;
-                if (value[0] == 0)  {
-                    event.value = event_key[key].value;
+                if (event_key[key].code == -1)   {
+                    event.code = convert_value(value, (char **)0, 0);
                 }
                 else    {
-                    event.value = convert_value(value, (char **)0, 0);
+                    event.code = event_key[key].code;
+                    if (value[0] == 0)  {
+                        event.value = event_key[key].value;
+                    }
+                    else    {
+                        event.value = convert_value(value, (char **)0, 0);
+                    }
                 }
             }
+            else    {
+                event.type = EV_KEY;
+                event.code = event_keyboard[key2].code;
+                event.value = wkpress ? 1 : 0;
+            }
             if (mDebug) {
                 if ((event.type == EV_ABS) && (event.code == ABS_X))    {
                     print_log("Send Event X=%d\t# %d.%03d", event.value,
@@ -414,12 +576,14 @@ send_event(const char *cmd)
         }
         else    {
             /* send EV_SYN */
-            memset(&event, 0, sizeof(event));
-            gettimeofday(&event.time, NULL);
-            event.type = EV_SYN;
-            event.code = SYN_REPORT;
-            if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-                print_log("syn event write error 3[%d]", errno);
+            if (key >= 0)   {
+                memset(&event, 0, sizeof(event));
+                gettimeofday(&event.time, NULL);
+                event.type = EV_SYN;
+                event.code = SYN_REPORT;
+                if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
+                    print_log("syn event write error 3[%d]", errno);
+                }
             }
         }
     }
@@ -468,7 +632,7 @@ print_log(const char *fmt, ...)
 static void
 usage(const char *prog)
 {
-    fprintf(stderr, "Usage: %s [-device=device] [-w=w] [-h=h] [-c] [{-m/-t/-j/-J}] "
+    fprintf(stderr, "Usage: %s [-device=device] [-w=w] [-h=h] [-r] [-c] [{-m/-t/-k/-j/-J}] "
             "[-mq[=key]] [-d] [event[=value]] [event[=value]] ...\n", prog);
     exit(0);
 }
@@ -485,9 +649,9 @@ main(int argc, char *argv[])
     char    buf[240];
 
     j = 0;
-    mWidth = 1080;
-    mHeight = 1920;
-    strcpy(buf, "ico_test_device");
+    mWidth = 1920;
+    mHeight = 1080;
+    memset(buf, 0, sizeof(buf));
     for (i = 1; i < argc; i++)  {
         if (argv[i][0] == '-')  {
             if (strncasecmp(argv[i], "-device=", 8) == 0)   {
@@ -499,8 +663,11 @@ main(int argc, char *argv[])
             else if (strncasecmp(argv[i], "-h=", 3) == 0)   {
                 mHeight = strtol(&argv[i][3], (char **)0, 0);
             }
+            else if (strcasecmp(argv[i], "-r") == 0)   {
+                mRotate = 1;               /* Rotate screen                 */
+            }
             else if (strcasecmp(argv[i], "-c") == 0)   {
-                mConvert = 1;               /* Convert logical to physical  */
+                mConvert = 1;              /* Convert logical to physical   */
             }
             else if (strcasecmp(argv[i], "-m") == 0)   {
                 mTouch = 1;                 /* Simulate mouse               */
@@ -508,6 +675,9 @@ main(int argc, char *argv[])
             else if (strcasecmp(argv[i], "-t") == 0)   {
                 mTouch = 2;                 /* Simulate touch-panel         */
             }
+            else if (strcasecmp(argv[i], "-k") == 0)   {
+                mTouch = 4;                 /* Simulate keyboard            */
+            }
             else if (strcmp(argv[i], "-j") == 0)   {
                 mTouch = 0;                 /* Simulate joystick            */
             }