From 64e33bf9adf6c9087327a6e153eed9687723c3c9 Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Tue, 28 Apr 2020 07:21:52 +0200 Subject: [PATCH] cansniffer: add new interactive commands to enable/disable SFF/EFF frames With the new commands a - enable 'a'll SFF CAN-IDs to sniff n - enable 'n'one SFF CAN-IDs to sniff A - enable 'A'll EFF CAN-IDs to sniff N - enable 'N'one EFF CAN-IDs to sniff the EFF/SFF frames can be added/removed with a single command. Of course this could be done with the '+' and '-' filters too. But 'N' is much easier to type then '-0000000000000000' ... Signed-off-by: Oliver Hartkopp --- cansniffer.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cansniffer.c b/cansniffer.c index d65b6ec..f6206c0 100644 --- a/cansniffer.c +++ b/cansniffer.c @@ -171,6 +171,10 @@ void print_usage(char *prg) " * - clear notched marked\n" " rMYNAME - read settings file (filter/notch)\n" " wMYNAME - write settings file (filter/notch)\n" + " a - enable 'a'll SFF CAN-IDs to sniff\n" + " n - enable 'n'one SFF CAN-IDs to sniff\n" + " A - enable 'A'll EFF CAN-IDs to sniff\n" + " N - enable 'N'one EFF CAN-IDs to sniff\n" " +FILTER - add CAN-IDs to sniff\n" " -FILTER - remove CAN-IDs to sniff\n" "\n" @@ -448,6 +452,30 @@ int handle_keyb(int fd){ break; + case 'a' : /* all SFF CAN IDs */ + value = 0; + mask = 0xFFFF800; /* cleared flags! */ + do_modify_sniftab(value, mask, '+'); + break; + + case 'n' : /* none SFF CAN IDs */ + value = 0; + mask = 0xFFFF800; /* cleared flags! */ + do_modify_sniftab(value, mask, '-'); + break; + + case 'A' : /* all EFF CAN IDs */ + value = CAN_EFF_FLAG; + mask = CAN_EFF_FLAG; + do_modify_sniftab(value, mask, '+'); + break; + + case 'N' : /* none EFF CAN IDs */ + value = CAN_EFF_FLAG; + mask = CAN_EFF_FLAG; + do_modify_sniftab(value, mask, '-'); + break; + case 'w' : writesettings(&cmd[1]); break;