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 support for uhidev children (eg, ums, ukbd) ...



details:   https://anonhg.NetBSD.org/src/rev/a547760a43ff
branches:  trunk
changeset: 537909:a547760a43ff
user:      dan <dan%NetBSD.org@localhost>
date:      Tue Oct 08 09:56:17 2002 +0000

description:
Add support for uhidev children (eg, ums, ukbd) as rnd entropy
sources.

Multifunction devices, such as keyboards with built-in mice or
scrollwheels on different interfaces and/or repid's are each handled
as a separate entropy source.

diffstat:

 sys/dev/usb/uhidev.c |  13 ++++++++++++-
 sys/dev/usb/uhidev.h |  11 ++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diffs (73 lines):

diff -r 63b35ed6382b -r a547760a43ff sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Tue Oct 08 09:19:44 2002 +0000
+++ b/sys/dev/usb/uhidev.c      Tue Oct 08 09:56:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.8 2002/09/27 03:18:21 thorpej Exp $       */
+/*     $NetBSD: uhidev.c,v 1.9 2002/10/08 09:56:17 dan Exp $   */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -235,6 +235,11 @@
                                        USB_ATTACH_ERROR_RETURN;
                                }
 #endif
+#if NRND > 0
+                               rnd_attach_source(&dev->rnd_source, 
+                                                 USBDEVNAME(dev->sc_dev), 
+                                                 RND_TYPE_TTY, 0);
+#endif
                        }
                }
        }
@@ -324,6 +329,9 @@
        rv = 0;
        for (i = 0; i < sc->sc_nrepid; i++) {
                if (sc->sc_subdevs[i] != NULL) {
+#if NRND > 0
+                       rnd_detach_source(&sc->sc_subdevs[i]->rnd_source);
+#endif
                        rv |= config_detach(&sc->sc_subdevs[i]->sc_dev, flags);
                        sc->sc_subdevs[i] = NULL;
                }
@@ -387,6 +395,9 @@
                printf("%s: bad input length %d != %d\n",USBDEVNAME(sc->sc_dev),
                       scd->sc_in_rep_size, cc);
 #endif
+#if NRND > 0
+       rnd_add_uint32(&scd->rnd_source, (u_int32_t)(sc->sc_ibuf));
+#endif
        scd->sc_intr(scd, p, cc);
 }
 
diff -r 63b35ed6382b -r a547760a43ff sys/dev/usb/uhidev.h
--- a/sys/dev/usb/uhidev.h      Tue Oct 08 09:19:44 2002 +0000
+++ b/sys/dev/usb/uhidev.h      Tue Oct 08 09:56:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.h,v 1.2 2001/12/29 18:56:52 augustss Exp $      */
+/*     $NetBSD: uhidev.h,v 1.3 2002/10/08 09:56:17 dan Exp $   */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,6 +37,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "rnd.h"
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
+
 #include "locators.h"
 #define uhidevcf_reportid cf_loc[UHIDBUSCF_REPORTID]
 #define UHIDEV_UNK_REPORTID UHIDBUSCF_REPORTID_DEFAULT
@@ -69,6 +75,9 @@
        int sc_in_rep_size;
 #define        UHIDEV_OPEN     0x01    /* device is open */
        void (*sc_intr)(struct uhidev *, void *, u_int);
+#if NRND > 0
+        rndsource_element_t     rnd_source;
+#endif
 };
 
 struct uhidev_attach_arg {



Home | Main Index | Thread Index | Old Index