]> rtime.felk.cvut.cz Git - canping.git/commitdiff
Call vca_open_handle() with "D" flag to setup filters correctly for socketcan
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 8 Sep 2009 15:51:58 +0000 (17:51 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 8 Sep 2009 15:51:58 +0000 (17:51 +0200)
src/vca_canping.c

index b29f465270efa2207d897623f50f7c221f26f929..e468c4da56519f5f0f298fb8409e5b1e06f250da 100644 (file)
@@ -248,8 +248,9 @@ void *master_thread(void *arg)
        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); 
@@ -466,8 +467,9 @@ void *slave_thread(void *arg)
        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);