diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2012-11-20 14:44:47 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-11-20 14:44:47 -0500 |
commit | bcc69ef934c9d14732e16551032242fa599b44e7 (patch) | |
tree | acc183e5e4ba09ab8893a432514b9fc5a1d78736 | |
parent | test/Makefile.am: fix tests for make distcheck (diff) | |
download | eudev-bcc69ef934c9d14732e16551032242fa599b44e7.tar.gz eudev-bcc69ef934c9d14732e16551032242fa599b44e7.tar.bz2 eudev-bcc69ef934c9d14732e16551032242fa599b44e7.zip |
Reintroduce keymaps build and test
This commit reintroduces code to
1) build src/keymap
2) test keymap/Makefile.am that it has all the key maps listed
3) test that all the key names in keymap/* are in <linux/input.h>
4) do a syntax check on rules/*.rules which now includes
95-keymap.rules and 95-keyboard-force-release.rules
For #4, the regex expressions in rule-syntax-check.py had to be
updated. They do not allow trailing comments via # comment, and
I did not include that. A rule in 95-keymap.rules had to have its
comment moved from the end to another line.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | keymaps-force-release/Makefile.am | 2 | ||||
-rw-r--r-- | keymaps/Makefile.README | 3 | ||||
-rw-r--r-- | keymaps/Makefile.am | 4 | ||||
-rw-r--r-- | rules/95-keymap.rules | 3 | ||||
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/keymap/Makefile.am | 18 | ||||
-rwxr-xr-x | src/keymap/check-keymaps.sh | 15 | ||||
-rwxr-xr-x | test/rule-syntax-check.py | 2 |
10 files changed, 40 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am index 1b30e1e38..3bed25ce4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,11 +4,15 @@ SUBDIRS = \ src \ rules \ hwdb \ - keymaps \ - keymaps-force-release \ docs \ test +if ENABLE_KEYMAP +SUBDIRS += \ + keymaps \ + keymaps-force-release +endif + if ENABLE_MANPAGES SUBDIRS += \ man diff --git a/configure.ac b/configure.ac index 492d5e33d..7df93bfdb 100644 --- a/configure.ac +++ b/configure.ac @@ -297,6 +297,8 @@ AC_CONFIG_FILES([Makefile src/v4l_id/Makefile src/gudev/Makefile src/gudev/gudev-1.0.pc + src/keymap/Makefile + src/keymap/keyboard-force-release.sh src/libudev/Makefile src/libudev/libudev.pc src/udev/Makefile @@ -304,8 +306,4 @@ AC_CONFIG_FILES([Makefile src/test/Makefile test/Makefile]) -# src/keymap/Makefile -# src/keymap/keyboard-force-release.sh -# - AC_OUTPUT diff --git a/keymaps-force-release/Makefile.am b/keymaps-force-release/Makefile.am index 182a752c5..c17017bf4 100644 --- a/keymaps-force-release/Makefile.am +++ b/keymaps-force-release/Makefile.am @@ -4,7 +4,6 @@ rootprefix=@rootprefix@ udevlibexecdir=$(rootprefix)/lib/udev udevkeymapforcereldir = $(udevlibexecdir)/keymaps/force-release -if ENABLE_KEYMAP dist_udevkeymapforcerel_DATA = \ dell-touchpad \ dell-xps \ @@ -12,4 +11,3 @@ dist_udevkeymapforcerel_DATA = \ samsung-other \ samsung-90x3a \ common-volume-keys -endif diff --git a/keymaps/Makefile.README b/keymaps/Makefile.README new file mode 100644 index 000000000..18bd33469 --- /dev/null +++ b/keymaps/Makefile.README @@ -0,0 +1,3 @@ +Because of the parsing done by src/keymap/check-keymaps.sh, +you should not put anything in this directory except for +keymap files and files begining with Makefile. diff --git a/keymaps/Makefile.am b/keymaps/Makefile.am index f2dbb4202..f3f1d9adc 100644 --- a/keymaps/Makefile.am +++ b/keymaps/Makefile.am @@ -4,7 +4,6 @@ rootprefix=@rootprefix@ udevlibexecdir=$(rootprefix)/lib/udev udevkeymapdir = $(udevlibexecdir)/keymaps -if ENABLE_KEYMAP dist_udevkeymap_DATA = \ acer \ acer-aspire_5720 \ @@ -66,6 +65,3 @@ dist_udevkeymap_DATA = \ toshiba-satellite_a110 \ toshiba-satellite_m30x \ zepto-znote - -endif - diff --git a/rules/95-keymap.rules b/rules/95-keymap.rules index 506310ef7..0ae852265 100644 --- a/rules/95-keymap.rules +++ b/rules/95-keymap.rules @@ -99,7 +99,8 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP EliteBook 8440p", RUN+="keymap $name hewlett-packard_elitebook-8440p" # HP Pavillion dv6315ea has empty DMI_VENDOR -ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play +# quick play +ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # Gateway clone of Acer Aspire One AOA110/AOA150 ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" diff --git a/src/Makefile.am b/src/Makefile.am index 8b5821fa1..80097a31b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ SUBDIRS += \ scsi_id \ v4l_id -#if ENABLE_KEYMAP -#SUBDIRS += \ -# keymap -#endif +if ENABLE_KEYMAP +SUBDIRS += \ + keymap +endif diff --git a/src/keymap/Makefile.am b/src/keymap/Makefile.am index 80f87f734..942009edb 100644 --- a/src/keymap/Makefile.am +++ b/src/keymap/Makefile.am @@ -4,6 +4,11 @@ rootprefix=@rootprefix@ udevlibexecdir=$(rootprefix)/lib/udev udevhomedir = $(udevlibexecdir) +AM_CPPFLAGS = \ + -I $(top_srcdir)/src/libudev \ + -I $(top_srcdir)/src/udev \ + -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + udevlibexec_PROGRAMS = \ keymap @@ -11,7 +16,10 @@ keymap_SOURCES = \ keymap.c keymap_CPPFLAGS = \ - $(AM_CPPFLAGS) -I keymap + $(AM_CPPFLAGS) + +keymap_LDADD = \ + $(top_builddir)/src/udev/libudev-core.la nodist_keymap_SOURCES = \ keys-from-name.h \ @@ -35,6 +43,10 @@ CLEANFILES = \ keys-from-name.gperf \ keyboard-force-release.sh +EXTRA_DIST = \ + check-keymaps.sh \ + keyboard-force-release.sh.in + keys.txt: Makefile $(AM_V_at)$(MKDIR_P) $(dir $@) $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ @@ -47,7 +59,3 @@ keys-from-name.h: keys-from-name.gperf Makefile keys-to-name.h: keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ - -EXTRA_DIST = \ - check-keymaps.sh \ - keyboard-force-release.sh.in diff --git a/src/keymap/check-keymaps.sh b/src/keymap/check-keymaps.sh index c4572745e..e3abe672d 100755 --- a/src/keymap/check-keymaps.sh +++ b/src/keymap/check-keymaps.sh @@ -3,18 +3,21 @@ # check that all key names in keymaps/* are known in <linux/input.h> # and that all key maps listed in the rules are valid and present in # Makefile.am -SRCDIR=${1:-.} -KEYLIST=${2:-src/udev/keymap/keys.txt} -KEYMAPS_DIR=$SRCDIR/keymaps -RULES=$SRCDIR/src/udev/keymap/95-keymap.rules + +SRCDIR=${1:-../..} +KEYLIST=${2:-${SRCDIR}/src/keymap/keys.txt} [ -e "$KEYLIST" ] || { echo "need $KEYLIST please build first" >&2 exit 1 } +KEYMAPS_DIR=${SRCDIR}/keymaps +KEYMAPS_LIST=$(ls ${KEYMAPS_DIR}/* | grep -v Makefile) +RULES=${SRCDIR}/rules/95-keymap.rules + missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ - <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) + <(grep -hv '^#' ${KEYMAPS_LIST}| awk '{print $2}' | sort -u)) [ -z "$missing" ] || { echo "ERROR: unknown key names in keymaps/*:" >&2 echo "$missing" >&2 @@ -31,7 +34,7 @@ for m in $maps; do echo "ERROR: unknown map name in $RULES: $m" >&2 exit 1 } - grep -q "keymaps/$m\>" $SRCDIR/Makefile.am || { + grep -q "$m\>" ${SRCDIR}/keymaps/Makefile.am || { echo "ERROR: map file $m is not added to Makefile.am" >&2 exit 1 } diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py index 4b602a925..9a0db2501 100755 --- a/test/rule-syntax-check.py +++ b/test/rule-syntax-check.py @@ -28,7 +28,7 @@ if len(sys.argv) < 2: no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$') args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$') no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$') -args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)\s*"([^"]*)"$') +args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([][a-zA-Z0-9/_.*%-]+)}\s*(=|==|\+=)\s*"([^"]*)"$') result = 0 buffer = '' |