ioctl problem with serial port

When I open two serial ports and then do an ioctl() to obtain the current
modem line states, the state of the one port affects the other port.

I have a modem plugged in on one of the two ports on my desktop machine and
when I turn the modem on and off, the code sample below reports identical
state for both the ports.

Thanks for your help,
Larry

=============================================
uname -a
QNX gf-qnx 6.1.0 2001/06/25-15:31:48edt x86pc x86

using: devc-ser8250

#include <stdio.h>
#include <sys/modem.h>
#include <sys/ioctl.h>

int main(int argc, char** argv )
{
int id1 = modem_open("/dev/ser1", 9600);
int id2 = modem_open("/dev/ser2", 9600);

while (true)
{
int status1, status2;
ioctl(id1, TIOCMGET, &status1);
printf("%04x %02d “, status1, id1);
ioctl(id2, TIOCMGET, &status2);
printf(”%04x %02d ", status2, id2);
}

return 0;
}

“Larry Holding” <larryh@ansys.co.za> wrote in message
news:9qf3pt$mmo$1@inn.qnx.com

When I open two serial ports and then do an ioctl() to obtain the current
modem line states, the state of the one port affects the other port.

I have a modem plugged in on one of the two ports on my desktop machine
and
when I turn the modem on and off, the code sample below reports identical
state for both the ports.

Perhaps I am mis-understanding your question, but if you toggle a modem on
and off, how is that affecting the other port?

-Adam

When I open two serial ports and then do an ioctl() to obtain the
current
modem line states, the state of the one port affects the other port.

I have a modem plugged in on one of the two ports on my desktop machine
and
when I turn the modem on and off, the code sample below reports
identical
state for both the ports.

Perhaps I am mis-understanding your question, but if you toggle a modem on
and off, how is that affecting the other port?

If I turn the modem on one of the ports off, then all the input lines on
both the ports get reported as being off. Even though the signals on the
other port are still raised. Both ports report the line statuses for the
port that changed most recently.

When running the program below and ignoring repeated values I get:

Port1 | Port2
0003 | 0003

  • then turn the modem on port 1 on
    9003 | 9003
  • wait about 10s (no change on the lines)
    0003 | 0003
  • now raise CD on port2
    8003 | 8003
  • wait about 10s (no change on the lines)
    0003 | 0003

Thanks
Larry

\

uname -a
QNX gf-qnx 6.1.0 2001/06/25-15:31:48edt x86pc x86

using: devc-ser8250

#include <stdio.h>
#include <sys/modem.h>
#include <sys/ioctl.h>

int main(int argc, char** argv )
{
int id1 = modem_open("/dev/ser1", 9600);
int id2 = modem_open("/dev/ser2", 9600);

while (true)
{
int status1, status2;
ioctl(id1, TIOCMGET, &status1);
printf("%04x %02d “, status1, id1);
ioctl(id2, TIOCMGET, &status2);
printf(”%04x %02d ", status2, id2);
}

return 0;
}

Operating System Tech Support <os@qnx.com> wrote in message
news:9qi1rj$7q$1@nntp.qnx.com

“Larry Holding” <> larryh@ansys.co.za> > wrote in message
news:9qh0vl$s8g$> 1@inn.qnx.com> …
If I turn the modem on one of the ports off, then all the input lines
on
both the ports get reported as being off. Even though the signals on the
other port are still raised. Both ports report the line statuses for the
port that changed most recently.

Even stranger, if I connect a serial device only on serial #2, serial #1
will display the status changes, but not serial #2 proper.

I’ve posted this as a bug, to be fixed in a future release.

Thanks, but do you have any suggestions on how I can work around this
problem? I do need to use the ports.

Larry

“Larry Holding” <larryh@ansys.co.za> wrote in message
news:9qh0vl$s8g$1@inn.qnx.com

If I turn the modem on one of the ports off, then all the input lines on
both the ports get reported as being off. Even though the signals on the
other port are still raised. Both ports report the line statuses for the
port that changed most recently.

Even stranger, if I connect a serial device only on serial #2, serial #1
will display the status changes, but not serial #2 proper.

I’ve posted this as a bug, to be fixed in a future release.

-Adam