Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Add vendor/product/release locators. Added in f...



details:   https://anonhg.NetBSD.org/src/rev/7aa80ad49221
branches:  trunk
changeset: 473004:7aa80ad49221
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sun May 16 13:51:05 1999 +0000

description:
Add vendor/product/release locators.  Added in frustration as my HID
devices appeared as different devices after some plugging and unplugging. :-)

diffstat:

 sys/dev/usb/files.usb  |  10 ++++++++--
 sys/dev/usb/usb_subr.c |  35 ++++++++++++++++++++++++++++++++---
 sys/dev/usb/usbdi.h    |   5 ++++-
 sys/dev/usb/usbdivar.h |  11 ++++++++++-
 4 files changed, 54 insertions(+), 7 deletions(-)

diffs (158 lines):

diff -r 4bf94204c2a3 -r 7aa80ad49221 sys/dev/usb/files.usb
--- a/sys/dev/usb/files.usb     Sun May 16 12:05:10 1999 +0000
+++ b/sys/dev/usb/files.usb     Sun May 16 13:51:05 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.usb,v 1.6 1999/05/06 00:42:16 thorpej Exp $
+#      $NetBSD: files.usb,v 1.7 1999/05/16 13:51:05 augustss Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -17,7 +17,8 @@
 file   dev/usb/usb_quirks.c            usb
 
 # Hub driver
-device uhub { [port = -1], [configuration = -1], [interface = -1] }
+device uhub { [port = -1], [configuration = -1], [interface = -1],
+               [vendor = -1], [product = -1], [release = -1] }
 attach uhub at usb
 file   dev/usb/uhub.c                  usb
 
@@ -54,6 +55,11 @@
 attach ulpt at uhub
 file   dev/usb/ulpt.c                  ulpt            needs-flag
 
+# Mass storage
+#device        umass: scsi
+#attach        umass at uhub
+#file  dev/usb/umass.c                 umass           needs-flag
+
 # Modems
 device umodem
 attach umodem at uhub
diff -r 4bf94204c2a3 -r 7aa80ad49221 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Sun May 16 12:05:10 1999 +0000
+++ b/sys/dev/usb/usb_subr.c    Sun May 16 13:51:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.31 1999/05/13 23:29:41 augustss Exp $   */
+/*     $NetBSD: usb_subr.c,v 1.32 1999/05/16 13:51:05 augustss Exp $   */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -750,6 +750,9 @@
        uaa.port = port;
        uaa.configno = UHUB_UNK_CONFIGURATION;
        uaa.ifaceno = UHUB_UNK_INTERFACE;
+       uaa.vendor = UGETW(dd->idVendor);
+       uaa.product = UGETW(dd->idProduct);
+       uaa.release = UGETW(dd->bcdDevice);
 
        /* First try with device specific drivers. */
        if (USB_DO_ATTACH(dev, bdev, parent, &uaa, usbd_print, usbd_submatch))
@@ -807,6 +810,9 @@
        uaa.usegeneric = 1;
        uaa.configno = UHUB_UNK_CONFIGURATION;
        uaa.ifaceno = UHUB_UNK_INTERFACE;
+       uaa.vendor = UHUB_UNK_VENDOR;
+       uaa.product = UHUB_UNK_PRODUCT;
+       uaa.release = UHUB_UNK_RELEASE;
        if (USB_DO_ATTACH(dev, bdev, parent, &uaa, usbd_print, usbd_submatch))
                return (USBD_NORMAL_COMPLETION);
 
@@ -1006,6 +1012,19 @@
                printf(" configuration %d", uaa->configno);
        if (uaa->ifaceno != UHUB_UNK_INTERFACE)
                printf(" interface %d", uaa->ifaceno);
+#if 0
+       /* 
+        * It gets very crowded with these locators on the attach line.
+        * They are not really needed since they are printed in the clear
+        * by each driver.
+        */
+       if (uaa->vendor != UHUB_UNK_VENDOR)
+               printf(" vendor 0x%04x", uaa->vendor);
+       if (uaa->product != UHUB_UNK_PRODUCT)
+               printf(" product 0x%04x", uaa->product);
+       if (uaa->release != UHUB_UNK_RELEASE)
+               printf(" release 0x%04x", uaa->release);
+#endif
        return (UNCONF);
 }
 
