int start_can() { ret = nb_can_setattr(DEV, BITRATE, LISTENONLY, RESTART_TIMEOUT); if (ret != 0) { printf("Unable to set attributes of %s\n", DEV); exit(1); } printf("Attributes set for device %s\n", DEV); can_sock = nb_can_open(DEV); if ( can_sock < 0){ printf("Unable to open %s\n", DEV); exit(1); } // CAN Filtering can be done here if (0) { FILTER_ID = 1; FILTER_MASK = 0xFFFFFFFF; if (nb_can_setfilter(sock, FILTER_ID, FILTER_MASK) < 0) { printf("Unable to set filter on %s\n", DEV); can_close(can_sock); exit(1); } } return can_sock; }