summaryrefslogtreecommitdiff
path: root/sys/dev/usb/devlist2h.awk
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>2005-03-04 05:03:19 +0000
committermycroft <mycroft@NetBSD.org>2005-03-04 05:03:19 +0000
commit3839e0db1bc9fd1ebb8cf56a65d5d248e84961bf (patch)
tree2f2b0064ff6e2bb7b75396a1aa4427ceb50a7c30 /sys/dev/usb/devlist2h.awk
parent6ae946282420f7be674a2df6c291ab345ce320f2 (diff)
Separate out vendors from the product table, to reduce string duplication.
Saves ~10K.
Diffstat (limited to 'sys/dev/usb/devlist2h.awk')
-rw-r--r--sys/dev/usb/devlist2h.awk53
1 files changed, 21 insertions, 32 deletions
diff --git a/sys/dev/usb/devlist2h.awk b/sys/dev/usb/devlist2h.awk
index 1290ea36384..0c1e3ce36fe 100644
--- a/sys/dev/usb/devlist2h.awk
+++ b/sys/dev/usb/devlist2h.awk
@@ -1,5 +1,5 @@
#! /usr/bin/awk -f
-# $NetBSD: devlist2h.awk,v 1.12 2005/02/27 15:37:33 perry Exp $
+# $NetBSD: devlist2h.awk,v 1.13 2005/03/04 05:03:19 mycroft Exp $
#
# Copyright (c) 1995, 1996 Christopher G. Demetriou
# All rights reserved.
@@ -175,64 +175,53 @@ END {
printf("\n") > dfile
- printf("const struct usb_knowndev usb_knowndevs[] = {\n") > dfile
- for (i = 1; i <= nproducts; i++) {
+ printf("const struct usb_vendor usb_vendors[] = {\n") > dfile
+ for (i = 1; i <= nvendors; i++) {
printf("\t{\n") > dfile
- printf("\t USB_VENDOR_%s, USB_PRODUCT_%s_%s,\n",
- products[i, 1], products[i, 1], products[i, 2]) \
+ printf("\t USB_VENDOR_%s,\n", vendors[i, 1]) \
> dfile
- printf("\t ") > dfile
- printf("0") > dfile
- printf(",\n") > dfile
- vendi = vendorindex[products[i, 1]];
printf("\t \"") > dfile
j = 3;
needspace = 0;
- while ((vendi, j) in vendors) {
- if (needspace)
- printf(" ") > dfile
- printf("%s", vendors[vendi, j]) > dfile
- needspace = 1
- j++
- }
- printf("\",\n") > dfile
-
- printf("\t \"") > dfile
- j = 4;
- needspace = 0;
- while ((i, j) in products) {
+ while ((i, j) in vendors) {
if (needspace)
printf(" ") > dfile
- printf("%s", products[i, j]) > dfile
+ printf("%s", vendors[i, j]) > dfile
needspace = 1
j++
}
printf("\",\n") > dfile
printf("\t},\n") > dfile
}
- for (i = 1; i <= nvendors; i++) {
+ printf("};\n") > dfile
+ printf("const int usb_nvendors = %d;\n", nvendors) > dfile
+
+ printf("\n") > dfile
+
+ printf("const struct usb_product usb_products[] = {\n") > dfile
+ for (i = 1; i <= nproducts; i++) {
printf("\t{\n") > dfile
- printf("\t USB_VENDOR_%s, 0,\n", vendors[i, 1]) \
- > dfile
- printf("\t USB_KNOWNDEV_NOPROD,\n") \
+ printf("\t USB_VENDOR_%s, USB_PRODUCT_%s_%s,\n",
+ products[i, 1], products[i, 1], products[i, 2]) \
> dfile
+
printf("\t \"") > dfile
- j = 3;
+ j = 4;
needspace = 0;
- while ((i, j) in vendors) {
+ while ((i, j) in products) {
if (needspace)
printf(" ") > dfile
- printf("%s", vendors[i, j]) > dfile
+ printf("%s", products[i, j]) > dfile
needspace = 1
j++
}
printf("\",\n") > dfile
- printf("\t NULL,\n") > dfile
printf("\t},\n") > dfile
}
- printf("\t{ 0, 0, 0, NULL, NULL, }\n") > dfile
printf("};\n") > dfile
+ printf("const int usb_nproducts = %d;\n", nproducts) > dfile
+
close(dfile)
close(hfile)
}