From: Frank Mori Hess Date: Sun, 27 Feb 2005 22:45:14 +0000 (+0000) Subject: patch from Ian Abbott : X-Git-Tag: v0_8_0~122 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=8fdb92784a7a430cadd0fe67363e451f6214ee61;p=comedilib.git patch from Ian Abbott : I was running "comedi_test -v" on my new analog output driver and noticed that it was getting stuck in a loop during the "cmd_write_fast_1_chan" test. It turned out that the test had written more data to the buffer than was required to complete the acquisition (it was using cmd->stop_src = TRIG_COUNT) and then got stuck in a loop waiting for the buffer to empty. The attached patch stops the test_cmd_write_fast_1chan function writing more data than is required to complete the acquisition. --- diff --git a/testing/cmd_1.c b/testing/cmd_1.c index b2b7d2d..e9d337a 100644 --- a/testing/cmd_1.c +++ b/testing/cmd_1.c @@ -163,6 +163,7 @@ int test_cmd_write_fast_1chan(void) unsigned int flags = comedi_get_subdevice_flags(device,subdevice); static const int num_samples = 100000; int num_bytes; + int wc; if((flags & SDF_LSAMPL)) { @@ -197,14 +198,17 @@ int test_cmd_write_fast_1chan(void) go = 1; while(go){ - ret = write(comedi_fileno(device), buf, BUFSZ); + wc = num_bytes-total; + if(wc>BUFSZ){ + wc = BUFSZ; + } + ret = write(comedi_fileno(device), buf, wc); if(ret<0){ perror("write"); return 0; } - if(retBUFSZ){ + wc = BUFSZ; + } + ret = write(comedi_fileno(device),buf,wc); if(ret<0){ if(errno==EAGAIN){ usleep(10000);