From: Frank Mori Hess Date: Fri, 29 Nov 2002 21:27:40 +0000 (+0000) Subject: fixed comedi_nanosleep(), which did nothing before X-Git-Tag: r0_7_21~281 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e713197bb1484e80689c4e22aca9c661f5f0be9;p=comedilib.git fixed comedi_nanosleep(), which did nothing before --- 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; }