All of lore.kernel.org
 help / color / mirror / Atom feed
* Error Active
@ 2014-04-14  8:03 Steffen Rose
  2014-04-14  8:50 ` Wolfgang Grandegger
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Rose @ 2014-04-14  8:03 UTC (permalink / raw)
  To: linux-can@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-14 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-14  8:03 Error Active Steffen Rose
2014-04-14  8:50 ` 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

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.