]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Change to CAN_MSG_VERSION_2 and elimination of linux/*.h headers from user space... CLT_COMM_CAN_post_canmsg_change
authorppisa <ppisa>
Sat, 21 Feb 2004 21:23:47 +0000 (21:23 +0000)
committerppisa <ppisa>
Sat, 21 Feb 2004 21:23:47 +0000 (21:23 +0000)
Layout of canmsg_t changed to CAN_MSG_VERSION_2, which is compatible
with PORT GmbH <http://www.port.de/> can4linux-3.1 implementation.
The driver and utilities can be compiled with old version,
if definition of CAN_MSG_VERSION_2 is commented out in
lincan/include/canmsg.h and canvca/libvca/canmsg.h headers.

The change from __u8 .. __u32 types to standard compliant u_int8_t .. u_int32_t
types has been required to eliminate linux/*.h files. This can make
problems to ancient Linux distributions and some workaround could
be necessary.

14 files changed:
lincan/include/can.h
lincan/include/can_queue.h
lincan/include/canmsg.h [new file with mode: 0644]
lincan/include/constants.h
lincan/include/devcommon.h
lincan/src/main.c
lincan/src/sja1000.c
lincan/utils/can-proxy.c
lincan/utils/readburst.c
lincan/utils/readburst_rtl.c
lincan/utils/rxtx.c
lincan/utils/send.c
lincan/utils/sendburst.c
lincan/utils/sendburst_rtl.c

index 8247c3511e7d34e6938cb5012368632081a74735..3cf633b75761318b4a28df9c61d522bd5c1bda4d 100644 (file)
@@ -1,84 +1,25 @@
-#ifndef _CANMSG_T_H
-#define _CANMSG_T_H
+#ifndef _CAN_DRVAPI_T_H
+#define _CAN_DRVAPI_T_H
 
 
+#ifdef __KERNEL__
+
+#include <linux/time.h>
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
-#ifndef PACKED
-#define PACKED __attribute__((packed))
-#endif
-
-#define CAN_MSG_LENGTH 8
-
-/**
- * struct canmsg_t - structure representing CAN message
- * @flags:  message flags
- *      %MSG_RTR .. message is Remote Transmission Request,
- *     %MSG_EXT .. message with extended ID, 
- *      %MSG_OVR .. indication of queue overflow condition,
- *     %MSG_LOCAL .. message originates from this node.
- * @cob:    communication object number (not used)
- * @id:     ID of CAN message
- * @timestamp: not used
- * @length: length of used data
- * @data:   data bytes buffer
- *
- * Header: can.h
- */
-struct canmsg_t {
-       short           flags;
-       int             cob;
-       unsigned long   id;
-       unsigned long   timestamp;
-       unsigned int    length;
-       unsigned char   data[CAN_MSG_LENGTH];
-} PACKED;
+#else /* __KERNEL__ */
 
 
-/**
- * struct canfilt_t - structure for acceptance filter setup
- * @flags:  message flags
- *      %MSG_RTR .. message is Remote Transmission Request,
- *     %MSG_EXT .. message with extended ID, 
- *      %MSG_OVR .. indication of queue overflow condition,
- *     %MSG_LOCAL .. message originates from this node.
- *     there are corresponding mask bits
- *     %MSG_RTR_MASK, %MSG_EXT_MASK, %MSG_LOCAL_MASK.
- *     %MSG_PROCESSLOCAL enables local messages processing in the
- *     combination with global setting
- * @queid:  CAN queue identification in the case of the multiple
- *         queues per one user (open instance)
- * @cob:    communication object number (not used)
- * @id:     selected required value of cared ID id bits
- * @mask:   select bits significand for the comparation;
- *          1 .. take care about corresponding ID bit, 0 .. don't care
- *
- * Header: can.h
- */
-struct canfilt_t {
-       int             flags;
-       int             queid;
-       int             cob;
-       unsigned long   id;
-       unsigned long   mask;
-};
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
 
 
-/* Definitions to use for canmsg_t and canfilt_t flags */
-#define MSG_RTR   (1<<0)
-#define MSG_OVR   (1<<1)
-#define MSG_EXT   (1<<2)
-#define MSG_LOCAL (1<<3)
-/* If you change above lines, check canque_filtid2internal function */
+#endif /* __KERNEL__ */
 
 
-/* Additional definitions used for canfilt_t only */
-#define MSG_FILT_MASK_SHIFT   8
-#define MSG_RTR_MASK   (MSG_RTR<<MSG_FILT_MASK_SHIFT)
-#define MSG_EXT_MASK   (MSG_EXT<<MSG_FILT_MASK_SHIFT)
-#define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
-#define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
+#include "./canmsg.h"
 
 
-
-/* Can message ID mask */
-#define MSG_ID_MASK ((1l<<29)-1)
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* CAN ioctl magic number */
 #define CAN_IOC_MAGIC 'd'
 
 /* CAN ioctl magic number */
 #define CAN_IOC_MAGIC 'd'
