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*(.+)$/;
58 if ($class =~ m/^00$/) {
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*(.+)$/;
77 if ($subclass =~ m/^00$/) {
81 if ($text =~ m/^(\?|None|Unused)$/) {
85 print(OUT "usb:v*p*d*dc" . $class . "dsc" . $subclass . "*\n");
86 print(OUT " ID_USB_SUBCLASS_FROM_DATABASE=" . $text . "\n");
90 $line =~ m/^\t\t([0-9a-f]{2})\s*(.+)$/;
94 if ($text =~ m/^(\?|None|Unused)$/) {
98 print(OUT "usb:v*p*d*dc" . $class . "dsc" . $subclass . "dp" . $protocol . "*\n");
99 print(OUT " ID_USB_PROTOCOL_FROM_DATABASE=" . $text . "\n");
111 open(IN, "<", "usb.ids");
112 open(IN, "<", "pci.ids");
113 open(OUT, ">", "20-pci-vendor-product.hwdb");
114 print(OUT "# This file is part of systemd.\n" .
116 "# Data imported and updated from: http://pci-ids.ucw.cz/v2.2/pci.ids\n");
118 while (my $line = <IN>) {
120 $line =~ m/^([0-9a-f]{4})\s*(.+)$/;
126 print(OUT "pci:v0000" . $vendor . "*\n");
127 print(OUT " ID_VENDOR_FROM_DATABASE=" . $text . "\n");
131 $line =~ m/^\t([0-9a-f]{4})\s*(.+)$/;
136 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "*\n");
137 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
141 $line =~ m/^\t\t([0-9a-f]{4})\s*([0-9a-f]{4})\s*(.*)$/;
143 my $sub_vendor = uc $1;
144 my $sub_device = uc $2;
147 print(OUT "pci:v0000" . $vendor . "d0000" . $device . "sv0000" . $sub_vendor . "sd0000" . $sub_device . "*\n");
148 print(OUT " ID_PRODUCT_FROM_DATABASE=" . $text . "\n");
161 open(IN, "<", "pci.ids");
162 open(OUT, ">", "20-pci-classes.hwdb");
163 print(OUT "# This file is part of systemd.\n" .
165 "# Data imported and updated from: http://pci-ids.ucw.cz/v2.2/pci.ids\n");
167 while (my $line = <IN>) {
170 $line =~ m/^C\ ([0-9a-f]{2})\s*(.+)$/;
175 print(OUT "pci:v*d*sv*sd*bc" . $class . "*\n");
176 print(OUT " ID_PCI_CLASS_FROM_DATABASE=" . $text . "\n");
180 if (not defined $class) {
182 } elsif ($line =~ m/^$/) {
186 $line =~ m/^\t([0-9a-f]{2})\s*(.+)$/;
191 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "*\n");
192 print(OUT " ID_PCI_SUBCLASS_FROM_DATABASE=" . $text . "\n");
196 $line =~ m/^\t\t([0-9a-f]{2})\s*(.+)$/;
201 print(OUT "pci:v*d*sv*sd*bc" . $class . "sc" . $subclass . "i" . $interface . "*\n");
202 print(OUT " ID_PCI_INTERFACE_FROM_DATABASE=" . $text . "\n");
211 open(IN, "<", "oui.txt");
212 open(OUT, ">", "20-OUI.hwdb");
213 print(OUT "# This file is part of systemd.\n" .
215 "# Data imported and updated from: http://standards.ieee.org/develop/regauth/oui/oui.txt\n");
217 while (my $line = <IN>) {
219 $line =~ m/^([0-9A-F]{6})\s*\(base 16\)\s*(.+)$/;
224 print(OUT "OUI:" . $vendor . "\n");
225 print(OUT " ID_OUI_FROM_DATABASE=" . $text . "\n");