diff --git a/cansniffer.c b/cansniffer.c index e599f57..9b60424 100644 --- a/cansniffer.c +++ b/cansniffer.c @@ -69,9 +69,16 @@ #include "terminal.h" #define SETFNAME "sniffset." +#define SETFDFNAME "sniffset_fd." +#define FNAME_MAX_LEN 40 + #define ANYDEV "any" #define MAX_SLOTS 2048 +#define CANFD_OFF 0 /* set to OFF */ +#define CANFD_ON 1 /* set to ON */ +#define CANFD_AUTO 2 /* unspecified => check for first received frame */ + /* flags */ #define ENABLE 1 /* by filter or user */ @@ -98,6 +105,9 @@ #define LDL " | " /* long delimiter */ #define SDL "|" /* short delimiter for binary on 80 chars terminal */ +#define CC_SEP '#' /* interface name separator for Classical CAN */ +#define FD_SEP '*' /* interface name separator for CAN FD */ + static struct snif { int flags; long hold; @@ -121,10 +131,12 @@ static int max_dlen = CAN_MAX_DLEN; static long timeout = TIMEOUT; static long hold = HOLD; static long loop = LOOP; +static long canfd_mode = CANFD_AUTO; static unsigned char binary; static unsigned char binary8; static unsigned char binary_gap; static unsigned char color; +static unsigned char name_sep = CC_SEP; static char *interface; static char *vdl = LDL; /* variable delimiter */ static char *ldl = LDL; /* long delimiter */ @@ -216,6 +228,7 @@ void print_usage(char *prg) fprintf(stderr, " -8 (start with binary mode - for EFF on 80 chars)\n"); fprintf(stderr, " -B (start with binary mode with gap - exceeds 80 chars!)\n"); fprintf(stderr, " -c (color changes)\n"); + fprintf(stderr, " -f (CAN FD mode: 0 = OFF, 1 = ON, 2 = auto detect, default: %d)\n", CANFD_AUTO); fprintf(stderr, " -t