/* File: vca_canping.c - utility to test CAN functionality and throughput */
/* */
/* LibVCA - Versatile CAN/CANopen API library */
-/* Copyright (C) 2005-2006 Michal Sojka, DCE FEE CTU Prague */
+/* Copyright (C) 2005-2009 Michal Sojka, DCE FEE CTU Prague */
/* Copyright (C) 2006-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
/* */
/* LibVCA is free software; you can redistribute it and/or modify it */
/* Command line options */
-char *option_device = "/dev/can0";
+char *option_device = VCA_DEV_NAME;
int option_masters = 0;
long int option_first_id = 1000;
int option_slaves = 0;
struct canfilt_t canfilt; /* filter for received messages */
if (!option_open_once) {
- /* Open can driver */
- if(vca_open_handle(&vcah, option_device, NULL, 0) < 0) {
+ /* Open the CAN driver and disable (D) reception of
+ * all messages until we setup a filter below. */
+ if(vca_open_handle(&vcah, option_device, "D", 0) < 0) {
perror("open");
fprintf(stderr, "Error opening %s (for id %d)\n", option_device, ping_id);
exit(EXIT_CANNOT_OPEN);
struct canfilt_t canfilt; /* filter for received messages */
if (!option_open_once) {
- /* Open the CAN driver */
- if(vca_open_handle(&vcah, option_device, NULL, 0) < 0) {
+ /* Open the CAN driver and disable (D) reception of
+ * all messages until we setup a filter below. */
+ if(vca_open_handle(&vcah, option_device, "D", 0) < 0) {
perror("open");
printf("Error opening %s (for id %d)\n", option_device, ping_id);
exit(EXIT_CANNOT_OPEN);