CAN_DEVCTL_GET_MID
QNX SDP8.0Devctl and Ioctl CommandsDeveloper
Get a message ID
Synopsis:
#include <sys/can_dcmd.h>
#define CAN_DEVCTL_GET_MID   __DIOF(_DCMD_MISC, CAN_CMD_CODE + 0, uint32_t)
Arguments to devctl():
| 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_GET_MID | 
| dev_data_ptr | A pointer to a uint32_t | 
| n_bytes | sizeof(uint32_t) | 
| dev_info_ptr | NULL | 
Description:
This command gets the message ID for the mailbox associated with the file descriptor.
Input:
None.
Output:
The message ID. The form depends on whether or not the driver is using extended MIDs:
- In standard 11-bit MIDs, bits 18–28 define the MID.
 - In extended 29-bit MIDs, bits 0–28 define the MID.
 
Example:
int      ret;
uint32_t val;
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_MID, &val, sizeof(val), NULL)))
{
    fprintf(stderr, "devctl CAN_DEVCTL_GET_MID: %s\n", strerror(ret));
} else {
    printf("GET_MID = 0x%X\n", val);
}
See also:
devctl() in the QNX OS C Library Reference
canctl in the Utilities Reference
Page updated: 
