thanks for all help so far. My latest Problem is triggered by a read() on a
comedi device representing an USB-DUX sampling with a given frequency but
without data in the queue. Actually my program is suspended as expected, but
never again woken up on the arrival of new data.
Attached are two patches that are each fixing the Problem and I would be
interested in an explanation on how to fix it best.
1. As the wake_up_interruptible call in comedi_fops.c comedi_event(...) is
never reached, because of
s->async->events == 0
if called from usbdux.c, the simplest approach is to call
wake_up_interruptible from usbdux.c in usbduxsub_ai_IsocIrq(...).
2. The other patch is setting the events bitfield in usbduxsub_ai_IsocIrq(...)
to |= COMEDI_CB_EOS and extends the cb_mask to account for this bit, if the
commands scan_begin_src field == TRIG_TIMER in comedi_fops.c
do_cmd_ioctl(...), regardless of other flags. Although I'm quite unsure if I
chose the correct flag and what side effects this change might have on other
drivers, the wake_up_interruptible is now reached if new data arrives.
With either solution my program returns safely from suspend an arrival of new
data, but how is it supposed to be done?
Cheers,
Jan
K, checked this and it works. But in comedi.h I found:
#define COMEDI_CB_BLOCK 4 /* DEPRECATED: convenient block size */
so, what is the best non deprecated way? The ..._EOS-Event is normally not
checked in comedi_event() and would thus still lead to an ever sleeping
userspace program. (See the second patch from my previous mail.)
Thanks for inspecting the issue!
Jan
I'm not sure what you're suggesting. You want to drop support for blocking
read() (and by extension fread())? What is wrong with supporting it?
BTW, just to rule out any possible confusion the "block" in
COMEDI_CB_BLOCK refers to an arbitrary sized block of data, not blocking
reads/writes. I don't know why dave marked COMEDI_CB_BLOCK as deprecated
in the header.
So, will this get fixed? Because as long as O_NONBLOCK isn't set on file
descriptor I would expect a read to be blocking and thus I would consider the
current behaviour a bug.
Sincerely,
Jan-Matthias Braun
On Thursday 26. November 2009 21:21:30 Bernd Porr wrote:
> I've committed these changes to the CVS. Can you check, please.
Works like a charm for me. Thanks for the efforts!
Cheers,
Jan