@@ -105,4 +46,8 @@ typedef unsigned short channel_t;
 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
 #define CANQUE_FLUSH  _IO(CAN_IOC_MAGIC, 11)
 
 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
 #define CANQUE_FLUSH  _IO(CAN_IOC_MAGIC, 11)
 
-#endif /*_CANMSG_T_H*/
+#ifdef __cplusplus
+} /* extern "C"*/
+#endif
+
+#endif /*_CAN_DRVAPI_T_H*/
index 1392f3a665bd87ba42df06398e0d6f8b9af997bb..709dda7dbc71c8a99e4fffe41bcba306002b2053 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _CAN_QUEUE_H
 #define _CAN_QUEUE_H
 
 #ifndef _CAN_QUEUE_H
 #define _CAN_QUEUE_H
 
-#include "./can.h"
+#include "./canmsg.h"
 #include "./constants.h"
 #include "./can_sysdep.h"
 
 #include "./constants.h"
 #include "./can_sysdep.h"
 
diff --git a/lincan/include/canmsg.h b/lincan/include/canmsg.h
new file mode 100644 (file)
index 0000000..8277b9e
--- /dev/null
@@ -0,0 +1,126 @@
+#ifndef _CANMSG_T_H
+#define _CANMSG_T_H
+
+#ifdef __KERNEL__
+
+#include <linux/time.h>
+#include <linux/types.h>
+
+#else /* __KERNEL__ */
+
+#include <sys/time.h>
+#include <sys/types.h>
+
+#endif /* __KERNEL__ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 
+ * CAN_MSG_VERSION_2 enables new canmsg_t layout compatible with
+ * can4linux project from http://www.port.de/
+ * 
+ */
+#define CAN_MSG_VERSION_2
+
+/* Number of data bytes in one CAN message */
+#define CAN_MSG_LENGTH 8
+
+#ifdef CAN_MSG_VERSION_2
+
+typedef struct timeval canmsg_tstamp_t ;
+
+/**
+ * struct canmsg_t - structure representing CAN message
+ * @flags:  message flags
+ *      %MSG_RTR .. message is Remote Transmission Request,
+ *     %MSG_EXT .. message with extended ID, 
+ *      %MSG_OVR .. indication of queue overflow condition,
+ *     %MSG_LOCAL .. message originates from this node.
+ * @cob:    communication object number (not used)
+ * @id:     ID of CAN message
+ * @timestamp: not used
+ * @length: length of used data
+ * @data:   data bytes buffer
+ *
+ * Header: canmsg.h
+ */
+struct canmsg_t {
+       int             flags;
+       int             cob;
+       unsigned long   id;
+       canmsg_tstamp_t timestamp;
+       unsigned short  length;
+       unsigned char   data[CAN_MSG_LENGTH];
+};
+
+#else /*CAN_MSG_VERSION_2*/
+#ifndef PACKED
+#define PACKED __attribute__((packed))
+#endif
+/* Old, deprecated version of canmsg_t structure */
+struct canmsg_t {
+       short           flags;
+       int             cob;
+       unsigned long   id;
+       unsigned long   timestamp;
+       unsigned int    length;
+       unsigned char   data[CAN_MSG_LENGTH];
+} PACKED;
+#endif /*CAN_MSG_VERSION_2*/
+
+typedef struct canmsg_t canmsg_t;
+
+/**
+ * struct canfilt_t - structure for acceptance filter setup
+ * @flags:  message flags
+ *      %MSG_RTR .. message is Remote Transmission Request,
+ *     %MSG_EXT .. message with extended ID, 
+ *      %MSG_OVR .. indication of queue overflow condition,
+ *     %MSG_LOCAL .. message originates from this node.
+ *     there are corresponding mask bits
+ *     %MSG_RTR_MASK, %MSG_EXT_MASK, %MSG_LOCAL_MASK.
+ *     %MSG_PROCESSLOCAL enables local messages processing in the
+ *     combination with global setting
+ * @queid:  CAN queue identification in the case of the multiple
+ *         queues per one user (open instance)
+ * @cob:    communication object number (not used)
+ * @id:     selected required value of cared ID id bits
+ * @mask:   select bits significand for the comparation;
+ *          1 .. take care about corresponding ID bit, 0 .. don't care
+ *
+ * Header: canmsg.h
+ */
+struct canfilt_t {
+       int             flags;
+       int             queid;
+       int             cob;
+       unsigned long   id;
+       unsigned long   mask;
+};
+
+typedef struct canfilt_t canfilt_t;
+
+/* Definitions to use for canmsg_t and canfilt_t flags */
+#define MSG_RTR   (1<<0)
+#define MSG_OVR   (1<<1)
+#define MSG_EXT   (1<<2)
+#define MSG_LOCAL (1<<3)
+/* If you change above lines, check canque_filtid2internal function */
+
+/* Additional definitions used for canfilt_t only */
+#define MSG_FILT_MASK_SHIFT   8
+#define MSG_RTR_MASK   (MSG_RTR<<MSG_FILT_MASK_SHIFT)
+#define MSG_EXT_MASK   (MSG_EXT<<MSG_FILT_MASK_SHIFT)
+#define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
+#define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
+
+/* Can message ID mask */
+#define MSG_ID_MASK ((1l<<29)-1)
+
+#ifdef __cplusplus
+} /* extern "C"*/
+#endif
+
+#endif /*_CANMSG_T_H*/
index 87863e82f71acfa19ef8af582fccd216c75cd645..8a918baca03cd5dae1d7cd825ea1c475ef4b9d80 100644 (file)
@@ -7,19 +7,18 @@
  * Version lincan-0.2  9 Jul 2003
  */
 
  * Version lincan-0.2  9 Jul 2003
  */
 
