ionotify

hi
Any example for a ionotify function about serial devices monitoring input
stream.


please forget my english

Hi all:

I want to know how to manage messaging process when i use readcond() and
ionotify() functions.
We have all runing in QNX 4.25 and using dev_read. Migrating documents says
that dev_read must be changed with devcond and ionotify (QNX 6.20), but when
you use
ionotify(), it seems to nothing happend .How we must manage this??

All your help we 'll be appreciated.
David

Please i need an answer!!!
“Francisco Philip” <francisco.philip@fibertel.com.ar> escribió en el mensaje
news:bastm7$5ud$1@inn.qnx.com

hi
Any example for a ionotify function about serial devices monitoring input
stream.


please forget my english

ionotify() only tells some resource manager that you want to be notified
when data are available. You fill in sigevent and pass it, when data is
available that sigevent is passed back to you. So how you’re notified
depends on what do you fill into sigevent - it could be a signal or it could
be a pulse (then you need to be waiting in MsgReceive() to get it). The
notification works only once per ionotify() call - you’re supposed to re-arm
after each notification.

The trickiest part is that definition of ‘data available’ is dependent on
resource manager. With buffered stream-oriented I/O managers the general
rule is that notifications will NOT be sent on every byte. You only get them
when buffer transitions from empty to non-empty state (does not matter if
you use POLLARM or TRANARM - it is gonna work as TRANARM anyway). That means
you’re supposed to drain the buffer completely upon every notification (i
guess using readcond() in you case). That also means you should call
ionotify() as soon as you have fd available (before any data can actually
arrive).

– igor

“David Hoffman” <dhoffman@sortearsa.com.ar> wrote in message
news:bb7go9$c25$1@inn.qnx.com

Hi all:

I want to know how to manage messaging process when i use readcond() and
ionotify() functions.
We have all runing in QNX 4.25 and using dev_read. Migrating documents
says
that dev_read must be changed with devcond and ionotify (QNX 6.20), but
when
you use
ionotify(), it seems to nothing happend .How we must manage this??

All your help we 'll be appreciated.
David

Please i need an answer!!!
“Francisco Philip” <> francisco.philip@fibertel.com.ar> > escribió en el
mensaje
news:bastm7$5ud$> 1@inn.qnx.com> …
hi
Any example for a ionotify function about serial devices monitoring
input
stream.


please forget my english

\

Igor Kovalenko <kovalenko@attbi.com> wrote in message
news:bb7q0m$mfe$1@inn.qnx.com

ionotify() only tells some resource manager that you want to be notified
when data are available. You fill in sigevent and pass it, when data is
available that sigevent is passed back to you. So how you’re notified
depends on what do you fill into sigevent - it could be a signal or it
could
be a pulse (then you need to be waiting in MsgReceive() to get it). The
notification works only once per ionotify() call - you’re supposed to
re-arm
after each notification.

Since he is porting a QNX4 application, I image he already have a big
loop block on MsgReceive(), so QNX4 code will roughly changed to
something like:

  1. allocate proxy —> prepare sigevent

struct sigevent ev;
int coid = ConnectAttach(…);
SIGEV_PULSE_INIT(&ev, coid, …);

  1. a dev_read() will translate something to:

while (ionotify(fd, action, _NOTIFY_COND_INPUT, &ev) &
_NOTIFY_COND_INPUT)
{
readcond(…);
}

  1. and in the big loop, make sure you do something like:

if (received the pulse setup in 1) {
do {
readcond(…);
} while (ionotify(fd, action, _NOTIFY_COND_INPUT, &ev) &
_NOTIFY_COND_INPUT)

}

The trickiest part is that definition of ‘data available’ is dependent on
resource manager. With buffered stream-oriented I/O managers the general
rule is that notifications will NOT be sent on every byte. You only get
them
when buffer transitions from empty to non-empty state (does not matter if
you use POLLARM or TRANARM - it is gonna work as TRANARM anyway). That
means
you’re supposed to drain the buffer completely upon every notification (i
guess using readcond() in you case). That also means you should call
ionotify() as soon as you have fd available (before any data can actually
arrive).

Well, as above sample code showes, ionotify() will return you the
current condition, so all you need is to check the return value (and
keeps on drain as you do in dev_read()).

-xtang