added get_subdevice_flags()
[comedilib.git] / testing / mode0_read.c
1
2 #include <stdio.h>
3 #include <comedilib.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6 #include <sys/ioctl.h>
7 #include <errno.h>
8 #include <getopt.h>
9 #include <ctype.h>
10 #include <math.h>
11 #include <sys/time.h>
12 #include <string.h>
13
14 #include "comedi_test.h"
15
16
17 int test_mode0_read(void)
18 {
19         comedi_trig it;
20         lsampl_t data;
21         unsigned int chanspec;
22         int save_errno;
23         int ret;
24
25         printf("rev 1\n");
26
27         memset(&it,0,sizeof(it));
28         it.subdev = subdevice;
29         it.mode = 0;
30         it.n_chan = 1;
31         it.chanlist = &chanspec;
32         it.data = (sampl_t *)&data;
33         it.n = 1;
34
35         chanspec = CR_PACK(0,0,0);
36
37         ret = comedi_trigger(device,&it);
38         save_errno = errno;
39
40         printf("comedi_trig_ioctl: %d\n",ret);
41         if(ret<0){
42                 printf("W: comedi_trig_ioctl: errno=%d %s\n",save_errno,
43                         strerror(save_errno));
44         }
45
46         return 0;
47 }
48