-#ifdef __CONSTANTS_H__
-#else
+#ifndef __CONSTANTS_H__
 #define __CONSTANTS_H__
 
 /* Device name as it will appear in /proc/devices */
 #define DEVICE_NAME "can"
 
 #define __CONSTANTS_H__
 
 /* Device name as it will appear in /proc/devices */
 #define DEVICE_NAME "can"
 
+/* Version of the driver reported by */
+
+
 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
 #define CAN_MAJOR 91
 
 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
 #define CAN_MAJOR 91
 
-/* Timeout in jiffies before the system calls return with an error */
-#define CANTIMEOUT (4*HZ)
-
 /* Definition of the maximum number of concurrent supported hardware boards,
  * chips per board, total number of chips, interrupts and message objects.
  * Obviously there are no 32 different interrupts, but each chip can have its
 /* Definition of the maximum number of concurrent supported hardware boards,
  * chips per board, total number of chips, interrupts and message objects.
  * Obviously there are no 32 different interrupts, but each chip can have its
index f49b2fec44ab09222fcca91799313fbdd7c92013..ef67e49acc54a445d89af1cca21f0959362c92ed 100644 (file)
@@ -6,7 +6,7 @@
  * Version lincan-0.2  9 Jul 2003
  */
 
  * Version lincan-0.2  9 Jul 2003
  */
 
-#include "./can.h"
+#include "./canmsg.h"
 #include "./can_sysdep.h"
 #include "./constants.h"
 #include "./can_queue.h"
 #include "./can_sysdep.h"
 #include "./constants.h"
 #include "./can_queue.h"
