Initial support of rudimentary candump output format
This commit is contained in:
		
							parent
							
								
									f1388e93bd
								
							
						
					
					
						commit
						8c0af77ba9
					
				
					 2 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -74,10 +74,16 @@ int hexagram_main_can2dump(int argc, char **argv) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    while (hexagram_capture_read(capture, ×tamp, &frame) >= 0) {
 | 
			
		||||
        fprintf(fh, "%s 0x%x %02x %02x %02x %02x %02x %02x %02x %02x\n",
 | 
			
		||||
            ifname, frame.can_id,
 | 
			
		||||
            frame.data[0], frame.data[1], frame.data[2], frame.data[3],
 | 
			
		||||
            frame.data[4], frame.data[5], frame.data[6], frame.data[7]);
 | 
			
		||||
        uint8_t i;
 | 
			
		||||
 | 
			
		||||
        fprintf(fh, "%7s  %03X   [%d] ",
 | 
			
		||||
            ifname, frame.can_id, frame.can_dlc);
 | 
			
		||||
 | 
			
		||||
        for (i=0; i<frame.can_dlc; i++) {
 | 
			
		||||
            fprintf(fh, " %02X", frame.data[i]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        fprintf(fh, "\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (argc == 2) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@
 | 
			
		|||
 | 
			
		||||
#include "capture.h"
 | 
			
		||||
#include "replay.h"
 | 
			
		||||
#include "can2dump.h"
 | 
			
		||||
#include "pcap2can.h"
 | 
			
		||||
#include "pcapreplay.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,7 @@ typedef struct {
 | 
			
		|||
hexagram_app apps[] = {
 | 
			
		||||
    { "capture",    hexagram_arglist_capture,    hexagram_main_capture    },
 | 
			
		||||
    { "replay",     hexagram_arglist_replay,     hexagram_main_replay     },
 | 
			
		||||
    { "can2dump",   hexagram_arglist_can2dump,   hexagram_main_can2dump   },
 | 
			
		||||
    { "pcap2can",   hexagram_arglist_pcap2can,   hexagram_main_pcap2can   },
 | 
			
		||||
    { "pcapreplay", hexagram_arglist_pcapreplay, hexagram_main_pcapreplay },
 | 
			
		||||
    { NULL, NULL, NULL }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue