Set the message ID
#include <sys/can_dcmd.h> #define CAN_DEVCTL_SET_MID __DIOT(_DCMD_MISC, CAN_CMD_CODE + 1, uint32_t)
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device. This must be for a transmit or receive mailbox (e.g., /dev/can1/rx2). |
dcmd | CAN_DEVCTL_SET_MID |
dev_data_ptr | A pointer to a uint32_t |
n_bytes | sizeof(uint32_t) |
dev_info_ptr | NULL |
This command sets the message ID for the mailbox associated with the file descriptor.
The message ID. The form depends on whether or not the driver is using extended MIDs:
None.
int ret; uint32_t val; if( (fd = open( "/dev/can1/rx2", O_RDWR)) == -1 ) { printf("open of %s failed \n", devname); exit(EXIT_FAILURE); } /* Set the new message ID. */ val = strtoul(optarg, NULL, 16); if(EOK != (ret = devctl(fd, CAN_DEVCTL_SET_MID, &val, sizeof(val), NULL))) { fprintf(stderr, "devctl CAN_DEVCTL_SET_MID: %s\n", strerror(ret)); }
CAN_DEVCTL_GET_MID, CAN_DEVCTL_SET_MFILTER
devctl() in the QNX Neutrino C Library Reference
canctl in the Utilities Reference