Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Keep track of vendor id and make sure the vendor str...



details:   https://anonhg.NetBSD.org/src/rev/8eebbaca5fd2
branches:  trunk
changeset: 473106:8eebbaca5fd2
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu May 20 09:52:35 1999 +0000

description:
Keep track of vendor id and make sure the vendor string is NUL terminated.

diffstat:

 sys/dev/pci/ohci_pci.c |  5 +++--
 sys/dev/pci/uhci_pci.c |  5 +++--
 sys/dev/usb/ohci.c     |  3 ++-
 sys/dev/usb/ohcivar.h  |  7 ++++++-
 sys/dev/usb/uhci.c     |  3 ++-
 sys/dev/usb/uhcivar.h  |  3 ++-
 6 files changed, 18 insertions(+), 8 deletions(-)

diffs (120 lines):

diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/pci/ohci_pci.c
--- a/sys/dev/pci/ohci_pci.c    Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/pci/ohci_pci.c    Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci_pci.c,v 1.8 1999/05/13 23:34:38 thorpej Exp $     */
+/*     $NetBSD: ohci_pci.c,v 1.9 1999/05/20 09:52:35 augustss Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -140,8 +140,9 @@
 
        /* Figure out vendor for root hub descriptor. */
        vendor = pci_findvendor(pa->pa_id);
+       sc->sc_id_vendor = PCI_VENDOR(pa->pa_id);
        if (vendor)
-               strncpy(sc->sc_vendor, vendor, sizeof(sc->sc_vendor));
+               strncpy(sc->sc_vendor, vendor, sizeof(sc->sc_vendor) - 1);
        else
                sprintf(sc->sc_vendor, "vendor 0x%04x", PCI_VENDOR(pa->pa_id));
        
diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/pci/uhci_pci.c
--- a/sys/dev/pci/uhci_pci.c    Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/pci/uhci_pci.c    Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci_pci.c,v 1.6 1999/05/13 23:34:38 thorpej Exp $     */
+/*     $NetBSD: uhci_pci.c,v 1.7 1999/05/20 09:52:35 augustss Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -146,8 +146,9 @@
 
        /* Figure out vendor for root hub descriptor. */
        vendor = pci_findvendor(pa->pa_id);
+       sc->sc_id_vendor = PCI_VENDOR(pa->pa_id);
        if (vendor)
-               strncpy(sc->sc_vendor, vendor, sizeof(sc->sc_vendor));
+               strncpy(sc->sc_vendor, vendor, sizeof(sc->sc_vendor) - 1);
        else
                sprintf(sc->sc_vendor, "vendor 0x%04x", PCI_VENDOR(pa->pa_id));
        
diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/usb/ohci.c        Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.28 1999/05/09 22:48:35 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.29 1999/05/20 09:52:35 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1481,6 +1481,7 @@
                                goto ret;
                        }
                        totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
+                       USETW(ohci_devd.idVendor, sc->sc_id_vendor);
                        memcpy(buf, &ohci_devd, l);
                        break;
                case UDESC_CONFIG:
diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h     Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/usb/ohcivar.h     Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcivar.h,v 1.4 1998/12/26 12:53:01 augustss Exp $     */
+/*     $NetBSD: ohcivar.h,v 1.5 1999/05/20 09:52:35 augustss Exp $     */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -53,6 +53,9 @@
        /*ohci_soft_ed_t *sed;*/
        usbd_request_handle reqh;
        u_int16_t len;
+       u_int16_t flags;
+#define OHCI_CALL_DONE 0x0001
+#define OHCI_SET_LEN   0x0002
 } ohci_soft_td_t;
 #define OHCI_TD_CHUNK 256
 
@@ -96,7 +99,9 @@
        usbd_request_handle sc_intrreqh;
 
        int sc_intrs;
+
        char sc_vendor[16];
+       int sc_id_vendor;
 } ohci_softc_t;
 
 usbd_status    ohci_init __P((ohci_softc_t *));
diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/usb/uhci.c        Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.26 1999/05/16 11:43:32 augustss Exp $       */
+/*     $NetBSD: uhci.c,v 1.27 1999/05/20 09:52:35 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2265,6 +2265,7 @@
                                goto ret;
                        }
                        totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
+                       USETW(uhci_devd.idVendor, sc->sc_id_vendor);
                        memcpy(buf, &uhci_devd, l);
                        break;
                case UDESC_CONFIG:
diff -r 5cfd849d932c -r 8eebbaca5fd2 sys/dev/usb/uhcivar.h
--- a/sys/dev/usb/uhcivar.h     Thu May 20 09:51:13 1999 +0000
+++ b/sys/dev/usb/uhcivar.h     Thu May 20 09:52:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhcivar.h,v 1.5 1998/12/26 12:53:02 augustss Exp $     */
+/*     $NetBSD: uhcivar.h,v 1.6 1999/05/20 09:52:35 augustss Exp $     */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -160,6 +160,7 @@
 #endif
 
        char sc_vendor[16];
+       int sc_id_vendor;
 } uhci_softc_t;
 
 usbd_status    uhci_init __P((uhci_softc_t *));



Home | Main Index | Thread Index | Old Index