Get CAN statistics
#include <sys/can_dcmd.h> #define CAN_DEVCTL_GET_STATS __DIOF(_DCMD_MISC, CAN_CMD_CODE + 100, struct can_devctl_stats)
| Argument | Value | 
|---|---|
| filedes | A file descriptor that you obtained by opening the device | 
| dcmd | CAN_DEVCTL_GET_STATS | 
| dev_data_ptr | A pointer to a struct can_devctl_stats | 
| n_bytes | sizeof(struct can_devctl_stats) | 
| dev_info_ptr | NULL | 
This command gets CAN statistics, including some that you can use to monitor CAN bus issues.
None.
A filled-in struct can_devctl_stats, which is defined in <sys/can_dcmd.h> as follows:
typedef struct can_devctl_stats
{
    uint32_t                    transmitted_frames;
    uint32_t                    received_frames;
    uint32_t                    missing_ack;
    uint32_t                    total_frame_errors;
    uint32_t                    stuff_errors;
    uint32_t                    form_errors;
    uint32_t                    dom_bit_recess_errors;
    uint32_t                    recess_bit_dom_errors;
    uint32_t                    parity_errors;
    uint32_t                    crc_errors;
    uint32_t                    hw_receive_overflows;
    uint32_t                    sw_receive_q_full;
    uint32_t                    error_warning_state_count;
    uint32_t                    error_passive_state_count;
    uint32_t                    bus_off_state_count;
    uint32_t                    bus_idle_count;
    uint32_t                    power_down_count;
    uint32_t                    wake_up_count;
    uint32_t                    rx_interrupts;
    uint32_t                    tx_interrupts;
    uint32_t                    total_interrupts;
} CAN_DEVCTL_STATS;