*Never* called?  Or just not called when the FIFO is empty and you
do  a read from it?  This is a known problem that I had a quick "fix" for, 
but was never put in to any releases of RTLinux.  I say "fix" because I am not
sure if it would be compliant with POSIX to act this way (in other words, it
may be correct by POSIX standards to not call the handler on reads when the 
FIFO is empty).  This does seem to severely limit the usefulness of FIFOs,
though.  My suggestion is to do sort of an ack an response scheme in your
handler where the userspace program sends a request via another FIFO, then
the handler that gets called for that FIFO writes to the FIFO that the user
space program is reading from.  That, or just have a real-time task write
data to the FIFO whenever it has some to write, until the FIFO is full, and
have the user space program poll on that FIFO.

On Thu, Mar 01, 2001 at 09:27:47AM +0100, Olaf Petzold wrote:
> Hello,
> 
> the following installed rtf handler doesn't work on read ops from user space.
> On write ops the handler is called. Refering to the man page, both should work.
> My fault or a bug in rtf_fifo of 2.2.18-rtl3-final?
> 
> Regards
> Olaf
> -------------------------------
> [...]
> #define RTF   0
> size_t number(void) { return RTF; }
> 
> int rtfHandler(size_t fifo) // never called on read ops from user mode
> {
>     size_t sz;
>     const char *msg = "Hallo World\n";
> 
>     DBG("notify Rtf%d\n", fifo);
>     sz = strlen(msg);
>     rtf_put(number(), &sz, sizeof(sz));
>     rtf_put(number(), (void*)msg, sz);
> 
>     return 0;
> }
> 
> int init_module(void)
> {     
>     int ret;
>     size_t sz = 4000;
> 
>     (void)rtf_destroy(number());
> 
>     if((ret = rtf_create(number(), sz)) < 0) {
>       ERROR("Error opening RTF%d\n", number());
>       return -1;
>     }
> 
>     if((ret = rtf_create_handler(number(), &rtfHandler)) < 0) {
>       ERROR("Error installing handler on RTF%d\n", number());
>       (void)rtf_destroy(number());
>       return -1;
> 
>     }
> 
>     return 0;
> }
> 
> 
> void cleanup_module(void)
> {
>     (void)rtf_destroy(number());
> }
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to