ids-update.pl revision f9cd22249dbdcebe2ab54eea56c0b32e2a1c2ce5
use strict;
use warnings;
sub usb_vendor {
my $vendor;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported and updated from: http://www.linux-usb.org/usb.ids\n");
$line =~ s/\s+$//;
if (defined $1) {
$vendor = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
if (defined $1) {
my $product = uc $1;
my $text = $2;
print(OUT "\n");
}
}
close(IN);
close(OUT);
}
sub usb_classes {
my $class;
my $subclass;
my $protocol;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported and updated from: http://www.linux-usb.org/usb.ids\n");
$line =~ s/\s+$//;
if (defined $1) {
$class = uc $1;
if ($class =~ m/^00$/) {
next;
}
my $text = $2;
print(OUT "\n");
next;
}
if (not defined $class) {
next;
} elsif ($line =~ m/^$/) {
last;
}
if (defined $1) {
$subclass = uc $1;
if ($subclass =~ m/^00$/) {
next;
}
my $text = $2;
next;
}
print(OUT "\n");
next;
}
if (defined $1) {
$protocol = uc $1;
my $text = $2;
next;
}
print(OUT "\n");
}
}
close(IN);
close(OUT);
}
sub pci_vendor {
my $vendor;
my $device;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported and updated from: http://pci-ids.ucw.cz/v2.2/pci.ids\n");
$line =~ s/\s+$//;
if (defined $1) {
$vendor = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
if (defined $1) {
$device = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
if (defined $1) {
my $sub_vendor = uc $1;
my $sub_device = uc $2;
my $text = $3;
print(OUT "\n");
print(OUT "pci:v0000" . $vendor . "d0000" . $device . "sv0000" . $sub_vendor . "sd0000" . $sub_device . "*\n");
}
}
close(IN);
close(OUT);
}
sub pci_classes {
my $class;
my $subclass;
my $interface;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported and updated from: http://pci-ids.ucw.cz/v2.2/pci.ids\n");
$line =~ s/\s+$//;
if (defined $1) {
$class = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
if (not defined $class) {
next;
} elsif ($line =~ m/^$/) {
last;
}
if (defined $1) {
$subclass = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
if (defined $1) {
$interface = uc $1;
my $text = $2;
print(OUT "\n");
}
}
close(IN);
close(OUT);
}
sub oui {
my $iab_prefix;
my %iab_prefixes = ();
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported and updated from: http://standards.ieee.org/develop/regauth/iab/iab.txt\n" .
"# Data imported and updated from: http://standards.ieee.org/develop/regauth/oui/oui.txt\n");
$line =~ s/\s+$//;
if (defined $1) {
next;
}
if (defined $1) {
my $vendor = uc $1;
my $text = $2;
print(OUT "\n");
}
}
close(IN);
$line =~ s/\s+$//;
if (defined $1) {
my $vendor = uc $1;
my $text = $2;
# skip the IAB prefixes
if (! exists $iab_prefixes{ $vendor }) {
print(OUT "\n");
}
}
}
close(IN);
close(OUT);
}
usb_vendor();
usb_classes();
pci_vendor();
pci_classes();
oui();