gen_keytables.pl: make it work with the newer kernel sources
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 20 Dec 2010 17:02:30 +0000 (15:02 -0200)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 20 Dec 2010 17:22:04 +0000 (15:22 -0200)
Instead of /IR, use /rc for remote keymap directory. Also, some struct
names changed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
utils/keytable/Makefile
utils/keytable/gen_keytables.pl

index dc3252e..41f4050 100644 (file)
@@ -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);
 
index 7a62ae3..cf47183 100755 (executable)
@@ -80,29 +80,33 @@ sub parse_file($)
        printf "processing file $filename\n" if ($debug);
        open IN, "<$filename" or die "couldn't find $filename";
        while (<IN>) {
-               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;