From a54ab694cdad2a5b50159a27e2f79df4b4a1e8bd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 9 Jun 2013 00:56:35 +0200 Subject: [PATCH] codegen: work around firmware bug, only accept the first found tlv --- data/gen-code.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/data/gen-code.pl b/data/gen-code.pl index 71b738d..c903d6b 100755 --- a/data/gen-code.pl +++ b/data/gen-code.pl @@ -132,9 +132,12 @@ sub gen_tlv_parse_field($$$$) { } } -sub gen_tlv_type($$) { +sub gen_tlv_type($$$) { my $cname = shift; my $elem = shift; + my $idx = shift; + my $idx_word = "found[".int($idx / 32)."]"; + my $idx_bit = "(1 << ".($idx % 32).")"; my $type = $elem->{"format"}; my $id = $elem->{"id"}; @@ -146,6 +149,10 @@ sub gen_tlv_type($$) { print <{name}); - gen_tlv_type($cname, $field); + gen_tlv_type($cname, $field, $i++); } print <