Applied (slightly modified) patch from David MacMahon
authorIan Abbott <abbotti@mev.co.uk>
Thu, 13 Jul 2006 12:43:14 +0000 (12:43 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 13 Jul 2006 12:43:14 +0000 (12:43 +0000)
<davidm -at- astro -dot- berkeley -dot- edu>.
Reports specific error string (strerror(errno)) if comedi_open fails (I
changed the format slightly from David's).
Displays subdevice flags as a hexadecimal number.

demo/info.c

index 7e75427c41b646b18eeb6e1f074fab5a032a8958..2885c6e99a6aaf83801c2f4a09096474750fb0ff 100644 (file)
@@ -47,13 +47,14 @@ int main(int argc,char *argv[])
        int n_subdevices,type;
        int chan,n_chans;
        int n_ranges;
+       int subdev_flags;
        comedi_range *rng;
        
        parse_options(argc,argv);
 
        it=comedi_open(filename);
        if(!it){
-               fprintf(stderr,"cannot open %s\n",filename);
+               fprintf(stderr,"cannot open %s: %s\n",filename, strerror(errno));
                exit(0);
        }
 
@@ -69,6 +70,8 @@ int main(int argc,char *argv[])
                printf("  type: %d (%s)\n",type,subdevice_types[type]);
                if(type==COMEDI_SUBD_UNUSED)
                        continue;
+               subdev_flags = comedi_get_subdevice_flags(it, i);
+               printf("  flags: 0x%08x\n",subdev_flags);
                n_chans=comedi_get_n_channels(it,i);
                printf("  number of channels: %d\n",n_chans);
                if(!comedi_maxdata_is_chan_specific(it,i)){