9 open(IN, "<", "usb.ids");
10 open(OUT, ">", "20-usb-vendor-product.hwdb");
11 print(OUT "# This file is part of systemd.\n" .
13 "# Data imported and updated from: http://www.linux-usb.org/usb.ids\n");
15 while (my $line = <IN>) {
17 $line =~ m/^([0-9a-f]{4})\s*(.*)$/;
22 print(OUT "usb:v" . $vendor . "*\n");
23 print(OUT " ID_VENDOR_FROM_DATABASE=" . $text . "\n");
27 $line =~ m/^\t([0-9a-f]{4})\s*(.*)$/;
32 print(OUT "usb:v" . $vendor . "p" . $product . "*\n");
33 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
45 open(IN, "<", "usb.ids");
46 open(IN, "<", "pci.ids");
47 open(OUT, ">", "20-pci-vendor-product.hwdb");
48 print(OUT "# This file is part of systemd.\n" .
50 "# Data imported and updated from: http://pciids.sourceforge.net/v2.2/pci.ids\n");
52 while (my $line = <IN>) {
54 $line =~ m/^([0-9a-f]{4})\s*(.*)$/;
60 print(OUT "pci:v0000" . $vendor . "*\n");
61 print(OUT " ID_VENDOR_FROM_DATABASE=" . $text . "\n");
65 $line =~ m/^\t([0-9a-f]{4})\s*(.*)$/;
70 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "*\n");
71 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
75 $line =~ m/^\t\t([0-9a-f]{4})\s*([0-9a-f]{4})\s*(.*)$/;
77 my $sub_vendor = uc $1;
78 my $sub_device = uc $2;
81 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "sv0000" . $sub_vendor . "sd0000" . $sub_device . "*\n");
82 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
95 open(IN, "<", "pci.ids");
96 open(OUT, ">", "20-pci-classes.hwdb");
97 print(OUT "# This file is part of systemd.\n" .
99 "# Data imported and updated from: http://pciids.sourceforge.net/v2.2/pci.ids\n");
101 while (my $line = <IN>) {
104 $line =~ m/^C\ ([0-9a-f]{2})\s*(.*)$/;
109 print(OUT "pci:v*d*sv*sd*bc" . $class . "*\n");
110 print(OUT " ID_PCI_CLASS_FROM_DATABASE=" . $text . "\n");
114 if (not defined $class) {
118 $line =~ m/^\t([0-9a-f]{2})\s*(.*)$/;
123 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "*\n");
124 print(OUT " ID_PCI_SUBCLASS_FROM_DATABASE=" . $text . "\n");
128 $line =~ m/^\t\t([0-9a-f]{2})\s*(.*)$/;
133 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "i" . $interface . "*\n");
134 print(OUT " ID_PCI_INTERFACE_FROM_DATABASE=" . $text . "\n");
143 open(IN, "<", "oui.txt");
144 open(OUT, ">", "20-OUI.hwdb");
145 print(OUT "# This file is part of systemd.\n" .
147 "# Data imported and updated from: http://standards.ieee.org/develop/regauth/oui/oui.txt\n");
149 while (my $line = <IN>) {
151 $line =~ m/^([0-9A-F]{6})\s*\(base 16\)\s*(.*)$/;
156 print(OUT "OUI:" . $vendor . "\n");
157 print(OUT " ID_OUI_FROM_DATABASE=" . $text . "\n");