ids-update.pl revision 56243d0936f85b2580f4c1028e1af98b96d77b72
use strict;
use warnings;
sub usb_vendor {
my $vendor;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported 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 $model = 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 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 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 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 sdio_vendor {
my $vendor;
my $device;
print(OUT "# This file is part of systemd.\n" .
"#\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;
}
}
close(IN);
close(OUT);
}
sub sdio_classes {
my $class;
my $subclass;
my $interface;
print(OUT "# This file is part of systemd.\n" .
"#\n" .
$line =~ s/\s+$//;
if (defined $1) {
$class = uc $1;
my $text = $2;
print(OUT "\n");
next;
}
}
close(IN);
close(OUT);
}
sub oui {
my $iab_prefix;
my %iab_prefixes = ();
print(OUT "# This file is part of systemd.\n" .
"#\n" .
"# Data imported from:\n" .
$line =~ s/^ +//;
$line =~ s/\s+$//;
if (defined $1) {
next;
}
if (defined $1) {
my $vendor = uc $1;
my $text = $2;
print(OUT "\n");
}
}
close(IN);
$line =~ s/^ +//;
$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();
sdio_vendor();
sdio_classes();
oui();