]> rtime.felk.cvut.cz Git - can-utils.git/blobdiff - log2asc.c
can-calc-bit-timing: add support for rcar_can
[can-utils.git] / log2asc.c
index 6a10f50c942757e35ac160f25543459e5c55e96c..8fb88a9bb5f3e1aedc9d3ec7b82cb06e02c0a153 100644 (file)
--- a/log2asc.c
+++ b/log2asc.c
@@ -1,7 +1,3 @@
-/*
- *  $Id$
- */
-
 /*
  * log2asc.c - convert compact CAN frame logfile to ASC logfile
  *
@@ -41,7 +37,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
+ * Send feedback to <linux-can@vger.kernel.org>
  *
  */
 
@@ -52,6 +48,7 @@
 #include <unistd.h>
 
 #include <net/if.h>
+#include <sys/time.h>
 #include <linux/can.h>
 
 #include "lib.h"
@@ -73,7 +70,7 @@ int main(int argc, char **argv)
 {
        static char buf[BUFSZ], device[BUFSZ], ascframe[BUFSZ], id[10];
 
-       struct can_frame cf;
+       struct canfd_frame cf;
        static struct timeval tv, start_tv;
        FILE *infile = stdin;
        FILE *outfile = stdout;
@@ -162,7 +159,7 @@ int main(int argc, char **argv)
                }
 
                if (devno) { /* only convert for selected CAN devices */
-                       if (parse_canframe(ascframe, &cf))
+                       if (parse_canframe(ascframe, &cf) != CAN_MTU) /* no CAN FD support so far */
                                return 1;
 
                        tv.tv_sec  = tv.tv_sec - start_tv.tv_sec;
@@ -189,9 +186,9 @@ int main(int argc, char **argv)
                                if (cf.can_id & CAN_RTR_FLAG)
                                        fprintf(outfile, "r"); /* RTR frame */
                                else {
-                                       fprintf(outfile, "d %d", cf.can_dlc); /* data frame */
+                                       fprintf(outfile, "d %d", cf.len); /* data frame */
                    
-                                       for (i = 0; i < cf.can_dlc; i++) {
+                                       for (i = 0; i < cf.len; i++) {
                                                fprintf(outfile, " %02X", cf.data[i]);
                                        }
                                }
@@ -202,6 +199,8 @@ int main(int argc, char **argv)
                }
        }
        fflush(outfile);
+       fclose(outfile);
+       fclose(infile);
 
        return 0;
 }