From: mpi Date: Fri, 17 Apr 2015 07:17:51 +0000 (+0000) Subject: Crank the timeout and decrease the buffer size to not end up dropping X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a17ae16f56a1fb300c31609bab68d470b9cfd53c;p=openbsd 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. --- 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 * Copyright (c) 2007 Marc Balmer @@ -36,9 +36,10 @@ #include #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; }