]> rtime.felk.cvut.cz Git - can-utils.git/blobdiff - asc2log.c
candump: Enable HW timestamping before using it
[can-utils.git] / asc2log.c
index 32838f96161ad244ae32d8f69a3939829a6bbbbb..ae78a41fbca8cbbb3b39f4aae7f5b9019f87de29 100644 (file)
--- a/asc2log.c
+++ b/asc2log.c
@@ -1,7 +1,3 @@
-/*
- *  $Id$
- */
-
 /*
  * asc2log.c - convert ASC logfile to compact CAN frame 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>
  *
  */
 
@@ -73,11 +69,14 @@ void print_usage(char *prg)
 void prframe(FILE *file, struct timeval *tv, int dev, struct can_frame *cf) {
 
        fprintf(file, "(%ld.%06ld) ", tv->tv_sec, tv->tv_usec);
+
        if (dev > 0)
                fprintf(file, "can%d ", dev-1);
        else
                fprintf(file, "canX ");
-       fprint_canframe(file, cf, "\n", 0);
+
+       /* no CAN FD support so far */
+       fprint_canframe(file, (struct canfd_frame *)cf, "\n", 0, CAN_MAX_DLEN);
 }
 
 void get_can_id(struct can_frame *cf, char *idstring, int base) {
@@ -133,8 +132,10 @@ int get_date(struct timeval *tv, char *date) {
        if (sscanf(date, "%9s %d %9s %9s %d", ctmp, &itmp, ctmp, ctmp, &itmp) == 5) {
                /* assume EN/US date due to existing am/pm field */
 
-               if (!setlocale(LC_TIME, "en_US"))
+               if (!setlocale(LC_TIME, "en_US")) {
+                       fprintf(stderr, "Setting locale to 'en_US' failed!\n");
                        return 1;
+               }
 
                if (!strptime(date, "%B %d %r %Y", &tms))
                        return 1;
@@ -145,8 +146,10 @@ int get_date(struct timeval *tv, char *date) {
                if (sscanf(date, "%9s %d %9s %d", ctmp, &itmp, ctmp, &itmp) != 4)
                        return 1;
 
-               if (!setlocale(LC_TIME, "de_DE"))
+               if (!setlocale(LC_TIME, "de_DE")) {
+                       fprintf(stderr, "Setting locale to 'de_DE' failed!\n");
                        return 1;
+               }
 
                if (!strptime(date, "%B %d %T %Y", &tms))
                        return 1;
@@ -340,5 +343,6 @@ int main(int argc, char **argv)
                }
        }
        fclose(outfile);
+       fclose(infile);
        return 0;
 }