From 023810446cf306ec068821f4fded1dc1aba49e81 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 26 Feb 2000 23:02:14 +0000 Subject: [PATCH] added command testing --- comedi/comedi_fops.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 8ae2298b..83ee653f 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -525,7 +525,6 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file) comedi_subdevice *s; int ret=0; -DPRINTK("entering do_cmd_ioctl()\n"); if(copy_from_user(&user_cmd,arg,sizeof(comedi_cmd))){ DPRINTK("bad cmd address\n"); return -EFAULT; @@ -592,6 +591,21 @@ DPRINTK("entering do_cmd_ioctl()\n"); goto cleanup; } + ret=s->do_cmdtest(dev,s,&s->cmd); + + if(s->cmd.flags&TRIG_BOGUS || ret){ + user_cmd=s->cmd; + user_cmd.chanlist = NULL; + user_cmd.data = NULL; + if(copy_to_user(arg,&user_cmd,sizeof(comedi_cmd))){ + DPRINTK("fault writing cmd\n"); + ret = -EFAULT; + goto cleanup; + } + ret = -EAGAIN; + goto cleanup; + } + if(!s->prealloc_bufsz){ ret=-ENOMEM; DPRINTK("no buffer (?)\n"); -- 2.26.2