Fix for cases where the command doesn't allow source choices
authorDavid Schleef <ds@schleef.org>
Fri, 22 Nov 2002 07:15:09 +0000 (07:15 +0000)
committerDavid Schleef <ds@schleef.org>
Fri, 22 Nov 2002 07:15:09 +0000 (07:15 +0000)
testing/cmd_1.c

index de40842cd0f5ced1061d9a539493ec7ea961c821..6b16a514eb874cd6a1bdc6e4f98220c8ba7cf929 100644 (file)
@@ -240,6 +240,7 @@ int test_cmd_logic_bug(void)
 {
        comedi_cmd cmd;
        int ret;
+       int ok=0;
 
        if(!(comedi_get_subdevice_flags(device,subdevice)&SDF_CMD)){
                printf("not applicable\n");
@@ -254,11 +255,16 @@ int test_cmd_logic_bug(void)
                return 0;
        }
 
-       if(count_bits(cmd.start_src)>1)cmd.start_src=0;
-       if(count_bits(cmd.scan_begin_src)>1)cmd.scan_begin_src=0;
-       if(count_bits(cmd.convert_src)>1)cmd.convert_src=0;
-       if(count_bits(cmd.scan_end_src)>1)cmd.scan_end_src=0;
-       if(count_bits(cmd.stop_src)>1)cmd.stop_src=0;
+       if(count_bits(cmd.start_src)>1){ cmd.start_src=0; ok=1; }
+       if(count_bits(cmd.scan_begin_src)>1){ cmd.scan_begin_src=0; ok=1; }
+       if(count_bits(cmd.convert_src)>1){ cmd.convert_src=0; ok=1; }
+       if(count_bits(cmd.scan_end_src)>1){ cmd.scan_end_src=0; ok=1; }
+       if(count_bits(cmd.stop_src)>1){ cmd.stop_src=0; ok=1; }
+
+       if(ok==0){
+               printf("not applicable (no source choices)\n");
+               return 0;
+       }
 
        ret = comedi_command_test(device,&cmd);
        if(ret!=1){
@@ -267,8 +273,6 @@ int test_cmd_logic_bug(void)
                printf("command_test returned %d, good\n",ret);
        }
 
-
-
        return 0;
 }