Skip to contentSkip to conversation

Access to tx / rx / err counters

Xenomai Julien Blanc 1 participant 2 messages Jul 3, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

/proc/rtcan/devices , as well as the respective /proc/rtcan/<device>/info both gives access to the TX-Counter, RX- Counter and Errors counter of the device.

I'd like to access these counters from an application, but cannot find the appropriate ioctls to do this. Adding them is not an issue, but i would like to avoid duplicating any existing feature, or to read the /proc filesystem whose format is not really guaranted.

Is there a way to access these counters ? And if not, what would be the ioctl to add ? For example :

#define RTCAN_RTIOC_GET_RXCOUNTER _IOR(RTIOC_TYPE_CAN, 0xC, int) #define RTCAN_RTIOC_GET_TXCOUNTER _IOR(RTIOC_TYPE_CAN, 0xD, int) #define RTCAN_RTIOC_GET_ERRCOUNTER _IOR(RTIOC_TYPE_CAN, 0xE, int)

Regards,

Julien

#1 lore raw

Le mardi 03 juillet 2018 à 09:40 +0200, Julien Blanc a écrit :

Quoted 8 lines


Is there a way to access these counters ? And if not, what would be the
ioctl to add ? For example :

#define RTCAN_RTIOC_GET_RXCOUNTER _IOR(RTIOC_TYPE_CAN, 0xC, int) #define RTCAN_RTIOC_GET_TXCOUNTER _IOR(RTIOC_TYPE_CAN, 0xD, int) #define RTCAN_RTIOC_GET_ERRCOUNTER _IOR(RTIOC_TYPE_CAN, 0xE, int)

Attached is a patch that does exactly that (ie, adding the ioctls). Based on xenomai 3.0.4, tested only with the flexcan driver (but should work with any other).

Regards,

Julien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtcan_counters_ioctl.patch
Type: text/x-patch
Size: 1792 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20180703/034e174c/attachment.bin>