comedi_do_insn() segmentation fault

Hi all

I am having a segmentation fault problem when I execute the line:

int ret = comedi_do_insn(dev, &insn);

If i reboot i don't get the fault one time but when run again i do.

int
comedi_internal_trigger(comedi_t * dev, unsigned int subdevice,
            unsigned int trignum)
{
  comedi_insn insn;
  lsampl_t data[1];

  memset(&insn, 0, sizeof(comedi_insn));
  insn.insn = INSN_INTTRIG;
  insn.subdev = subdevice;
  insn.data = data;
  insn.n = 1;
  insn.chanspec = 0;

  data[0] = trignum;

  printf("This Line Executes\n");
  int ret = comedi_do_insn(dev, &insn);
  printf("This line executes after the system has been rebooted only\n");

  return ret;
}

Note the two lines surrounding comedi_do_insn()

I am closing the the device after using it. (of course this only applies to
the first time the program is run)

When I run comedi_test I also get a segmentation fault.  Here are the last
few lines of the output.  Subdevice 1 is associated with the segmentation
fault in the program.

I: subdevice 1
I: testing info...
rev 1
I: subdevice type: 2 (analog output)
  number of channels: 2
  max data value: 65535
  ranges:
    all chans: [-10,10]
I: testing insn_read...
rev 1
comedi_do_insn returned 1, good
I: testing insn_read_0...
comedi_do_insn returned 0, good
I: testing insn_read_time...
rev 1
comedi_do_insn: 3
read time: 2 us
I: testing cmd_no_cmd...
not applicable
I: testing cmd_probe_src_mask...
rev 1
command source mask:
  start: int
  scan_begin: timer
  convert: now
  scan_end: count
  stop: none|count
I: testing cmd_probe_fast_1chan...
command fast 1chan:
  start: int 0
  scan_begin: timer 1200
  convert: now 0
  scan_end: count 1
  stop: count 2
I: testing cmd_read_fast_1chan...
not applicable
I: testing cmd_write_fast_1chan...
Segmentation fault


I am using  0.7.72 with a NI_6221 37pin on a 2.6.15 kernel on ubuntu.

Any help at all will be appreciated.

Thank you

george

Received on 2007-09-16Z00:38:18