subdevices not respondig

Hi, I have a strange problem: I'm developing a driver based on the dummy one 
provided by drivers/skel.c.  First I tryed to test skel driver with such a 
call:

	it=comedi_open("/dev/comedi0");
/* once compiled and installed...
modprobe skel
comedi_config /dev/comedi0 skel-100...everything ok*/
	
	printf("# of subdev %d\n",comedi_get_n_subdevices(it)); 
	subdev = comedi_find_subdevice_by_type(it,COMEDI_SUBD_AO,0);
	printf("analog subdev %d\n",subdev); /*these printf look correct!*/
	
	comedi_data_write(it,subdev,chanw,range,aref,*dataw);

Now, it does not matter what subdevice I call for (here you see analog 
output), the only function responding (I mean my printk goes out) is 
skel_dio_insn_bits, as described in skel.c. Why? Even when I use 
comedilib/demo/info I can read correct informations but again 
skel_dio_insn_bits is called...I looked at the code, everything seems 
allright, each subdevice with its functions as follows
	
	. . .
	s=dev->subdevices+1;
	/* analog output subdevice */
	s->type=COMEDI_SUBD_AO;
	s->subdev_flags=SDF_WRITABLE;
	s->n_chan=1;
	s->maxdata=0xffff;
	s->range_table=&range_bipolar10;
	s->insn_write = &skel_ao_winsn; will a comedi_data_write call for it?
	s->insn_read = &skel_ao_rinsn;

	s=dev->subdevices+2;
	/* digital i/o subdevice */
	if(thisboard->have_dio){
		s->type=COMEDI_SUBD_DIO;
		s->subdev_flags=SDF_READABLE|SDF_WRITABLE;
		s->n_chan=16;
		s->maxdata=1;
		s->range_table=&range_digital;
		s->insn_bits = skel_dio_insn_bits;
		s->insn_config = skel_dio_insn_config;
	}else{
		s->type = COMEDI_SUBD_UNUSED;
	}
	. . .

Thank you, Mic
-- 
Michele Bongiovanni
PhD Student, Politecnico di Torino
Dipartimento di Automatica ed Informatica

Received on 2003-02-10Z15:30:35