Wolfgang -

Aaah... the user should not be able to send the second command, if the
first command is not finished. So you basicly have 2 choices:
a) let the user write() function sleep (=blocking) until the first
command is finished.

This _would_ be ideal except I would need a way to signal the write
command to unblock. This is impossible because I would have to signal
from the send callback which is in_interrupt.

OR
b) insert the user commands into a queue and process them one-by-one.
This approach is used in the auerswald driver (usb/misc/auerswald),
which I wrote (but without kernel timers, of course).

This should work and is essentially the same as the circular buffer
method I proposed a few emails ago.


> But, changing the frequency requires a
> sleep, so I cannot call it from in_interrupt (the receive
> callback or timer.

If you use kernel timers, why do you want to call sleep()?


Well, because tuning the radio requires two commands to be sent. The
commands must have a delay between them.  So, I am unable to execute
tune() from a timer or urb callback function.  Note,  I must wait for
a report to be sent from the device before calling tune() again.  Now,
if I use the queue technique I could just put both commands on the
queue where the dispatcher will handle the timing.

> And it would be a plus if the user can call
> seek asynchronously as well since it can take up to 20 seconds to
> check the whole FM band and I don't want to require knowledge of
> threads.

So, for seek() commands, you will have only two seek commands
a) the command which is executed
b) the command which waits until a) is finished.

Yes, this should work reasonably well with the queue technique.  I
could easily implement a).  But how do I let b) block until a) is
finished?  There is no way to signal from in_interrupt.

Thanks,
Paul
Paul


If there is a third seek() if b) is waiting, throw away b) and insert
the new seek.

regards
Wolfgang

--
We're back to the times when men were men
and wrote their own device drivers.

(Linus Torvalds)



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to