diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-17 07:17:52 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-04-17 07:17:52 +0000 |
commit | 5155cf154776a88b386993c04da16730e88bbffd (patch) | |
tree | a4bbe090e6a1d566b099fc78b3bfa7808f83f8b0 /sys/dev | |
parent | cd68b1b2d07b9b4a30707d6dacf0df5b0f5727b1 (diff) |
Crank the timeout and decrease the buffer size to not end up dropping
all the entropy provided by the device.
Also make sure we match the right endpoint.
From Sean Levy based on comments from Andreas Gustafsson who's behind
Alea.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/ualea.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/usb/ualea.c b/sys/dev/usb/ualea.c index b1f558b5fc4..ee995b2c933 100644 --- a/sys/dev/usb/ualea.c +++ b/sys/dev/usb/ualea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ualea.c,v 1.1 2015/04/16 08:55:21 mpi Exp $ */ +/* $OpenBSD: ualea.c,v 1.2 2015/04/17 07:17:51 mpi Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> @@ -36,9 +36,10 @@ #include <dev/rndvar.h> #define ALEA_IFACE 0 +#define ALEA_ENDPOINT 1 #define ALEA_MSECS 100 -#define ALEA_READ_TIMEOUT 1000 -#define ALEA_BUFSIZ ((1024/8)*100) /* 100 kbits */ +#define ALEA_READ_TIMEOUT 5000 +#define ALEA_BUFSIZ 128 #define DEVNAME(_sc) ((_sc)->sc_dev.dv_xname) @@ -101,7 +102,8 @@ ualea_attach(struct device *parent, struct device *self, void *aux) return; } if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && - UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { + UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK && + UE_GET_ADDR(ed->bEndpointAddress) == ALEA_ENDPOINT) { ep_ibulk = ed->bEndpointAddress; break; } |