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");
46 open(IN, "<", "usb.ids");
47 open(OUT, ">", "20-usb-classes.hwdb");
48 print(OUT "# This file is part of systemd.\n" .
50 "# Data imported and updated from: http://www.linux-usb.org/usb.ids\n");
52 while (my $line = <IN>) {
55 $line =~ m/^C\ ([0-9a-f]{2})\s*(.*)$/;
59 if ($text =~ m/^(\?|None|Unused)$/) {
63 print(OUT "usb:v*p*d*dc" . $class . "*\n");
64 print(OUT " ID_USB_CLASS_FROM_DATABASE=" . $text . "\n");
68 if (not defined $class) {
70 } elsif ($line =~ m/^$/) {
74 $line =~ m/^\t([0-9a-f]{2})\s*(.*)$/;
78 if ($text =~ m/^(\?|None|Unused)$/) {
82 print(OUT "usb:v*p*d*dc" . $class . "dsc" . $subclass . "*\n");
83 print(OUT " ID_USB_SUBCLASS_FROM_DATABASE=" . $text . "\n");
87 $line =~ m/^\t\t([0-9a-f]{2})\s*(.*)$/;
91 if ($text =~ m/^(\?|None|Unused)$/) {
95 print(OUT "usb:v*p*d*dc" . $class . "dsc" . $subclass . "dp" . $protocol . "*\n");
96 print(OUT " ID_USB_PROTOCOL_FROM_DATABASE=" . $text . "\n");
108 open(IN, "<", "usb.ids");
109 open(IN, "<", "pci.ids");
110 open(OUT, ">", "20-pci-vendor-product.hwdb");
111 print(OUT "# This file is part of systemd.\n" .
113 "# Data imported and updated from: http://pciids.sourceforge.net/v2.2/pci.ids\n");
115 while (my $line = <IN>) {
117 $line =~ m/^([0-9a-f]{4})\s*(.*)$/;
123 print(OUT "pci:v0000" . $vendor . "*\n");
124 print(OUT " ID_VENDOR_FROM_DATABASE=" . $text . "\n");
128 $line =~ m/^\t([0-9a-f]{4})\s*(.*)$/;
133 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "*\n");
134 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
138 $line =~ m/^\t\t([0-9a-f]{4})\s*([0-9a-f]{4})\s*(.*)$/;
140 my $sub_vendor = uc $1;
141 my $sub_device = uc $2;
144 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "sv0000" . $sub_vendor . "sd0000" . $sub_device . "*\n");
145 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
158 open(IN, "<", "pci.ids");
159 open(OUT, ">", "20-pci-classes.hwdb");
160 print(OUT "# This file is part of systemd.\n" .
162 "# Data imported and updated from: http://pciids.sourceforge.net/v2.2/pci.ids\n");
164 while (my $line = <IN>) {
167 $line =~ m/^C\ ([0-9a-f]{2})\s*(.*)$/;
172 print(OUT "pci:v*d*sv*sd*bc" . $class . "*\n");
173 print(OUT " ID_PCI_CLASS_FROM_DATABASE=" . $text . "\n");
177 if (not defined $class) {
179 } elsif ($line =~ m/^$/) {
183 $line =~ m/^\t([0-9a-f]{2})\s*(.*)$/;
188 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "*\n");
189 print(OUT " ID_PCI_SUBCLASS_FROM_DATABASE=" . $text . "\n");
193 $line =~ m/^\t\t([0-9a-f]{2})\s*(.*)$/;
198 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "i" . $interface . "*\n");
199 print(OUT " ID_PCI_INTERFACE_FROM_DATABASE=" . $text . "\n");
208 open(IN, "<", "oui.txt");
209 open(OUT, ">", "20-OUI.hwdb");
210 print(OUT "# This file is part of systemd.\n" .
212 "# Data imported and updated from: http://standards.ieee.org/develop/regauth/oui/oui.txt\n");
214 while (my $line = <IN>) {
216 $line =~ m/^([0-9A-F]{6})\s*\(base 16\)\s*(.*)$/;
221 print(OUT "OUI:" . $vendor . "\n");
222 print(OUT " ID_OUI_FROM_DATABASE=" . $text . "\n");