Re: extra board specific functions

On 24/08/2007 11:14, Gergely Imreh wrote:
> Thanks for the advice, they are very useful....
> 
> Nevertheless, I keep running into problems, probably because I need to
> know more about the whole working of Comedi.
> 
> For example: if I write my s->do_cmd, if it returns 0, than my program
> can call it only once, after that whenever I call it, Comedi just
> bounces back with -1, not even calling the cmdtest, or anything else.
> If I define return 1; (or anything >0), than it can run it multiple
> times....

s->do_cmd should return 0 unless something drastic happens, such as 
failing to allocate memory or something, in which case it should return 
a negative error value.  All the command compatibility checking is done 
in a previous call to s->do_cmdtest.

> What am I missing? Is the driver supposed to have anything special in
> the do_cmd, and maybe comedi is waiting for it?
> 
> I use these command sources (and made the cmdtest to allow these)
>   cmd.start_src      = TRIG_NOW;
>   cmd.scan_begin_src = TRIG_INT;
>   cmd.convert_src    = TRIG_NOW;
>   cmd.scan_end_src   = TRIG_COUNT;
>   cmd.stop_src       = TRIG_NONE;

I'm guessing that you are trying to start a new command before the old 
one is finished.  If cmd.stop_src is TRIG_NONE it will never finish by 
itself.  Call comedi_cancel to stop it.

In general, you can do kernel-level debugging by inserting a few printk 
calls in the code.

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2007-09-04Z11:28:19