summaryrefslogtreecommitdiff
path: root/v4l2-apps/util/gen_keytables.pl
blob: fad4ccfeb7da948a505dab049e04e3f6595bd45f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;

my $keyname="";
my $debug=0;

while (<>) {
	if (m/struct\s+(dvb_usb_rc_key|ir_scancode)\s+(\w[\w\d_]+)/) {
		$keyname = $2;
		$keyname =~ s/^ir_codes_//;

		print "Generating keycodes/$keyname\n" if $debug;
		open OUT, ">keycodes/$keyname";
		next;
	}
	if ($keyname ne "") {
		if (m/(0x[\dA-Fa-f]+).*(KEY_[^\s\,\}]+)/) {
			printf OUT "%s %s\n",$1, $2;
			next;
		}
		if (m/\}/) {
			close OUT;
			$keyname="";
			next;
		}
	}
}