Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Generate usb events on attach and detach.



details:   https://anonhg.NetBSD.org/src/rev/2e2ae9f06bf2
branches:  trunk
changeset: 481596:2e2ae9f06bf2
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Feb 02 13:19:44 2000 +0000

description:
Generate usb events on attach and detach.
Handle rnd stuff correctly.

diffstat:

 sys/dev/usb/if_aue.c    |  16 ++++++++++++++--
 sys/dev/usb/if_auereg.h |   8 ++++++--
 sys/dev/usb/if_cue.c    |  17 +++++++++++++++--
 sys/dev/usb/if_cuereg.h |   8 ++++++--
 4 files changed, 41 insertions(+), 8 deletions(-)

diffs (172 lines):

diff -r 0b73886ac2a3 -r 2e2ae9f06bf2 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c      Wed Feb 02 13:18:45 2000 +0000
+++ b/sys/dev/usb/if_aue.c      Wed Feb 02 13:19:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aue.c,v 1.18 2000/02/02 11:42:29 augustss Exp $     */
+/*     $NetBSD: if_aue.c,v 1.19 2000/02/02 13:19:44 augustss Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -102,6 +102,9 @@
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 
 #include <sys/device.h>
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
 
 #endif /* defined(__NetBSD__) || defined(__OpenBSD__) */
 
@@ -864,7 +867,7 @@
        bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB,
                  sizeof(struct ether_header));
 #endif
-#if RND > 0
+#if NRND > 0
        rnd_attach_source(&sc->rnd_source, USBDEVNAME(sc->aue_dev),
            RND_TYPE_NET, 0);
 #endif
@@ -873,6 +876,9 @@
 
        splx(s);
 
+       usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->aue_udev,
+                          USBDEV(sc->aue_dev));
+
        USB_ATTACH_SUCCESS_RETURN;
 }
 
@@ -892,6 +898,9 @@
                aue_stop(sc);
 
 #if defined(__NetBSD__)
+#if NRND > 0
+       rnd_detach_source(&sc->rnd_source);
+#endif
        mii_detach(&sc->aue_mii, MII_PHY_ANY, MII_OFFSET_ANY);
        ifmedia_delete_instance(&sc->aue_mii.mii_media, IFM_INST_ANY);
 #if NBPFILTER > 0
@@ -912,6 +921,9 @@
 
        splx(s);
 
+       usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->aue_udev, 
+                          USBDEV(sc->aue_dev));
+
        return (0);
 }
 
diff -r 0b73886ac2a3 -r 2e2ae9f06bf2 sys/dev/usb/if_auereg.h
--- a/sys/dev/usb/if_auereg.h   Wed Feb 02 13:18:45 2000 +0000
+++ b/sys/dev/usb/if_auereg.h   Wed Feb 02 13:19:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_auereg.h,v 1.3 2000/01/28 00:29:53 augustss Exp $   */
+/*     $NetBSD: if_auereg.h,v 1.4 2000/02/02 13:19:44 augustss Exp $   */
 /*
  * Copyright (c) 1997, 1998, 1999
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -239,7 +239,9 @@
 #elif defined(__NetBSD__)
        struct ethercom         aue_ec;
        struct mii_data         aue_mii;
-       char                    aue_dying;
+#if NRND > 0
+       rndsource_element_t     rnd_source;
+#endif
 #define GET_IFP(sc) (&(sc)->aue_ec.ec_if)
 #define GET_MII(sc) (&(sc)->aue_mii)
 #endif
@@ -253,6 +255,8 @@
        u_int8_t                aue_link;
        int                     aue_if_flags;
        struct aue_cdata        aue_cdata;
+
+       char                    aue_dying;
 };
 
 #define AUE_TIMEOUT            1000
diff -r 0b73886ac2a3 -r 2e2ae9f06bf2 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Wed Feb 02 13:18:45 2000 +0000
+++ b/sys/dev/usb/if_cue.c      Wed Feb 02 13:19:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.4 2000/02/02 11:49:55 augustss Exp $      */
+/*     $NetBSD: if_cue.c,v 1.5 2000/02/02 13:19:44 augustss Exp $      */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -83,6 +83,9 @@
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 
 #include <sys/device.h>
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
 
 #endif
 
@@ -640,13 +643,17 @@
        bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB,
                  sizeof(struct ether_header));
 #endif
-#if RND > 0
+#if NRND > 0
        rnd_attach_source(&sc->rnd_source, USBDEVNAME(sc->cue_dev),
            RND_TYPE_NET, 0);
 #endif
 
 #endif /* __NetBSD__ */
        splx(s);
+
+       usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cue_udev,
+                          USBDEV(sc->cue_dev));
+
        USB_ATTACH_SUCCESS_RETURN;
 }
 
@@ -664,6 +671,9 @@
        usb_untimeout(cue_tick, sc, sc->cue_stat_ch);
 
 #if defined(__NetBSD__)
+#if NRND > 0
+       rnd_detach_source(&sc->rnd_source);
+#endif
 #if NBPFILTER > 0
        bpfdetach(ifp);
 #endif
@@ -682,6 +692,9 @@
 
        splx(s);
 
+       usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->cue_udev,
+                          USBDEV(sc->cue_dev));
+
        return (0);
 }
 
diff -r 0b73886ac2a3 -r 2e2ae9f06bf2 sys/dev/usb/if_cuereg.h
--- a/sys/dev/usb/if_cuereg.h   Wed Feb 02 13:18:45 2000 +0000
+++ b/sys/dev/usb/if_cuereg.h   Wed Feb 02 13:19:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cuereg.h,v 1.2 2000/01/28 00:34:13 augustss Exp $   */
+/*     $NetBSD: if_cuereg.h,v 1.3 2000/02/02 13:19:45 augustss Exp $   */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -176,7 +176,9 @@
 #define GET_IFP(sc) (&(sc)->arpcom.ac_if)
 #elif defined(__NetBSD__)
        struct ethercom         cue_ec;
-       char                    cue_dying;
+#if NRND > 0
+       rndsource_element_t     rnd_source;
+#endif
 #define GET_IFP(sc) (&(sc)->cue_ec.ec_if)
 #endif
 
@@ -191,4 +193,6 @@
        int                     cue_if_flags;
        u_int16_t               cue_rxfilt;
        struct cue_cdata        cue_cdata;
+
+       char                    cue_dying;
 };



Home | Main Index | Thread Index | Old Index