mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-20 23:12:09 +02:00
Added -f option to filter only on the CAN-ID and not on the content.
This can be useful when the timestamp cyle needs to be displayed.
This commit is contained in:
+13
-6
@@ -118,13 +118,14 @@ extern int optind, opterr, optopt;
|
|||||||
|
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
static int clearscreen = 1;
|
static int clearscreen = 1;
|
||||||
static int notch = 0;
|
static int notch;
|
||||||
|
static int filter_id_only;
|
||||||
static long timeout = TIMEOUT;
|
static long timeout = TIMEOUT;
|
||||||
static long hold = HOLD;
|
static long hold = HOLD;
|
||||||
static long loop = LOOP;
|
static long loop = LOOP;
|
||||||
static unsigned char binary = 0;
|
static unsigned char binary;
|
||||||
static unsigned char binary_gap = 0;
|
static unsigned char binary_gap;
|
||||||
static unsigned char color = 0;
|
static unsigned char color;
|
||||||
|
|
||||||
void rx_setup (int fd, int id);
|
void rx_setup (int fd, int id);
|
||||||
void rx_delete (int fd, int id);
|
void rx_delete (int fd, int id);
|
||||||
@@ -195,7 +196,6 @@ int main(int argc, char **argv)
|
|||||||
long currcms = 0;
|
long currcms = 0;
|
||||||
long lastcms = 0;
|
long lastcms = 0;
|
||||||
unsigned char quiet = 0;
|
unsigned char quiet = 0;
|
||||||
|
|
||||||
int opt, ret;
|
int opt, ret;
|
||||||
struct timeval timeo, start_tv, tv;
|
struct timeval timeo, start_tv, tv;
|
||||||
struct sockaddr_can addr;
|
struct sockaddr_can addr;
|
||||||
@@ -210,7 +210,7 @@ int main(int argc, char **argv)
|
|||||||
for (i=0; i < 2048 ;i++) /* default: check all CAN-IDs */
|
for (i=0; i < 2048 ;i++) /* default: check all CAN-IDs */
|
||||||
do_set(i, ENABLE);
|
do_set(i, ENABLE);
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "m:v:r:t:h:l:qbBc")) != -1) {
|
while ((opt = getopt(argc, argv, "m:v:r:t:h:l:qbBcf")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'm':
|
case 'm':
|
||||||
sscanf(optarg, "%x", &mask);
|
sscanf(optarg, "%x", &mask);
|
||||||
@@ -254,6 +254,10 @@ int main(int argc, char **argv)
|
|||||||
color = 1;
|
color = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
filter_id_only = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -371,6 +375,9 @@ void rx_setup (int fd, int id){
|
|||||||
txmsg.msg_head.nframes = 1;
|
txmsg.msg_head.nframes = 1;
|
||||||
U64_DATA(&txmsg.frame) = (__u64) 0xFFFFFFFFFFFFFFFFULL;
|
U64_DATA(&txmsg.frame) = (__u64) 0xFFFFFFFFFFFFFFFFULL;
|
||||||
|
|
||||||
|
if (filter_id_only)
|
||||||
|
txmsg.msg_head.flags |= RX_FILTER_ID;
|
||||||
|
|
||||||
if (write(fd, &txmsg, sizeof(txmsg)) < 0)
|
if (write(fd, &txmsg, sizeof(txmsg)) < 0)
|
||||||
perror("write");
|
perror("write");
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user