@printf "\t{ NULL, 0}\n};\n" >>parse.h
@-mkdir -p rc_keymaps
- @cp rc_maps.cfg.example rc_maps.cfg
@echo storing existing keymaps at rc_keymaps/
@./gen_keytables.pl $(KERNEL_DIR);
install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)/etc
install -m 755 $(TARGETS) $(DESTDIR)$(PREFIX)/bin
- install -m 644 rc_maps.cfg.example $(DESTDIR)/etc
+ install -m 644 rc_maps.cfg $(DESTDIR)/etc
install -m 755 -d $(DESTDIR)/etc/rc_keymaps
install -m 644 rc_keymaps/* $(DESTDIR)/etc/rc_keymaps
my $name;
my $warn;
my $warn_all;
+my %rc_map_names;
my $kernel_dir = shift or die "Need a file name to proceed.";
-sub flush()
+sub flush($)
{
+ my $filename = shift;
+ my $defined;
+
return if (!$keyname || !$out);
print "Creating $dir/$keyname\n";
open OUT, ">$dir/$keyname";
if (!$name) {
$warn++;
+ } else {
+ $defined = 1 if ($rc_map_names{$name});
+ }
+
+ if ($defined) {
+ printf OUT_MAP "*\t%-24s %s\n", $rc_map_names{$name} , $keyname;
+ } else {
+ my $fname = $filename;
+ $fname =~ s,.*/,,;
+ printf OUT_MAP "# *\t*\t\t\t %-20s # found in %s\n", $keyname, $fname;
}
$keyname = "";
open IN, "<$filename" or die "couldn't find $filename";
while (<IN>) {
if (m/struct\s+ir_scancode\s+(\w[\w\d_]+)/) {
- flush();
+ flush($filename);
$keyname = $1;
$keyname =~ s/^ir_codes_//;
}
close IN;
- flush();
+ flush($filename);
printf STDERR "WARNING: keyboard name not found on %d tables at file $filename\n", $warn if ($warn);
parse_file $file;
}
+sub parse_rc_map_names($)
+{
+ my $filename = shift;
+
+ $warn = 0;
+
+ printf "processing file $filename\n" if ($debug);
+ open IN, "<$filename" or die "couldn't find $filename";
+ while (<IN>) {
+ if (m/^\s*\#define\s+(RC_MAP[^\s]+)\s+\"(.*)\"/) {
+ $rc_map_names{$1} = $2;
+ }
+ }
+}
+
# Main logic
#
+parse_rc_map_names "$kernel_dir/include/media/rc-map.h";
+
+open OUT_MAP, ">rc_maps.cfg";
+print OUT_MAP << "EOF";
+#
+# Keymaps table
+#
+# This table creates an association between a keycode file and a kernel
+# driver. It can be used to automatically override a keycode definition.
+#
+# Although not yet tested, it is mented to be added at udev.
+#
+# To use, you just need to run:
+# ./ir-keytable -a
+#
+# Or, if the remote is not the first device:
+# ./ir-keytable -a -s rc1 # for RC at rc1
+#
+
+# Format:
+# driver - name of the driver provided via uevent - use * for any driver
+# table - RC keymap table, provided via uevent - use * for any table
+# file - file name. If directory is not specified, it will default to
+# /etc/rc_keymaps.
+# For example:
+# driver table file
+# cx8800 * ./keycodes/rc5_hauppauge_new
+# * rc-avermedia-m135a-rm-jx ./keycodes/kworld_315u
+# saa7134 rc-avermedia-m135a-rm-jx ./keycodes/keycodes/nec_terratec_cinergy_xs
+# em28xx * ./keycodes/kworld_315u
+# * * ./keycodes/rc5_hauppauge_new
+
+# Table to automatically load the rc maps for the bundled IR's provided with the
+# devices supported by the linux kernel
+
+#driver table file
+EOF
+
find({wanted => \&parse_dir, no_chdir => 1}, "$kernel_dir/drivers/media/IR/keymaps");
foreach my $file (@ir_files) {
}
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
+++ /dev/null
-#
-# Keymaps table
-#
-# This table creates an association between a keycode file and a kernel
-# driver. It can be used to automatically override a keycode definition.
-#
-# Although not yet tested, it is mented to be added at udev.
-#
-# To use, you just need to run:
-# ./ir-keytable -a
-#
-# Or, if the remote is not the first device:
-# ./ir-keytable -a -s rc1 # for RC at rc1
-#
-
-# Format:
-# driver - name of the driver provided via uevent - use * for any driver
-# table - RC keymap table, provided via uevent - use * for any table
-# file - file name. If directory is not specified, it will default to
-# /etc/rc_keymaps.
-
-#driver table file
-cx8800 * ./keycodes/rc5_hauppauge_new
-* rc-avermedia-m135a-rm-jx ./keycodes/kworld_315u
-saa7134 rc-avermedia-m135a-rm-jx ./keycodes/keycodes/nec_terratec_cinergy_xs
-em28xx * ./keycodes/kworld_315u
-* * ./keycodes/rc5_hauppauge_new