From ad70295bb4eab9a76f5e0a47ba9288934829b115 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 8 Nov 2016 14:25:43 +0000 Subject: [PATCH] demo/mmap: use comedi_get_cmd_generic_timed() Use local function prepare_cmd_lib() -- which uses comedi_get_cmd_generic_timed() -- to prepare a good command for the device. Bail out early if it fails. --- demo/mmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/demo/mmap.c b/demo/mmap.c index e29a122..bc40d18 100644 --- a/demo/mmap.c +++ b/demo/mmap.c @@ -110,8 +110,14 @@ int main(int argc, char *argv[]) chanlist[i] = CR_PACK(options.channel + i, options.range, options.aref); } - //prepare_cmd_lib(dev, options.subdevice, options.n_scan, options.n_chan, 1e9 / options.freq, cmd); - prepare_cmd(dev, options.subdevice, options.n_scan, options.n_chan, 1e9 / options.freq, cmd); + /* prepare_cmd_lib() uses a Comedilib routine to find a + * good command for the device. prepare_cmd() explicitly + * creates a command, which may not work for your device. */ + ret = prepare_cmd_lib(dev, options.subdevice, options.n_scan, options.n_chan, 1e9 / options.freq, cmd); + //prepare_cmd(dev, options.subdevice, options.n_scan, options.n_chan, 1e9 / options.freq, cmd); + if(ret < 0){ + exit(1); + } ret = comedi_command_test(dev, cmd);