diff mbox series

[v4l-utils,4/4] keytable: a bpf protocol can have parameters and no scancodes

Message ID 20200129115419.8456-5-sean@mess.org (mailing list archive)
State New, archived
Headers show
Series [v4l-utils,1/4] keytable: support 64 bit scancodes | expand

Commit Message

Sean Young Jan. 29, 2020, 11:54 a.m. UTC
Currently a protocol without scancodes does not get its parameters
parsed.

Signed-off-by: Sean Young <sean@mess.org>
---
 utils/common/keymap.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/utils/common/keymap.c b/utils/common/keymap.c
index 15c31c76..a3c1349e 100644
--- a/utils/common/keymap.c
+++ b/utils/common/keymap.c
@@ -384,13 +384,6 @@  static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot
 		return EINVAL;
 	}
 
-	scancodes = toml_table_in(proot, "scancodes");
-	if (!scancodes) {
-		if (verbose)
-			fprintf(stderr, _("%s: no [protocols.scancodes] section\n"), fname);
-		return 0;
-	}
-
 	for (i = 0; (key = toml_key_in(proot, i)) != NULL; i++) {
 		int64_t value;
 
@@ -408,6 +401,13 @@  static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot
 		}
 	}
 
+	scancodes = toml_table_in(proot, "scancodes");
+	if (!scancodes) {
+		if (verbose)
+			fprintf(stderr, _("%s: no [protocols.scancodes] section\n"), fname);
+		return 0;
+	}
+
 	struct scancode_entry **next = &map->scancode;
 	i = 0;