apps/system: Move input/monkey to apps/graphics/input

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2025-03-19 10:47:19 +08:00 committed by Xiang Xiao
parent 7a2d5bbc64
commit 7bfd5e5790
28 changed files with 148 additions and 289 deletions

View file

@ -23,5 +23,38 @@
if(CONFIG_GRAPHICS_INPUT_GENERATOR)
nuttx_add_library(input_generator)
file(GLOB CSRCS generator/*.c)
list(REMOVE_ITEM CSRCS ${CMAKE_CURRENT_SOURCE_DIR}/generator/input.c)
target_sources(input_generator PRIVATE ${CSRCS})
endif()
if(CONFIG_GRAPHICS_INPUT_MONKEY)
file(GLOB MONKEY_SRCS monkey/*.c)
list(REMOVE_ITEM MONKEY_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/monkey/monkey_main.c)
set(SRCS monkey/monkey_main.c ${MONKEY_SRCS})
nuttx_add_application(
NAME
monkey
PRIORITY
${CONFIG_GRAPHICS_INPUT_MONKEY_PRIORITY}
STACKSIZE
${CONFIG_GRAPHICS_INPUT_MONKEY_STACKSIZE}
MODULE
${CONFIG_GRAPHICS_INPUT_MONKEY}
SRCS
${SRCS})
endif()
if(CONFIG_GRAPHICS_INPUT_TOOL)
nuttx_add_application(
MODULE
${CONFIG_GRAPHICS_INPUT_TOOL}
NAME
input
STACKSIZE
${CONFIG_GRAPHICS_INPUT_TOOL_STACKSIZE}
PRIORITY
${CONFIG_GRAPHICS_INPUT_TOOL_PRIORITY}
SRCS
generator/input.c)
endif()

View file

@ -9,3 +9,51 @@ config GRAPHICS_INPUT_GENERATOR
---help---
This is a simple input generator library that can be used to
generate input events for testing graphics applications.
menuconfig GRAPHICS_INPUT_MONKEY
tristate "Monkey test"
select UINPUT_TOUCH
select UINPUT_BUTTONS
select LIBC_PRINT_EXTENSION
default n
if GRAPHICS_INPUT_MONKEY
config GRAPHICS_INPUT_MONKEY_PRIORITY
int "Task priority"
default 110
config GRAPHICS_INPUT_MONKEY_STACKSIZE
int "Stack size"
default 4096
config GRAPHICS_INPUT_MONKEY_REC_DIR_PATH
string "Recorder directory path"
default "/data/monkey"
endif
menuconfig GRAPHICS_INPUT_TOOL
tristate "Enable input tool"
default n
select UINPUT_TOUCH
select UINPUT_BUTTONS
select UINPUT_KEYBOARD
---help---
Enable support for a command line input tool.
if GRAPHICS_INPUT_TOOL
config GRAPHICS_INPUT_TOOL_STACKSIZE
int "input stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the input task.
config GRAPHICS_INPUT_TOOL_PRIORITY
int "input priority"
default 100
---help---
The priority of the input task.
endif # GRAPHICS_INPUT_TOOL

View file

@ -23,7 +23,31 @@
include $(APPDIR)/Make.defs
ifneq ($(CONFIG_GRAPHICS_INPUT_GENERATOR),)
CSRCS = $(wildcard generator/*.c)
CSRCS = $(filter-out generator/input.c, $(wildcard generator/*.c))
endif
# Monkey test
ifneq ($(CONFIG_GRAPHICS_INPUT_MONKEY),)
PROGNAME += monkey
PRIORITY += $(CONFIG_GRAPHICS_INPUT_MONKEY_PRIORITY)
STACKSIZE += $(CONFIG_GRAPHICS_INPUT_MONKEY_STACKSIZE)
MODULE += $(CONFIG_GRAPHICS_INPUT_MONKEY)
MAINSRC += monkey/monkey_main.c
CSRCS += $(filter-out monkey/monkey_main.c, $(wildcard monkey/*.c))
endif
# Input tool
ifneq ($(CONFIG_GRAPHICS_INPUT_TOOL),)
PROGNAME += input
PRIORITY += $(CONFIG_GRAPHICS_INPUT_TOOL_PRIORITY)
STACKSIZE += $(CONFIG_GRAPHICS_INPUT_TOOL_STACKSIZE)
MODULE += $(CONFIG_GRAPHICS_INPUT_TOOL)
MAINSRC += generator/input.c
endif
include $(APPDIR)/Application.mk

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/input/input.c
* apps/graphics/input/generator/input.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey.c
* apps/graphics/input/monkey/monkey.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey.h
* apps/graphics/input/monkey/monkey.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_H
#define __APPS_SYSTEM_MONKEY_MONKEY_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_H
/****************************************************************************
* Included Files
@ -97,4 +97,4 @@ bool monkey_set_recorder_path(FAR struct monkey_s *monkey,
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_assert.h
* apps/graphics/input/monkey/monkey_assert.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_ASSERT_H
#define __APPS_SYSTEM_MONKEY_MONKEY_ASSERT_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_ASSERT_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_ASSERT_H
/****************************************************************************
* Included Files
@ -36,4 +36,4 @@
#define MONKEY_ASSERT(expr) DEBUGASSERT(expr)
#define MONKEY_ASSERT_NULL(ptr) MONKEY_ASSERT(ptr != NULL)
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_ASSERT_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_ASSERT_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_dev.c
* apps/graphics/input/monkey/monkey_dev.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_dev.h
* apps/graphics/input/monkey/monkey_dev.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_DEV_H
#define __APPS_SYSTEM_MONKEY_MONKEY_DEV_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_DEV_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_DEV_H
/****************************************************************************
* Included Files
@ -96,4 +96,4 @@ int monkey_dev_get_available(FAR struct monkey_dev_s *devs[], int dev_num);
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_DEV_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_DEV_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_event.c
* apps/graphics/input/monkey/monkey_event.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_event.h
* apps/graphics/input/monkey/monkey_event.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_EVENT_H
#define __APPS_SYSTEM_MONKEY_EVENT_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_EVENT_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_EVENT_H
/****************************************************************************
* Included Files
@ -76,4 +76,4 @@ bool monkey_event_exec(FAR struct monkey_s *monkey,
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_EVENT_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_EVENT_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_log.c
* apps/graphics/input/monkey/monkey_log.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_log.h
* apps/graphics/input/monkey/monkey_log.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_LOG_H
#define __APPS_SYSTEM_MONKEY_MONKEY_LOG_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_LOG_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_LOG_H
/****************************************************************************
* Included Files
@ -105,4 +105,4 @@ enum monkey_log_level_type_e monkey_log_get_level(void);
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_LOG_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_LOG_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_main.c
* apps/graphics/input/monkey/monkey_main.c
*
* SPDX-License-Identifier: Apache-2.0
*
@ -330,7 +330,7 @@ static FAR struct monkey_s *monkey_init(
{
monkey_set_mode(monkey, MONKEY_MODE_RECORD);
if (!monkey_set_recorder_path(monkey,
CONFIG_SYSTEM_MONKEY_REC_DIR_PATH))
CONFIG_GRAPHICS_INPUT_MONKEY_REC_DIR_PATH))
{
goto failed;
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_proc.c
* apps/graphics/input/monkey/monkey_proc.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_recorder.c
* apps/graphics/input/monkey/monkey_recorder.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_recorder.h
* apps/graphics/input/monkey/monkey_recorder.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_RECORDER_H
#define __APPS_SYSTEM_MONKEY_MONKEY_RECORDER_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_RECORDER_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_RECORDER_H
/****************************************************************************
* Included Files
@ -109,4 +109,4 @@ enum monkey_recorder_res_e monkey_recorder_reset(
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_RECORDER_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_RECORDER_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_type.h
* apps/graphics/input/monkey/monkey_type.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_TYPE_H
#define __APPS_SYSTEM_MONKEY_MONKEY_TYPE_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_TYPE_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_TYPE_H
/****************************************************************************
* Included Files
@ -131,4 +131,4 @@ struct monkey_s
} playback_ctx;
};
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_TYPE_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_TYPE_H */

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_utils.c
* apps/graphics/input/monkey/monkey_utils.c
*
* SPDX-License-Identifier: Apache-2.0
*

View file

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/monkey/monkey_utils.h
* apps/graphics/input/monkey/monkey_utils.h
*
* SPDX-License-Identifier: Apache-2.0
*
@ -20,8 +20,8 @@
*
****************************************************************************/
#ifndef __APPS_SYSTEM_MONKEY_MONKEY_UTILS_H
#define __APPS_SYSTEM_MONKEY_MONKEY_UTILS_H
#ifndef __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_UTILS_H
#define __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_UTILS_H
/****************************************************************************
* Included Files
@ -105,4 +105,4 @@ FAR const char *monkey_event_type2name(enum monkey_event_e event);
}
#endif
#endif /* __APPS_SYSTEM_MONKEY_MONKEY_UTILS_H */
#endif /* __APPS_GRAPHICS_INPUT_MONKEY_MONKEY_UTILS_H */

View file

@ -1,35 +0,0 @@
# ##############################################################################
# apps/system/input/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
if(CONFIG_SYSTEM_INPUT)
nuttx_add_application(
MODULE
${CONFIG_SYSTEM_INPUT}
NAME
input
STACKSIZE
${CONFIG_SYSTEM_INPUT_STACKSIZE}
PRIORITY
${CONFIG_SYSTEM_INPUT_PRIORITY}
SRCS
input.c)
endif()

View file

@ -1,28 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SYSTEM_INPUT
tristate "Enable input tool"
default n
depends on INPUT_UINPUT
---help---
Enable support for a command line input tool.
if SYSTEM_INPUT
config SYSTEM_INPUT_STACKSIZE
int "system/input stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the input task.
config SYSTEM_INPUT_PRIORITY
int "input priority"
default 100
---help---
The priority of the input task.
endif # SYSTEM_INPUT

View file

@ -1,25 +0,0 @@
############################################################################
# apps/system/input/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifneq ($(CONFIG_SYSTEM_INPUT),)
CONFIGURED_APPS += $(APPDIR)/system/input
endif

View file

@ -1,32 +0,0 @@
############################################################################
# apps/system/input/Makefile
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
PROGNAME = input
PRIORITY = $(CONFIG_SYSTEM_INPUT_PRIORITY)
STACKSIZE = $(CONFIG_SYSTEM_INPUT_STACKSIZE)
MODULE = $(CONFIG_SYSTEM_INPUT)
MAINSRC = input.c
include $(APPDIR)/Application.mk

View file

@ -1,38 +0,0 @@
# ##############################################################################
# apps/system/monkey/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
if(CONFIG_SYSTEM_MONKEY)
file(GLOB CURRENT_SRCS *.c)
list(REMOVE_ITEM CURRENT_SRCS monkey_main.c)
set(SRCS monkey_main.c ${CURRENT_SRCS})
nuttx_add_application(
NAME
monkey
PRIORITY
${CONFIG_SYSTEM_MONKEY_PRIORITY}
STACKSIZE
${CONFIG_SYSTEM_MONKEY_STACKSIZE}
MODULE
${CONFIG_SYSTEM_MONKEY}
SRCS
${SRCS})
endif()

View file

@ -1,27 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SYSTEM_MONKEY
tristate "Monkey test"
select UINPUT_TOUCH
select UINPUT_BUTTONS
select LIBC_PRINT_EXTENSION
default n
if SYSTEM_MONKEY
config SYSTEM_MONKEY_PRIORITY
int "Task priority"
default 110
config SYSTEM_MONKEY_STACKSIZE
int "Stack size"
default 4096
config SYSTEM_MONKEY_REC_DIR_PATH
string "Recorder directory path"
default "/data/monkey"
endif

View file

@ -1,25 +0,0 @@
############################################################################
# apps/system/monkey/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifneq ($(CONFIG_SYSTEM_MONKEY),)
CONFIGURED_APPS += $(APPDIR)/system/monkey
endif

View file

@ -1,36 +0,0 @@
############################################################################
# apps/system/monkey/Makefile
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
# Monkey test example
PROGNAME = monkey
PRIORITY = $(CONFIG_SYSTEM_MONKEY_PRIORITY)
STACKSIZE = $(CONFIG_SYSTEM_MONKEY_STACKSIZE)
MODULE = $(CONFIG_SYSTEM_MONKEY)
MAINSRC = monkey_main.c
CSRCS += $(filter-out monkey_main.c, $(wildcard *.c))
include $(APPDIR)/Application.mk