@@ -1025,7 +1044,17 @@
             cf->uhubcf_configuration != uaa->configno) ||
            (uaa->ifaceno != UHUB_UNK_INTERFACE &&
             cf->uhubcf_interface != UHUB_UNK_INTERFACE &&
-            cf->uhubcf_interface != uaa->ifaceno))
+            cf->uhubcf_interface != uaa->ifaceno) ||
+           (uaa->vendor != UHUB_UNK_VENDOR &&
+            cf->uhubcf_vendor != UHUB_UNK_VENDOR &&
+            cf->uhubcf_vendor != uaa->vendor) ||
+           (uaa->product != UHUB_UNK_PRODUCT &&
+            cf->uhubcf_product != UHUB_UNK_PRODUCT &&
+            cf->uhubcf_product != uaa->product) ||
+           (uaa->release != UHUB_UNK_RELEASE &&
+            cf->uhubcf_release != UHUB_UNK_RELEASE &&
+            cf->uhubcf_release != uaa->release)
+          )
                return 0;
        return ((*cf->cf_attach->ca_match)(parent, cf, aux));
 }
@@ -1113,7 +1142,7 @@
 
        di->config = dev->config;
        usbd_devinfo_vp(dev, di->vendor, di->product);
-       usbd_printBCD(di->revision, UGETW(dev->ddesc.bcdDevice));
+       usbd_printBCD(di->release, UGETW(dev->ddesc.bcdDevice));
        di->vendorNo = UGETW(dev->ddesc.idVendor);
        di->productNo = UGETW(dev->ddesc.idProduct);
        di->class = dev->ddesc.bDeviceClass;
diff -r 4bf94204c2a3 -r 7aa80ad49221 sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h       Sun May 16 12:05:10 1999 +0000
+++ b/sys/dev/usb/usbdi.h       Sun May 16 13:51:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.h,v 1.17 1999/01/10 19:13:16 augustss Exp $      */
+/*     $NetBSD: usbdi.h,v 1.18 1999/05/16 13:51:05 augustss Exp $      */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -252,6 +252,9 @@
        int                     port;
        int                     configno;
        int                     ifaceno;
+       int                     vendor;
+       int                     product;
+       int                     release;
        usbd_device_handle      device; /* current device */
        usbd_interface_handle   iface; /* current interface */
        int                     usegeneric;
diff -r 4bf94204c2a3 -r 7aa80ad49221 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Sun May 16 12:05:10 1999 +0000
+++ b/sys/dev/usb/usbdivar.h    Sun May 16 13:51:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.19 1999/05/13 23:34:38 thorpej Exp $    */
+/*     $NetBSD: usbdivar.h,v 1.20 1999/05/16 13:51:05 augustss Exp $   */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -217,12 +217,21 @@
 #define UHUBCF_PORT_DEFAULT -1
 #define UHUBCF_CONFIGURATION_DEFAULT -1
 #define UHUBCF_INTERFACE_DEFAULT -1
+#define UHUBCF_VENDOR_DEFAULT -1
+#define UHUBCF_PRODUCT_DEFAULT -1
+#define UHUBCF_RELEASE_DEFAULT -1
 #endif
 
 #define        uhubcf_port             cf_loc[UHUBCF_PORT]
 #define        uhubcf_configuration    cf_loc[UHUBCF_CONFIGURATION]
 #define        uhubcf_interface        cf_loc[UHUBCF_INTERFACE]
+#define        uhubcf_vendor           cf_loc[UHUBCF_VENDOR]
+#define        uhubcf_product          cf_loc[UHUBCF_PRODUCT]
+#define        uhubcf_release          cf_loc[UHUBCF_RELEASE]
 #define        UHUB_UNK_PORT           UHUBCF_PORT_DEFAULT /* wildcarded 'port' */
 #define        UHUB_UNK_CONFIGURATION  UHUBCF_CONFIGURATION_DEFAULT /* wildcarded 'configuration' */
 #define        UHUB_UNK_INTERFACE      UHUBCF_INTERFACE_DEFAULT /* wildcarded 'interface' */
+#define        UHUB_UNK_VENDOR         UHUBCF_VENDOR_DEFAULT /* wildcarded 'vendor' */
+#define        UHUB_UNK_PRODUCT        UHUBCF_PRODUCT_DEFAULT /* wildcarded 'product' */
+#define        UHUB_UNK_RELEASE        UHUBCF_RELEASE_DEFAULT /* wildcarded 'release' */
 



Home | Main Index | Thread Index | Old Index