Accessing device specific configuration


I’m trying to configure a MOXA CP-104JU multiport serial board.
The devc-ser8250 driver from QNX works OK with it, but to configure the serial ports as RS-485, 2 wires, you need to access device specific I/O.

I have a Linux source example where to configure the operation mode it uses the following instructions:

[code]#define MOXA_GET_OP_MODE (0x400+67)

int mxsp_get_interface(unsigned int fd) {
int mode;

return ioctl(fd, MOXA_GET_OP_MODE, &mode)==0? mode:-1;


In QNX the ioctl call is different. How can I set the operation mode in QNX, in a similar way as the Linux code.

Thank you in advance.


I don’t know if the serial driver supports this, however it should be fairly easy to get the source and check, and modify it if necessary.

I have a previous version of the code tbat was working for QNX 6.3. In this code the ioctl() function is used to configure the serial interface of a MOXA multiport serial board.

With QNX 6.5 this code is not working to configure the serial interfaces.

Is the behavior of the ioctl() function chenged from 6.3 to 6.5?
How can I reproduce the same behavior as in 6.3 version?

Below you can see the key part of the code:

[code]#define SET_OP_MODE 0x466
#define GET_OP_MODE 0x467

// Open the device node
fd = open(argv[1], O_RDWR);
if ( fd < 0 ) {
printf(“Open device node %s fail !\n”, argv[1]);

if ( argc <= 2 ) {
ioctl(fd, GET_OP_MODE, &interface);
switch ( interface ) {
case RS232_MODE :
printf(“Now setting is RS232 interface.\n”);
case RS485_2WIRE_MODE :
printf(“Now setting is RS485-2WIRES interface.\n”);
case RS422_MODE :
printf(“Now setting is RS422 interface.\n”);
case RS485_4WIRE_MODE :
printf(“Now setting is RS485-4WIRES interface.\n”);
printf(“Now does not set to any type interface.\n”);
default :
printf(“Unknow interface is set.\n”);

sscanf(argv[2], “%d”, &interface);
if ( interface != RS232_MODE &&
interface != RS485_2WIRE_MODE &&
interface != RS422_MODE &&
interface != RS485_4WIRE_MODE ) {
printf(“Error interface.\n”);
goto usage;

ioctl(fd, SET_OP_MODE, &interface);

I forgot to say that when ioctl() functions fails and taking the value returned by the ioctl() call it gives -1, and getting the errno value gives the error number 25 (“Inappropriate I/O control operation”).

In the Library Reference for QNX Neutrino 6.5.0, in the information for ioctl() this error corresponds to ENOTTY, which means:

“The fd argument isn’t associated with a character-special device; the specified request doesn’t apply to the kind of object that the descriptor fd references”.

As mentioned previously, it seems like the ioctl() behavior has changed in QNX 6.5.0.