Don't use SDF_WRITEABLE flag to check if read (or write) command is
authorIan Abbott <abbotti@mev.co.uk>
Mon, 28 Jan 2008 16:10:11 +0000 (16:10 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 28 Jan 2008 16:10:11 +0000 (16:10 +0000)
applicable.  Instead, check that the specified subdevice matches the
read (or write) subdevice.

testing/cmd_1.c
testing/cmd_2.c
testing/inttrig.c
testing/mmap.c
testing/select.c

index 8e28f49ef9064ac730a8cca42e91faa2ccaa491a..1d051c60d5548f9dd775c82016745dcadd78cb21 100644 (file)
@@ -112,7 +112,7 @@ int test_cmd_read_fast_1chan(void)
        int ret;
        unsigned int flags = comedi_get_subdevice_flags(device,subdevice);
 
-       if(!(flags&SDF_CMD) || flags&SDF_WRITEABLE){
+       if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }
@@ -172,7 +172,7 @@ int test_cmd_write_fast_1chan(void)
        {
                num_bytes = num_samples * sizeof(sampl_t);
        }
-       if(!(flags&SDF_CMD) || !(flags&SDF_WRITEABLE)){
+       if(!(flags&SDF_CMD) || (comedi_get_write_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }
@@ -181,6 +181,7 @@ int test_cmd_write_fast_1chan(void)
                printf("  not supported\n");
                return 0;
        }
+       cmd.flags |= CMDF_WRITE;
 
        if(realtime)cmd.flags |= TRIG_RT;
        cmd.chanlist = chanlist;
index 77467c57a850ebe040244b4df00194d8d4a559ac..20fa9063f4ba4a7107d4d2f0ca81b25a2a25462f 100644 (file)
@@ -21,7 +21,7 @@ int test_cmd_fifo_depth_check(void)
        int len;
        unsigned int flags = comedi_get_subdevice_flags(device,subdevice);
 
-       if(!(flags&SDF_CMD) || flags&SDF_WRITEABLE){
+       if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }
index 60aa86238dcfe176befc0083a512556316ead72d..9cced3a1af7cc76dbd5b23fd5ccd64e47975b756 100644 (file)
@@ -44,7 +44,7 @@ int test_cmd_start_inttrig(void)
        unsigned int flags;
 
        flags = comedi_get_subdevice_flags(device,subdevice);
-       if(!(flags&SDF_CMD) || flags&SDF_WRITEABLE){
+       if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }
index f2ebebc1abc58e112c77ee76d66e38718c8a2d8e..08a956bffc78a3d2e76dc4332dfa4ce8e18b2143 100644 (file)
@@ -71,7 +71,7 @@ int test_mmap(void)
 
        flags = comedi_get_subdevice_flags(device,subdevice);
 
-       if(!(flags&SDF_CMD) || flags&SDF_WRITEABLE){
+       if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }
index f4a67e0afd9eca846cdbdcf6ed63b7b9c16cdcc7..9ec5ed1473a45ffe70064fbc26696750c6091ae4 100644 (file)
@@ -30,7 +30,7 @@ int test_read_select(void)
        unsigned int flags;
 
        flags = comedi_get_subdevice_flags(device,subdevice);
-       if(!(flags&SDF_CMD) || flags&SDF_WRITEABLE){
+       if(!(flags&SDF_CMD) || (comedi_get_read_subdevice(device)!=subdevice)){
                printf("not applicable\n");
                return 0;
        }