When testing streaming input (or streaming output) command functionality
for a subdevice, attempt to make it the current 'read' (or 'write')
subdevice by calling the new 'comedi_set_read_subdevice()' (or
'comedi_set_write_subdevice()') function.
That is currently only supported by the Linux "in-tree" version of
Comedi, since kernel version 3.19. If the attempt fails, and the
subdevice is not the current 'read' (or 'write') subdevice, the test
will report "not applicable" as before.
If the comedi data buffer is larger than the total size of the data
being written to the buffer in first test_cmd_write_fast_1chan(), the
first loop iterates endlessly writing 0 bytes to the buffer. Break out
of the first loop once the required amount of data has been written.
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.