Hello Marc,
well, I do not really like name CAN_ERR_CRTL_UNSPEC, but this
has done the job for both MSCAN and SJA1000 (ixxat_pci to
be more specific) drivers under rev 1033. The HW I use at the
moment (with rev 1181) is IXXAT HW (so the ixxat_pci driver).
I of course may poll the interface state by the mean of
"can_get_state" from the netlink lib, but it will be nice to have
a reliable event for that. CAN_ERR_PROT_ACTIVE however does not
seems to be appropriate for me. According to the "error.h", the
CAN_ERR_PROT_ACTIVE is from the data[2], which is used for
indication errors in CAN protocol. What I need in my case is
to get an event, that CAN-controller has error-free status. And
for the CAN-controller status the data[1] byte is used. Error
warning/passive events are indicated over corresponding bits of
that byte. And if all that errors are cleared, I actually expect
to get an event with no bits set for warning/passive bits. Rx/Tx
overflow bit may be still set. So you are right, instead of using
(CanFrame.data[1] == CAN_ERR_CRTL_UNSPEC)
The following construction shall be the proper signal of
CAN-controller became error active:
((CanFrame.data[1] & (CAN_ERR_CRTL_RX_WARNING|
CAN_ERR_CRTL_TX_WARNING|
CAN_ERR_CRTL_RX_PASSIVE|
CAN_ERR_CRTL_TX_PASSIVE)) == 0)
Thanks and regards,
Vladislav
-----Original Message-----
From: Marc Kleine-Budde [mailto:[email protected]]
Sent: Monday, June 14, 2010 1:55 PM
To: Gribov, Vladislav
Cc: [email protected]; [email protected]
Subject: Re: error active (CAN_ERR_CRTL / CAN_ERR_CRTL_UNSPEC) not
indicated in rev1181
[email protected] wrote:
> Hello,
> I have got a question concerning receiving the can error control
messages.
>
> We have used SocketCAN SW (rev 1033) with sysfs control for our
CANopen SW.
> Everything was working just fine. We have received CAN error control
> messages (can_id CAN_ERR_CRTL with flag CAN_ERR_FLAG set) to react on
> the following events:
> - bus-off
> - CAN Rx overrun
> - error passive
> - error active (recovery from errors)
>
> The "error active" was indicated by the error control message with the
> value CAN_ERR_CRTL_UNSPEC in the databyte 1.
hmmm..."CAN_ERR_CRTL_UNSPEC" meaning "error active" looks like an
implementation defined detail, bad design or even a bug (YMMV) :).
Which driver are you using?
> Now I try to use more current version (rev 1181) of SocketCAN, because
> we need netlink CAN control API. Here I see one problem - no error
> active is indicated. The CAN_ERR_CRTL_UNSPEC error control messages
are missed.
> I observe this problem with both sysfs and netlink variants.
> Is it known and wanted behavior, to not indicate CAN_ERR_CRTL_UNSPEC
any more?
My at91_can driver send an explicid CAN_ERR_PROT_ACTIVE
(http://lxr.linux.no/linux+v2.6.34/drivers/net/can/at91_can.c#L833),
which is
(http://lxr.linux.no/linux+v2.6.34/include/linux/can/error.h#L53).
There isn't any other mainline driver who uses this flag. Looks like a
bug to me.
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users