From f798c7387bb1c9f4202a85eed16d8dc1fc03555a Mon Sep 17 00:00:00 2001 From: kanjoe24 <165808281+kanjoe24@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:20:36 +0000 Subject: [PATCH] Fix gh#146 : Fixing review comments --- Makefile | 5 +++-- keyhandler/Makefile | 6 ------ keyhandler/keyhandler.c | 17 +++++------------ keyhandler/run.sh | 10 +++++++++- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 643f3ed..81f1c12 100755 --- a/Makefile +++ b/Makefile @@ -118,9 +118,10 @@ all: framework $(OBJS) # Recursive make is needed as src files are not available during the first iteration framework: checkvariantchange createdirs download_and_build @${ECHOE} ${GREEN}Framework downloaded and built${NC} + @cp $(UT_CONTROL)/build/$(TARGET)/lib/libut_control.* $(LIB_DIR) + @cp $(UT_CONTROL)/build/$(TARGET)/lib/libut_control.* $(BIN_DIR) + @${ECHOE} ${GREEN}ut-control LIB Copied to [${BIN_DIR}] and [${LIB_DIR}]${NC} @make test VARIANT=${VARIANT} - @cp -r $(UT_CONTROL)/build/$(TARGET)/lib/libut_control.* $(LIB_DIR) $(BIN_DIR) - @${ECHOE} ${GREEN}ut-control LIB Copied to [${BIN_DIR}]${NC} @if [ -d "$(TOP_DIR)/../include" ] && [ -d "$(BUILD_DIR)/src" ]; then \ ${UT_CORE_DIR}/compare-functions-in-headers-testsuite.sh $(TOP_DIR)/../include $(BIN_DIR)/${TARGET_EXEC} ${TARGET}; \ fi diff --git a/keyhandler/Makefile b/keyhandler/Makefile index f270ec9..4009dbe 100644 --- a/keyhandler/Makefile +++ b/keyhandler/Makefile @@ -24,7 +24,6 @@ TARGET_EXEC = ut_core_key_input # Variables CC = gcc -ggdb -o0 -Wall -#CFLAGS = -Wall -Wextra -pedantic -std=c11 SRC = keyhandler.c ../src/ut_kvp_profile.c INC_DIRS = ../include ../framework/CUnit-2.1-3/CUnit/Headers ../framework/ut-control/include @@ -39,15 +38,10 @@ all: $(TARGET_EXEC) # Build target $(TARGET_EXEC): $(SRC) @$(CC) $(SRC) $(XCFLAGS) $(XLDFLAGS) -o $(TARGET_EXEC) - @cp -r ../framework/ut-control/build/linux/lib/libut_control.* . # Clean target clean: @rm -f $(TARGET_EXEC) -# # Run target -# run: $(TARGTARGET_EXECET) -# ./$(TARGET_EXEC) -p linux_profile_5.28.yaml -m mykeymessage.yaml - # Phony targets .PHONY: all clean diff --git a/keyhandler/keyhandler.c b/keyhandler/keyhandler.c index e4215d2..bf498c7 100644 --- a/keyhandler/keyhandler.c +++ b/keyhandler/keyhandler.c @@ -182,26 +182,19 @@ int main(int argc, char *argv[]) ioctl(fd, UI_DEV_SETUP, &usetup); ioctl(fd, UI_DEV_CREATE); - sleep(1); // Print the parsed arguments - UT_LOG_DEBUG("Profile file: %s\n", profile_file); - UT_LOG_DEBUG("type: %s\n", type); - UT_LOG_DEBUG("code: %s\n", code); - UT_LOG_DEBUG("value: %d\n", value); + //UT_LOG_DEBUG("Profile file: %s\n", profile_file); + //UT_LOG_DEBUG("type: %s\n", type); + //UT_LOG_DEBUG("code: %s\n", code); + //UT_LOG_DEBUG("value: %d\n", value); /* Key press, report the event, send key release, and report again */ emit(fd, get_type(pInstance, type), get_code(pInstance, type, code), value); - // /* - // * Give userspace some time to read the events before we destroy the - // * device with UI_DEV_DESTROY. - // */ - sleep(1); - ioctl(fd, UI_DEV_DESTROY); close(fd); ut_kvp_profile_close(); return 0; -} \ No newline at end of file +} diff --git a/keyhandler/run.sh b/keyhandler/run.sh index 9467916..81313a5 100755 --- a/keyhandler/run.sh +++ b/keyhandler/run.sh @@ -21,5 +21,13 @@ set -e # error out if required +# Check if $@ is empty +if [ $# -eq 0 ]; then + echo "Error: No arguments provided." + echo "Usage: ${0} -c -t -v " + exit 1 +fi + +cp ../build/linux/lib/libut_control.so . export LD_LIBRARY_PATH=/usr/lib:/lib:/home/root:. -./ut_core_key_input -p input-event-codes-5.15.yaml -c KEY_SPACE -t EV_KEY -v 1 +./ut_core_key_input -p input-event-codes-5.15.yaml $@