summaryrefslogtreecommitdiff
path: root/v4l2-apps/util/gen_keytables.pl
blob: 889516de4d58455cc65fe3aeeb7470e4e619d664 (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
28
#!/usr/bin/perl
use strict;

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

while (<>) {
#IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE] = {
	if (m/IR_KEYTAB_TYPE\s+(\w[\w\d_]+)/) {
		$keyname = $1;
		$keyname =~ s/^ir_codes_//;

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