From 9e713197bb1484e80689c4e22aca9c661f5f0be9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 29 Nov 2002 21:27:40 +0000 Subject: [PATCH] fixed comedi_nanosleep(), which did nothing before --- comedi_calibrate/other.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/comedi_calibrate/other.c b/comedi_calibrate/other.c index b4408e1..7552233 100644 --- a/comedi_calibrate/other.c +++ b/comedi_calibrate/other.c @@ -18,19 +18,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include - - -/* Note that this silently fails if delay >= 100000 */ +#include void comedi_nanodelay(comedi_t *dev, unsigned int delay) { comedi_insn insn; + lsampl_t data = delay; + int retval; memset(&insn, 0, sizeof(insn)); insn.insn = INSN_WAIT; insn.n = 1; - insn.data = &delay; + insn.data = &data; + retval = comedi_do_insn( dev, &insn ); + // fall back on usleep for long delays + if( retval < 0 ) + usleep( delay / 1000 ); + return; } -- 2.26.2