From 5accd05d8aaa6b126e042447df2a20fe8394f64b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 20 Dec 2010 15:02:30 -0200 Subject: [PATCH] gen_keytables.pl: make it work with the newer kernel sources Instead of /IR, use /rc for remote keymap directory. Also, some struct names changed. Signed-off-by: Mauro Carvalho Chehab --- utils/keytable/Makefile | 1 + utils/keytable/gen_keytables.pl | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/utils/keytable/Makefile b/utils/keytable/Makefile index dc3252e..41f4050 100644 --- a/utils/keytable/Makefile +++ b/utils/keytable/Makefile @@ -27,6 +27,7 @@ sync-with-kernel: @printf "\t{ NULL, 0}\n};\n" >>parse.h @-mkdir -p rc_keymaps + @-rm rc_keymaps/* @echo storing existing keymaps at rc_keymaps/ @./gen_keytables.pl $(KERNEL_DIR); diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index 7a62ae3..cf47183 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -80,29 +80,33 @@ sub parse_file($) printf "processing file $filename\n" if ($debug); open IN, "<$filename" or die "couldn't find $filename"; while () { - if (m/struct\s+ir_scancode\s+(\w[\w\d_]+)/) { + if (m/struct\s+rc_map_table\s+(\w[\w\d_]+)/) { flush($filename); $keyname = $1; - $keyname =~ s/^ir_codes_//; + $keyname =~ s/^rc_map_//; $keyname =~ s/_table$//; $read = 1; next; } - if (m/struct\s+rc_keymap.*=\s+{/) { + if (m/struct\s+rc_map_list.*=\s+{/) { $check_type = 1; next; } - if (m/\.name\s*=\s*(RC_MAP_[^\s\,]+)/) { - $name = $1; - } - if ($check_type) { + if (m/\.name\s*=\s*(RC_MAP_[^\s\,]+)/) { + $name = $1; + $keyname = $1; + $keyname =~ s/^RC_MAP_//; + $keyname =~ tr/A-Z/a-z/; + $keyname =~ s/_table$//; + } + if (m/^\s*}/) { $check_type = 0; next; } - if (m/IR_TYPE_([\w\d_]+)/) { + if (m/RC_TYPE_([\w\d_]+)/) { $type = $1; } next; @@ -194,11 +198,11 @@ print OUT_MAP << "EOF"; #driver table file EOF -find({wanted => \&parse_dir, no_chdir => 1}, "$kernel_dir/drivers/media/IR/keymaps"); +find({wanted => \&parse_dir, no_chdir => 1}, "$kernel_dir/drivers/media/rc/keymaps"); foreach my $file (@ir_files) { parse_file "$kernel_dir/$file"; } printf STDERR "WARNING: there are %d tables not defined at rc_maps.h\n", $warn_all if ($warn_all); -close OUT_MAP; \ No newline at end of file +close OUT_MAP; -- 2.7.4