All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: roland Tollenaar <rolandtollenaar@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] CAN rt_dev_recvfrom
Date: Wed, 28 Feb 2007 21:59:21 +0100	[thread overview]
Message-ID: <45E5ED29.8070505@domain.hid> (raw)
In-Reply-To: <bc4264770702281208u7d7ee013qa5be819a5856d4ea@domain.hid>

roland Tollenaar wrote:
> Hi,
> 
> Ok the issue I posted earlier regarding the read function. It seems
> that it IS recieving can messages and displaying them correctly. Only
> its behaviour is not as I expected. I thought the function
> 
> rt_dev_recvfrom
> 
> would simply perform a read one frame from a buffer (which in my
> experience holds a number of can messages) then exit.
> 
> By the look of things I will have to implement the aforementioned
> buffer myself. I.e
> 
> run rt_dev_recvfrom in a separate thread other than my periodic task
> and store an x number of messages in BUFFER that I recieve there. The
> can_read() function which I implement in the periodic task must then
> simply read the messages from BUFFER.
> 
> Can this be confirmed or is rt_dev_recvfrom() behaving incorrectly in my 
> case?

rt_dev_recvfrom() reads message frames (one at a time) from an internal 
socket buffer (there is actually a kernel configuration option to 
configure the size). If no messages are available, it will block by 
default, but it can also be used in non-blocking mode by using the flag 
MSG_DONTWAIT. It seems, that your application is trying to read messages 
periodically in polling mode. Either you do reading and buffering in 
your own thread as you suggested above or you use rt_dev_recvfrom() in 
non-blocking mode.

Wolfgang.



  reply	other threads:[~2007-02-28 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 20:08 [Xenomai-help] CAN rt_dev_recvfrom roland Tollenaar
2007-02-28 20:59 ` Wolfgang Grandegger [this message]
2007-03-01 11:22   ` Roland Tollenaar
2007-03-01 11:32     ` Wolfgang Grandegger
2007-03-01 12:10       ` Roland Tollenaar
2007-03-01 12:25         ` Wolfgang Grandegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45E5ED29.8070505@domain.hid \
    --to=wg@domain.hid \
    --cc=rolandtollenaar@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.