From: David Schleef Date: Fri, 22 Nov 2002 07:15:09 +0000 (+0000) Subject: Fix for cases where the command doesn't allow source choices X-Git-Tag: r0_7_21~294 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=847fb8c86cd9c941b703aed5745edde489577112;p=comedilib.git Fix for cases where the command doesn't allow source choices --- diff --git a/testing/cmd_1.c b/testing/cmd_1.c index de40842..6b16a51 100644 --- a/testing/cmd_1.c +++ b/testing/cmd_1.c @@ -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; }