Quick fix for new RTDM interface in Xemomai 3, now posix
authorEdouard Tisserant
Fri, 23 Mar 2018 15:15:18 +0100
changeset 802 82e8646d08f5
parent 801 32d146b64a35
child 803 cb315e75b3bd
Quick fix for new RTDM interface in Xemomai 3, now posix
drivers/can_socket/can_socket.c
--- a/drivers/can_socket/can_socket.c	Wed Mar 21 13:33:43 2018 +0100
+++ b/drivers/can_socket/can_socket.c	Fri Mar 23 15:15:18 2018 +0100
@@ -31,14 +31,6 @@
 #ifdef RTCAN_SOCKET
 #include "rtdm/can.h"
 #define CAN_IFNAME     "rtcan%s"
-#define CAN_SOCKET     rt_dev_socket
-#define CAN_CLOSE      rt_dev_close
-#define CAN_RECV       rt_dev_recv
-#define CAN_SEND       rt_dev_send
-#define CAN_BIND       rt_dev_bind
-#define CAN_IOCTL      rt_dev_ioctl
-#define CAN_SETSOCKOPT rt_dev_setsockopt
-#define CAN_ERRNO(err) (-err)
 #else
 #include <unistd.h>
 #include <sys/socket.h>
@@ -54,15 +46,16 @@
 #endif
 //#include "af_can.h"
 #define CAN_IFNAME     "can%s"
+#endif
+
 #define CAN_SOCKET     socket
 #define CAN_CLOSE      close
 #define CAN_RECV       recv
 #define CAN_SEND       send
 #define CAN_BIND       bind
 #define CAN_IOCTL      ioctl
+#define CAN_SETSOCKOPT setsockopt
 #define CAN_ERRNO(err) errno
-#define CAN_SETSOCKOPT setsockopt
-#endif
 
 #include "can_driver.h"
 
@@ -210,7 +203,7 @@
     err = CAN_SETSOCKOPT(*(int *)fd0, SOL_CAN_RAW, CAN_RAW_LOOPBACK,
                &loopback, sizeof(loopback));
     if (err) {
-        fprintf(stderr, "rt_dev_setsockopt: %s\n", strerror (CAN_ERRNO (err)));
+        fprintf(stderr, "setsockopt: %s\n", strerror (CAN_ERRNO (err)));
         goto error_close;
     }
   }
@@ -221,7 +214,7 @@
     err = CAN_SETSOCKOPT(*(int *)fd0, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS,
                &recv_own_msgs, sizeof(recv_own_msgs));
     if (err) {
-        fprintf(stderr, "rt_dev_setsockopt: %s\n", strerror (CAN_ERRNO (err)));
+        fprintf(stderr, "setsockopt: %s\n", strerror (CAN_ERRNO (err)));
         goto error_close;
     }
   }