index 7851340b81eca5df17b02ea083a7bbd9a4323593..23bd6da2ed57b6207f0ad93eb09e3e90c7a7e44d 100644 (file)
@@ -63,8 +63,6 @@
 #include "../include/can_iortl.h"
 #endif /*CAN_WITH_RTL*/
 
 #include "../include/can_iortl.h"
 #endif /*CAN_WITH_RTL*/
 
-#define EXPORT_SYMTAB
-
 can_spinlock_t canuser_manipulation_lock;
 
 /* Module parameters, some must be supplied at module loading time */
 can_spinlock_t canuser_manipulation_lock;
 
 /* Module parameters, some must be supplied at module loading time */
index 8e41ae0ddf510c214a322adbd2e154d044ce1fc8..79ae13952f9b0fb05b0c5ff25673f7126f1a9f35 100644 (file)
@@ -387,7 +387,12 @@ void sja1000_irq_read_handler(struct chip_t *chip, struct msgobj_t *obj)
                id = can_read_reg(chip, SJARXID0) | (can_read_reg(chip, SJARXID1)<<8);
                obj->rx_msg.length = len = id & 0x0f;
                obj->rx_msg.flags = id&ID0_RTR ? MSG_RTR : 0;
                id = can_read_reg(chip, SJARXID0) | (can_read_reg(chip, SJARXID1)<<8);
                obj->rx_msg.length = len = id & 0x0f;
                obj->rx_msg.flags = id&ID0_RTR ? MSG_RTR : 0;
+               #ifdef CAN_MSG_VERSION_2
+               obj->rx_msg.timestamp.tv_sec = 0;
+               obj->rx_msg.timestamp.tv_usec = 0;
+               #else /* CAN_MSG_VERSION_2 */
                obj->rx_msg.timestamp = 0;
                obj->rx_msg.timestamp = 0;
+               #endif /* CAN_MSG_VERSION_2 */
                obj->rx_msg.cob = 0;
                obj->rx_msg.id = id>>5;
 
                obj->rx_msg.cob = 0;
                obj->rx_msg.id = id>>5;
 
index 99ca2e1c0ff1a460a5170437aff09969c24d9e47..b602770f7f4054df7d615c9270aec68c5999d2e5 100644 (file)
@@ -35,8 +35,6 @@ will forward packets from CAN to the most recent IP/UDP address.
 #define DEFAULT_CAN_CLIENT_PORT 3008
 #define MAX_MSG_SIZE 4000
 
 #define DEFAULT_CAN_CLIENT_PORT 3008
 #define MAX_MSG_SIZE 4000
 
-typedef struct canmsg_t canmsg_t;
-
 extern int SendCanMsg(canmsg_t * msg);
 extern int ReceiveCanMsg(canmsg_t * msg);
 extern int ReadInput(int fd);
 extern int SendCanMsg(canmsg_t * msg);
 extern int ReceiveCanMsg(canmsg_t * msg);
 extern int ReadInput(int fd);
