From 2ec4a0f3b91c3dc28f7a951194a7867cdb5b6480 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 1 Jun 2002 23:03:55 +0000 Subject: [PATCH] added check in command test for peculiar restrictions on pcidas-4020 chanlists --- comedi/drivers/cb_pcidas64.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index 3db855b8..dba5bf8d 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -1504,7 +1504,25 @@ static int ai_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd) break; } } - // XXX check 4020 chanlist + // check 4020 chanlist + if( board(dev)->layout == LAYOUT_4020 ) + { + unsigned int first_channel = CR_CHAN( cmd->chanlist[0] ); + for( i = 1; i < cmd->chanlist_len; i++ ) + { + if( CR_CHAN( cmd->chanlist[ i ] ) != first_channel + i ) + { + comedi_error( dev, "chanlist must use consecutive channels" ); + err++; + break; + } + } + if( cmd->chanlist_len == 3 ) + { + comedi_error( dev, "chanlist cannot be 3 channels long, use 1, 2, or 4 channels" ); + err++; + } + } } if(err) return 5; -- 2.26.2