All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: "Stéphane ANCELOT" <sancelot@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] can getstate
Date: Fri, 02 Mar 2007 11:44:56 +0100	[thread overview]
Message-ID: <45E80028.9040801@domain.hid> (raw)
In-Reply-To: <45E80379.6000502@domain.hid>

Stéphane ANCELOT wrote:
> Hi,
> Can somebody provide me with a programming example on how to retrieve 
> state using rt_dev_ioctl .

The following (untested) code snippet should work:

     struct ifreq  ifr;
     can_state_t *pstate;
     ...
     pstate = (can_state_t *)&ifr.ifr_ifru;
     ret = rt_dev_ioctl(fd, SIOCGCANSTATE, &ifr);
     if (ret) {
	perror("rt_dev_ioctl");
	return;
     }
     printf("Current state = %d\n", *pstate);

RT-Socket-CAN allows a very flexible error handling. Please have a look 
to 
http://www.xenomai.org/documentation/trunk/html/api/group__rtcan.html#g451ba35aa4d0bef48cb7b0416f5b4367

Wolfgang,



  parent reply	other threads:[~2007-03-02 10:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-02 10:59 [Xenomai-help] can getstate Stéphane ANCELOT
2007-03-02 10:05 ` Jan Kiszka
2007-03-02 10:44 ` Wolfgang Grandegger [this message]
2007-03-02 16:22   ` Stéphane ANCELOT

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=45E80028.9040801@domain.hid \
    --to=wg@domain.hid \
    --cc=sancelot@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.