Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ambrop72/badvpn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbroz Bizjak <ambrop7@gmail.com>2016-08-27 18:09:48 +0300
committerAmbroz Bizjak <ambrop7@gmail.com>2016-08-27 18:09:48 +0300
commit432f2ba5119a61d477d77764a4cbb57729c35c45 (patch)
treed5e58125c226fe9d1d8e5e71bcfe797820dee73f
parent64f30f5480fef88edb8f633ffecdbc181f0a6900 (diff)
NCD: Fix evdev event code names with newer headers.
Most of the event codes may be defined in another header file not directly in linux/input.h. Also remove _MAX and _CNT codes.
-rw-r--r--ncd/CMakeLists.txt13
-rwxr-xr-xncd/parse_linux_input.sh13
2 files changed, 18 insertions, 8 deletions
diff --git a/ncd/CMakeLists.txt b/ncd/CMakeLists.txt
index a4feb27..9bd8204 100644
--- a/ncd/CMakeLists.txt
+++ b/ncd/CMakeLists.txt
@@ -171,12 +171,19 @@ if (BADVPN_USE_LINUX_INPUT)
message(FATAL_ERROR "failed to match preprocessor output for path of linux/input.h")
endif ()
set(LINUX_INPUT_H_PATH ${CMAKE_MATCH_1})
-
- message(STATUS "Generating linux_input_names.h from ${LINUX_INPUT_H_PATH}")
+
+ string(REGEX MATCH "\"(/[^\"]+/linux/input-event-codes.h)\"" LINUX_INPUT_EVENT_CODES_MATCH ${LINUX_INPUT_PREPROCESS_OUTPUT})
+ if (NOT LINUX_INPUT_EVENT_CODES_MATCH)
+ set(LINUX_INPUT_EVENT_CODES_H_PATH)
+ else ()
+ set(LINUX_INPUT_EVENT_CODES_H_PATH ${CMAKE_MATCH_1})
+ endif ()
+
+ message(STATUS "Generating linux_input_names.h from ${LINUX_INPUT_H_PATH} ${LINUX_INPUT_EVENT_CODES_H_PATH}")
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/parse_linux_input.sh
- ${LINUX_INPUT_H_PATH}
${CMAKE_CURRENT_BINARY_DIR}/linux_input_names.h
+ ${LINUX_INPUT_H_PATH} ${LINUX_INPUT_EVENT_CODES_H_PATH}
RESULT_VARIABLE LINUX_INPUT_PARSE_RESULT)
if (NOT LINUX_INPUT_PARSE_RESULT EQUAL 0)
message(FATAL_ERROR "failed to generate linux_input_names.h")
diff --git a/ncd/parse_linux_input.sh b/ncd/parse_linux_input.sh
index 9064c1d..65e1409 100755
--- a/ncd/parse_linux_input.sh
+++ b/ncd/parse_linux_input.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
-INPUT=$1
-OUTPUT=$2
+OUTPUT=$1
+shift
+INPUTS=("$@")
types=""
keys=""
@@ -18,10 +19,12 @@ ffstatuss=""
while read LINE; do
tab=$'\t'
space="[ ${tab}]"
- regex="^#define ((EV|SYN|KEY|BTN|REL|ABS|SW|MSC|LED|REP|SND|FF_STATUS)_[A-Z0-9_]+)${space}"
+ regex="^#define ((EV|SYN|KEY|BTN|REL|ABS|SW|MSC|LED|REP|SND|FF_STATUS)_([A-Z0-9_]+))${space}"
if [[ $LINE =~ $regex ]]; then
- type=${BASH_REMATCH[2]}
name=${BASH_REMATCH[1]}
+ type=${BASH_REMATCH[2]}
+ nameonly=${BASH_REMATCH[3]}
+ [[ $nameonly = "MAX" || $nameonly = "CNT" ]] && continue
if [[ $type = "EV" ]]; then
if [[ $name != "EV_VERSION" ]]; then
types="${types} [${name}] = \"${name}\",
@@ -61,7 +64,7 @@ while read LINE; do
"
fi
fi
-done < "${INPUT}"
+done < <(cat "${INPUTS[@]}")
(
echo "