Get the current message filter
#include <sys/can_dcmd.h> #define CAN_DEVCTL_GET_MFILTER __DIOF(_DCMD_MISC, CAN_CMD_CODE + 2, uint32_t)
| Argument | Value |
|---|---|
| filedes | A file descriptor that you obtained by opening the device. This must be for a receive mailbox (e.g., /dev/can1/rx2). |
| dcmd | CAN_DEVCTL_GET_MFILTER |
| dev_data_ptr | A pointer to a uint32_t |
| n_bytes | sizeof(uint32_t) |
| dev_info_ptr | NULL |
This command gets the current message filter, which is a mask that specifies which bits in the message IDs to ignore. The default mask is 0x0, so no bits are ignored.
None.
The message filter.
int ret;
uint32_t val = 0;
if( (fd = open( "/dev/can1/rx2", O_RDWR)) == -1 )
{
printf("open of %s failed \n", devname);
exit(EXIT_FAILURE);
}
if (EOK != (ret = devctl(fd, CAN_DEVCTL_GET_MFILTER, &val, sizeof(val), NULL)))
{
fprintf(stderr, "devctl CAN_DEVCTL_GET_MFILTER: %s\n", strerror(ret));
} else {
printf("MFILTER = 0x%X\n", val);
}