From 58a7b19643a0ab2920b01149251e9d0e5b6a9d8e Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Thu, 22 Nov 2001 23:16:03 +0000 Subject: - don't limitate to CLASS ID's with a Protocol number - fix bug that made ID's with a-f not appear (\d not very good to parse hexadecimal) --- generate_usbclass.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/generate_usbclass.pl b/generate_usbclass.pl index 50fe13b..ae85164 100755 --- a/generate_usbclass.pl +++ b/generate_usbclass.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -print q(/* This auto-generated from , don't modify! */ +print q(/* This is auto-generated from , don't modify! */ struct { unsigned long id; @@ -10,18 +10,25 @@ struct { while (<>) { chomp; - if (/^C\s+(\d+)\s+(.*)/) { + if (/^C\s+([\da-f]+)\s+(.*)/) { #- I want alphanumeric but I can't get this [:alnum:] to work :-( ($cat, $cat_descr) = ($1, $2); - } elsif (/^\t(\d+)\s+(.*)/ && defined $cat) { + } elsif (/^\t([\da-f]+)\s+(.*)/ && defined $cat) { ($sub, $sub_descr) = ($1, $2); - $sub =~ /^\d\d$/ or die "bad line $.: sub category number badly formatted ($_)\n"; - } elsif (/^\t\t(\d+)\s+(.*)/ && defined $cat) { - print qq(/* $. */ { 0x$cat$sub$1, "$cat_descr|$sub_descr|$2" },\n); + $sub =~ /^[\da-f]{2}$/ or die "bad line $.: sub category number badly formatted ($_)\n"; + push @without_prot, [ "0x$cat$sub"."00", "/* $. */ { 0x$cat$sub".qq(00, "$cat_descr|$sub_descr" },\n) ]; + } elsif (/^\t\t([\da-f]+)\s+(.*)/ && defined $cat) { + push @everything, qq(/* $. */ { 0x$cat$sub$1, "$cat_descr|$sub_descr|$2" },\n); } elsif (/^\S/) { undef $cat; } } +foreach $l (@without_prot) { + grep { /{ $l->[0], / } @everything or push @everything, $l->[1]; +} + +print sort @everything; + print ' }; -- cgit v1.2.1