This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: gen_keytables.pl: remove duplicate scancodes from keymap
Author:  Sean Young <[email protected]>
Date:    Wed Jul 3 14:49:19 2019 +0100

One scancode can only be mapped to one keycode. In addition, the
toml is invalid so the keymap cannot be loaded.

Cc: Bastien Nocera <[email protected]>
Signed-off-by: Sean Young <[email protected]>

 utils/keytable/gen_keytables.pl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=2ff1e6b3d67dbbdde212c8cf0de603f9f52078ed
diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl
index 8f3a87e65e73..c14aded32da9 100755
--- a/utils/keytable/gen_keytables.pl
+++ b/utils/keytable/gen_keytables.pl
@@ -76,6 +76,7 @@ sub parse_file($$)
        my $legacy = shift;
 
        my $num_tables = 0;
+       my %scancodes = ();
        $warn = 0;
 
        next if ($filename =~ m/\.mod.c/);
@@ -101,6 +102,7 @@ sub parse_file($$)
                        $keyname =~ s/_table$//;
                        $read = 1;
                        $num_tables++;
+                       %scancodes = ();
                        next;
                }
                if (m/struct\s+rc_map_list.*=\s+{/) {
@@ -142,7 +144,15 @@ sub parse_file($$)
 
                if ($read) {
                        if (m/(0x[\dA-Fa-f]+)[\s\,]+(KEY|BTN)(\_[^\s\,\}]+)/) {
-                               $out .= "$1 = \"$2$3\"\n";
+                               my $scancode = hex($1);
+                               my $keycode = "$2$3";
+
+                               if (exists($scancodes{$scancode})) {
+                                       printf STDERR "WARNING: duplicate 
scancode $1 in file $filename, set to $keycode and $scancodes{$scancode}\n";
+                               } else {
+                                       $out .= "$1 = \"$keycode\"\n";
+                                       $scancodes{$scancode} = $keycode;
+                               }
                                next;
                        }
                        if (m/\}/) {

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to