Linux CAN drivers development
 help / color / mirror / Atom feed
From: Steffen Rose <ro@emtas.de>
To: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Error Active
Date: Mon, 14 Apr 2014 10:03:51 +0200	[thread overview]
Message-ID: <15704970.EHNVEi1RO0@lisa> (raw)

Hello,

I write a generic application, that should work with different socketcan driver implementations. 
I know, there are different possibilities to get the CAN controller state. And I see, that different 
implementation do not implement all of them.

What is the standard way to get the state change from Error Passive to Error Active?

My current way (in short incomplete form):

can_err_mask_t err_mask = CAN_ERR_FLAG | CAN_ERR_CRTL | CAN_ERR_PROT | CAN_ERR_BUSOFF;
setsockopt(mBSDSocket, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask, sizeof(err_mask));

got = read(mBSDSocket, &frame, sizeof(struct can_frame));
if (frame.can_id & CAN_ERR_FLAG) {
  if (frame.can_id & CAN_ERR_PROT) {
    if (frame.data[2] & CAN_ERR_PROT_ACTIVE) {

=> change to Error active

    }
  }
}

This will work with the Systec USB interface, but do not work with Peak, Beagle bone, EMS CPC.
I have seen the implementation in the can utils.

I know, the libsocketcan implements a different way. But I cannot extract the relevant parts. 
And I think a have to poll the current state with it and I search an event based mechanism.

-- 
Mit freundlichen Grüßen / Regards
Steffen Rose
www.emtas.de

             reply	other threads:[~2014-04-14  8:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14  8:03 Steffen Rose [this message]
2014-04-14  8:50 ` Error Active Wolfgang Grandegger
2014-04-14  9:56   ` Steffen Rose
2014-04-14 11:05     ` Wolfgang Grandegger
2014-04-14 12:13       ` Steffen Rose
2014-04-14 14:38         ` 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=15704970.EHNVEi1RO0@lisa \
    --to=ro@emtas.de \
    --cc=linux-can@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox