Skip to content

Commit

Permalink
Fix gh#146 : Fixing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kanjoe24 committed Nov 26, 2024
1 parent 67e0443 commit f798c73
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions keyhandler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
17 changes: 5 additions & 12 deletions keyhandler/keyhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
10 changes: 9 additions & 1 deletion keyhandler/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <event_code> -t <event_type> -v <value>"
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 $@

0 comments on commit f798c73

Please sign in to comment.