@@ -378,7 +376,6 @@ int ReceiveCanMsg(canmsg_t * msg) {
 
        msg->flags = 0;
        msg->cob = 0;
 
        msg->flags = 0;
        msg->cob = 0;
-       msg->timestamp = 0;
        ret = read(fdCanDev,msg, CAN_MSG_SIZE);
        if(ret == CAN_MSG_SIZE) {       
                LogMsg("RECV", fLog, msg);
        ret = read(fdCanDev,msg, CAN_MSG_SIZE);
        if(ret == CAN_MSG_SIZE) {       
                LogMsg("RECV", fLog, msg);
index 8a6d552baccddaecbdd5f8302ffe7c58f3ef56c9..ca6725702e91fee1c4ddd3c6de6a9c04aabf5759 100644 (file)
@@ -89,7 +89,11 @@ int main(int argc, char *argv[])
 
        int n,ret;
        unsigned long i=0;
 
        int n,ret;
        unsigned long i=0;
+       #ifdef CAN_MSG_VERSION_2
+       struct canmsg_t readmsg={0,0,5,{0,0},0,{0,}};
+       #else /* CAN_MSG_VERSION_2 */
        struct canmsg_t readmsg={0,0,5,0,0,{0,}};
        struct canmsg_t readmsg={0,0,5,0,0,{0,}};
+       #endif /* CAN_MSG_VERSION_2 */
        struct sigaction act;
 
 
        struct sigaction act;
 
 
@@ -151,7 +155,6 @@ int main(int argc, char *argv[])
        while (1) {
                readmsg.flags=0;
                readmsg.cob=0;
        while (1) {
                readmsg.flags=0;
                readmsg.cob=0;
-               readmsg.timestamp=0;
            #if 1
                ret=can_fd_wait(fd, can_wait_sec);
                printf("%scan_fd_wait returned %d\n", prt_prefix, ret);
            #if 1
                ret=can_fd_wait(fd, can_wait_sec);
                printf("%scan_fd_wait returned %d\n", prt_prefix, ret);
index afb0eed6d18e5b3fdefce58442e275393a538f31..8595eebb8c27a65e590c31543c7700101b67a5a3 100644 (file)
@@ -77,7 +77,11 @@ int readburst_main(void *arg)
 {
        int n,ret;
        unsigned long i=0;
 {
        int n,ret;
        unsigned long i=0;
+       #ifdef CAN_MSG_VERSION_2
+       struct canmsg_t readmsg={0,0,5,{0,0},0,{0,}};
+       #else /* CAN_MSG_VERSION_2 */
        struct canmsg_t readmsg={0,0,5,0,0,{0,}};
        struct canmsg_t readmsg={0,0,5,0,0,{0,}};
+       #endif /* CAN_MSG_VERSION_2 */
 
        if(canfilt_mask || canfilt_id || canfilt_flags){
                canfilt_fl=1;
 
        if(canfilt_mask || canfilt_id || canfilt_flags){
                canfilt_fl=1;
@@ -105,7 +109,6 @@ int readburst_main(void *arg)
        while (1) {
                readmsg.flags=0;
                readmsg.cob=0;
        while (1) {
                readmsg.flags=0;
                readmsg.cob=0;
-               readmsg.timestamp=0;
            #if 0
                ret=can_fd_wait(fd, can_wait_sec);
                printf("%scan_fd_wait returned %d\n", prt_prefix, ret);
            #if 0
                ret=can_fd_wait(fd, can_wait_sec);
                printf("%scan_fd_wait returned %d\n", prt_prefix, ret);
index 5fe75eb0cafd36f91c96b685d8fd8c91719715db..ff611e160cc8ed82ede7cf26a080124e1c78f6db 100644 (file)
@@ -10,6 +10,7 @@
 int main(void)
 {
        int i=0, fd=0, ret=0, count=0;
 int main(void)
 {
        int i=0, fd=0, ret=0, count=0;
+       int msglen;
        char loop=0;
        char ch, transmission[MAXL+1], specialfile[MAXL+1]="/dev/can0", emptystring[MAXL+1]="", buf[MAXL+1];
        char remote[MAXL+1];
        char loop=0;
        char ch, transmission[MAXL+1], specialfile[MAXL+1]="/dev/can0", emptystring[MAXL+1]="", buf[MAXL+1];
        char remote[MAXL+1];
@@ -58,7 +59,8 @@ int main(void)
                if(message.id>=(1<<11))
                  message.flags |= MSG_EXT;
                printf("Enter the Message Length ");
                if(message.id>=(1<<11))
                  message.flags |= MSG_EXT;
                printf("Enter the Message Length ");
-               scanf("%d",&message.length);
+               scanf("%d",&msglen);
+               message.length=msglen;
                for (i=0; i<message.length; i++) {
                        printf("Enter data byte [%d] ",i);
                        scanf("%x",(int *)&message.data[i]);
                for (i=0; i<message.length; i++) {
                        printf("Enter data byte [%d] ",i);
                        scanf("%x",(int *)&message.data[i]);
@@ -109,7 +111,12 @@ int main(void)
                                printf("Id      : %lx\n",message.id);
                                printf("length  : %d\n",message.length);
                                printf("flags   : 0x%02x\n", message.flags);
                                printf("Id      : %lx\n",message.id);
                                printf("length  : %d\n",message.length);
                                printf("flags   : 0x%02x\n", message.flags);
+                               #ifdef CAN_MSG_VERSION_2
+                               printf("time    : %lds %ldusec\n", message.timestamp.tv_sec,
+                                       message.timestamp.tv_usec);
+                               #else /* CAN_MSG_VERSION_2 */
                                printf("time    : %ld\n", message.timestamp);
                                printf("time    : %ld\n", message.timestamp);
+                               #endif /* CAN_MSG_VERSION_2 */
                                for (i=0; i<message.length; i++)
                                        printf("data%d  : %02x\n",i,
                                                        message.data[i]);
                                for (i=0; i<message.length; i++)
                                        printf("data%d  : %02x\n",i,
                                                        message.data[i]);
index 53135dba486f3ad06000055cba769371b69835e0..9f2dca7636d514e0ba79deaaeb790b009834a5f3 100644 (file)
@@ -11,6 +11,7 @@ int main(void)
 {
        int i=0, fd=0, ret=0;
        unsigned long bits;
 {
        int i=0, fd=0, ret=0;
        unsigned long bits;
+       int msglen;
        char specialfile[MAXL+1]="/dev/can0", buf[MAXL+1];
        struct canmsg_t message;
 
        char specialfile[MAXL+1]="/dev/can0", buf[MAXL+1];
        struct canmsg_t message;
 
@@ -31,7 +32,8 @@ int main(void)
        printf("Enter the starting Message ID ");
        scanf("%lx",&message.id);
        printf("Enter the Message Length ");
        printf("Enter the starting Message ID ");
        scanf("%lx",&message.id);
        printf("Enter the Message Length ");
-       scanf("%d",&message.length);
+       scanf("%d",&msglen);
+       message.length=msglen;
        for (i=0; i<message.length; i++) {
                printf("Enter data byte [%d] ",i);
                scanf("%x",(int *)&message.data[i]);
        for (i=0; i<message.length; i++) {
                printf("Enter data byte [%d] ",i);
                scanf("%x",(int *)&message.data[i]);
index 4d715d12ca373414bd874fd7954b0aedc120776e..2890813236cdff5537d8f1cc12cde480ad32c106 100644 (file)
@@ -57,7 +57,11 @@ int main(int argc, char *argv[])
        };
        int opt;
 
        };
        int opt;
 
+       #ifdef CAN_MSG_VERSION_2
+       struct canmsg_t sendmsg={0,0,5,{0,0},8,{1,2,3,4,5,6,7,8}};
+       #else /* CAN_MSG_VERSION_2 */
        struct canmsg_t sendmsg={0,0,5,0,8,{1,2,3,4,5,6,7,8}};
        struct canmsg_t sendmsg={0,0,5,0,8,{1,2,3,4,5,6,7,8}};
+       #endif /* CAN_MSG_VERSION_2 */
        int fd, ret,i,j;
 
        while ((opt = getopt_long(argc, argv, "d:i:f:sw:b:c:p:Vh",
        int fd, ret,i,j;
 
        while ((opt = getopt_long(argc, argv, "d:i:f:sw:b:c:p:Vh",
index 94a3e0480a79a61fe8c2dc267e874d178f1d6716..44ba8bcecb61d779c44ac59ae3d5bcc58393c04c 100644 (file)
@@ -54,7 +54,11 @@ void sendburst_cleanup(void *arg)
 
 int sendburst_main(void *arg)
 {
 
 int sendburst_main(void *arg)
 {
+       #ifdef CAN_MSG_VERSION_2
+       struct canmsg_t sendmsg={0,0,5,{0,0},8,{1,2,3,4,5,6,7,8}};
+       #else /* CAN_MSG_VERSION_2 */
        struct canmsg_t sendmsg={0,0,5,0,8,{1,2,3,4,5,6,7,8}};
        struct canmsg_t sendmsg={0,0,5,0,8,{1,2,3,4,5,6,7,8}};
+       #endif /* CAN_MSG_VERSION_2 */
        int fd, ret,i,j;
 
 
        int fd, ret,i,j;