cansniffer: add new interactive commands to enable/disable SFF/EFF frames

With the new commands

a<ENTER>        - enable 'a'll SFF CAN-IDs to sniff
n<ENTER>        - enable 'n'one SFF CAN-IDs to sniff
A<ENTER>        - enable 'A'll EFF CAN-IDs to sniff
N<ENTER>        - 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 <socketcan@hartkopp.net>
pull/200/head
Oliver Hartkopp 2020-04-28 07:21:52 +02:00
parent adf29573f4
commit 64e33bf9ad
1 changed files with 28 additions and 0 deletions

View File

@ -171,6 +171,10 @@ void print_usage(char *prg)
" *<ENTER> - clear notched marked\n"
" rMYNAME<ENTER> - read settings file (filter/notch)\n"
" wMYNAME<ENTER> - write settings file (filter/notch)\n"
" a<ENTER> - enable 'a'll SFF CAN-IDs to sniff\n"
" n<ENTER> - enable 'n'one SFF CAN-IDs to sniff\n"
" A<ENTER> - enable 'A'll EFF CAN-IDs to sniff\n"
" N<ENTER> - enable 'N'one EFF CAN-IDs to sniff\n"
" +FILTER<ENTER> - add CAN-IDs to sniff\n"
" -FILTER<ENTER> - 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;