aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-08-01 14:36:38 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-01 14:49:07 (GMT)
commitd31a8695b8f47b0b211a52f2ca8ebf9b13565721 (patch)
tree858d855784330bb93a9a736bb319a7e0b0726c17
parent6c09cc89441f9f38ecaee69e69cfde7a2663c9a4 (diff)
gen_keytables.pl: modified to parse the current version of RC tables
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--utils/keytable/Makefile7
-rwxr-xr-xutils/keytable/gen_keytables.pl37
2 files changed, 29 insertions, 15 deletions
diff --git a/utils/keytable/Makefile b/utils/keytable/Makefile
index 5eb1d9a..95d8eb8 100644
--- a/utils/keytable/Makefile
+++ b/utils/keytable/Makefile
@@ -1,14 +1,12 @@
TARGETS = ir-keytable
-IR_FILES = "drivers/media/IR/ir-keymaps.c \
-drivers/media/dvb/dvb-usb/a800.c \
+IR_FILES = "drivers/media/dvb/dvb-usb/a800.c \
drivers/media/dvb/dvb-usb/af9005-remote.c \
drivers/media/dvb/dvb-usb/af9015.c \
drivers/media/dvb/dvb-usb/af9015.h \
drivers/media/dvb/dvb-usb/anysee.c \
drivers/media/dvb/dvb-usb/cinergyT2-core.c \
drivers/media/dvb/dvb-usb/cxusb.c \
-drivers/media/dvb/dvb-usb/dib0700_devices.c \
drivers/media/dvb/dvb-usb/dibusb-common.c \
drivers/media/dvb/dvb-usb/digitv.c \
drivers/media/dvb/dvb-usb/dtt200u.c \
@@ -49,7 +47,8 @@ sync-with-kernel:
@-mkdir -p rc_keymaps
@echo storing existing keymaps at rc_keymaps/
- @for i in `echo $(IR_FILES)`; do ./gen_keytables.pl $(KERNEL_DIR)/$$i; done
+ @for i in $(KERNEL_DIR)/drivers/media/IR/keymaps/*.c; do echo $$i;./gen_keytables.pl $$i; done
+ @for i in `echo $(IR_FILES)`; do echo $$i;./gen_keytables.pl $(KERNEL_DIR)/$$i; done
install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin
diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl
index 625de24..9d295be 100755
--- a/utils/keytable/gen_keytables.pl
+++ b/utils/keytable/gen_keytables.pl
@@ -1,40 +1,55 @@
#!/usr/bin/perl
use strict;
+my $dir="rc_keymaps";
+my $deftype = "UNKNOWN";
+
my $keyname="";
my $debug=0;
my $out;
my $read=0;
+my $type = $deftype;
+my $check_type = 0;
sub flush()
{
return if (!$keyname || !$out);
- open OUT, ">keycodes/$keyname";
+ print "Creating $dir/$keyname\n";
+ open OUT, ">$dir/$keyname";
+ print OUT "# table $keyname, type: $type\n";
print OUT $out;
close OUT;
$keyname = "";
$out = "";
+ $type = $deftype;
}
while (<>) {
- if (m/struct\s+(dvb_usb_rc_key|ir_scancode)\s+(\w[\w\d_]+)/) {
+ if (m/struct\s+ir_scancode\s+(\w[\w\d_]+)/) {
flush();
- $keyname = $2;
+ $keyname = $1;
$keyname =~ s/^ir_codes_//;
+ $keyname =~ s/_table$//;
$read = 1;
next;
}
- if (m/IR_TABLE\(\s*([^\,\s]+)\s*,\s*([^\,\s]+)\s*,\s*([^\,\s]+)\s*\)/) {
- my $name = $1;
- my $type = $2;
- $type =~ s/IR_TYPE_//;
- $out = "# table $name, type: $type\n$out";
- $read = 0;
-
- flush();
+ if (m/struct\s+rc_keymap.*=\s+{/) {
+ $check_type = 1;
+ next;
+ }
+ if ($check_type) {
+ if (m/^\s*}/) {
+ $check_type = 0;
+ next;
+ }
+ if (m/IR_TYPE_([\w\d_]+)/) {
+ $type = $1;
+ }
+ next;
}
+
if ($read) {
if (m/(0x[\dA-Fa-f]+).*(KEY_[^\s\,\}]+)/) {
$out .= "$1 $2\n";

Privacy Policy