<code c candump.are>
/* DESC: This script can be used to receive CAN messages
* Copyright (C) 2014 NetModule AG, Switzerland
*/
DEV = "can0"; /* CAN1 */
BITRATE = 125000; /* run 125kbit bitrate */
LISTENONLY = 1; /* open in listen-only mode */
RESTART_TIMEOUT = 0; /* restart timeout in case of bus-off (msecs, 0 = disabled) */
MAX_MESSAGES = 1024; /* max. number of dumped messages */
ret = nb_can_setattr(DEV, BITRATE, LISTENONLY, RESTART_TIMEOUT);
if (ret != 0) {
printf("Unable to set attributes of %s\n", DEV);
exit(1);
}
sock = nb_can_open(DEV);
if (sock < 0) {
printf("Unable to open %s\n", DEV);
exit(1);
}
if (0) {
FILTER_ID = 1;
FILTER_MASK = 0xFFFFFFFF;