Comedi command

In my application program I am trying to read analogue inputs and set up the 
command structure as follows:

    for (i = 0; i < N_CHANS; i++)
        chanlist[i] = CR_PACK(i, range[i], ref);

    /* Fill in the command data structure: */
    cmd.subdev            = subdev;
    cmd.flags                = 0;
    cmd.start_src           = TRIG_EXT;          // Start acquisition on 
external signal
    cmd.start_arg           = 0;                      // Front panel gate 
input
    cmd.scan_begin_src = TRIG_EXT;         // Start scan on external signal
    cmd.scan_begin_arg = 0;                     // Front panel clock input
    cmd.convert_src       = TRIG_NOW;       // Simultaneous acquisition
    cmd.convert_arg       = 0;
    cmd.scan_end_src    = TRIG_COUNT;   // End scan after N_CHANS channels
    cmd.scan_end_arg    = 8;
    cmd.stop_src            = TRIG_COUNT;   // End acquisition after N_SCANS 
scans
    cmd.stop_arg            = N_SCANS;

    cmd.chanlist       = chanlist;
    cmd.chanlist_len   = N_CHANS;

    // Check the command
    ret = comedi_command_test(it, &cmd);
    if (ret < 0) {
	comedi_perror("comedi_command_test");
        printf("ret = %d\n", ret);
	if (errno == EIO) {
	    fprintf(stderr, "Ummm... this subdevice doesn't support commands\n");
	}
	return (-1);
    }

When I run the program I get :

comedi_command_test: Invalid argument
ret = -1

Does anyone have any ideas which argument I have got wrong?

Anne Smorthit
RUAG Aerospace, Postfach 301, CH-6032 Emmen, Switzerland
Tel : +41 41 268 2355
Mail to: anne.smorthit_at_sfwte.ch

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

Received on 2003-06-05Z11:24:38