use SDF_RUNNING flag to test for completion of ao command
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 16 Mar 2005 19:05:34 +0000 (19:05 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 16 Mar 2005 19:05:34 +0000 (19:05 +0000)
testing/cmd_1.c

index e9d337aacffa0d9dde539d12ef58df21841e6bfe..f43ee27023691f77ff13e0bd331406387a136aa0 100644 (file)
@@ -251,12 +251,16 @@ int test_cmd_write_fast_1chan(void)
        }
        // make sure all samples have been written out
        while(1)
-       {       
-               ret = comedi_get_buffer_contents(device, subdevice);
-               if(ret < 0)
+       {
+               int flags = comedi_get_subdevice_flags(device,subdevice);
+               if(flags < 0)
                {
-                       printf("E: comedi_get_buffer_contents() returned %i\n", ret);
-               }else if(ret == 0) break;
+                       printf("E: comedi_get_subdevice_flags returned %i\n", flags);
+                       break;
+               }
+               if((flags & SDF_RUNNING) == 0){
+                       break;
+               }
                usleep(10000);
        }
        // cancel needed in the case of stop_src==TRIG_NONE