Getting qtalk to work

I have a dual boot machine (QNX 6.2.0 and Windows XP). It’s connected
to a UPS via a straight through serial port. The serial port is used
for diagnostics and configuration. I can talk to the the UPS
successfully from Windows using HyperTerminal on COM2: (1200 N-8-1
XON/XOFF). However, the following qtalk command doesn’t work:

qtalk -m /dev/ser2 -b 1200,n,8,1

To me, this looks like the equivalent command. What am I missing?

…Stephen

Stephen Rasku <spr@shaw.ca> wrote:

I have a dual boot machine (QNX 6.2.0 and Windows XP). It’s connected
to a UPS via a straight through serial port. The serial port is used
for diagnostics and configuration. I can talk to the the UPS
successfully from Windows using HyperTerminal on COM2: (1200 N-8-1
XON/XOFF). However, the following qtalk command doesn’t work:

qtalk -m /dev/ser2 -b 1200,n,8,1

To me, this looks like the equivalent command. What am I missing?

By default the serial driver isn’t using software flow control, which
is the XON/XOFF setting under Windows. You can enable it using stty…

stty -ohflow -ihflow +osflow +isflow < /dev/ser2

…or by restarting devc-ser8250 with the option to enable software flow
control.

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

In article <c21b36$cgq$1@nntp.qnx.com>, Chris McKillop wrote:

By default the serial driver isn’t using software flow control, which
is the XON/XOFF setting under Windows. You can enable it using stty…

stty -ohflow -ihflow +osflow +isflow < /dev/ser2

The stty command worked. Thanks.

The UPS will display a menu when I send it a carriage return over the
serial port. This works fine from within qtalk but now I am trying to
write a program that will send commands and parse output from the serial
port. The write in the following program appears to work (doesn’t
return an error) but the subsequent read never gets any characters.

#include <stdio.h>
#include <fcntl.h>
#include <termios.h>

void dump(unsigned char *buffer, int bufferLen);

int main(int argc, char *argv[])
{
int fd;

if ( (fd = open("/dev/ser2", O_RDWR) ) >= 0)
{
int iReadLen;
char aBuf[255];
do {
if (1 != write(fd, “\n”, 1) )
{
fprintf(stderr, “Write failed\n”);
break;
}
fprintf(stderr, “.”);

} while (0 == (iReadLen = read(fd, aBuf, sizeof(aBuf) ) ) );
fprintf(stderr, “iReadLen = %d\n”, iReadLen);
fprintf(stderr, “%s\n”, aBuf);
(void)close(fd);
}
return(0);
}

“Stephen Rasku” <spr@shaw.ca> wrote in message
news:slrnc4c9d6.1ao.spr@samantha.armispiansystems.ca

In article <c21b36$cgq$> 1@nntp.qnx.com> >, Chris McKillop wrote:

By default the serial driver isn’t using software flow control, which
is the XON/XOFF setting under Windows. You can enable it using stty…

stty -ohflow -ihflow +osflow +isflow < /dev/ser2


The stty command worked. Thanks.

The UPS will display a menu when I send it a carriage return over the
serial port. This works fine from within qtalk but now I am trying to
write a program that will send commands and parse output from the serial
port. The write in the following program appears to work (doesn’t
return an error) but the subsequent read never gets any characters.

If the baud rate/parity etc aren’t set properly the write will work but read
won’t because serial port won’t “understand” incomming data.

#include <stdio.h
#include <fcntl.h
#include <termios.h

void dump(unsigned char *buffer, int bufferLen);

int main(int argc, char *argv[])
{
int fd;

if ( (fd = open("/dev/ser2", O_RDWR) ) >= 0)
{
int iReadLen;
char aBuf[255];
do {
if (1 != write(fd, “\n”, 1) )
{
fprintf(stderr, “Write failed\n”);
break;
}
fprintf(stderr, “.”);

} while (0 == (iReadLen = read(fd, aBuf, sizeof(aBuf) ) ) );
fprintf(stderr, “iReadLen = %d\n”, iReadLen);
fprintf(stderr, “%s\n”, aBuf);
(void)close(fd);
}
return(0);
}

I’m not sure a \n is a carriage return. Try \r.


Marty Doane
Siemens Dematic

“Stephen Rasku” <spr@shaw.ca> wrote in message
news:slrnc4c9d6.1ao.spr@samantha.armispiansystems.ca

In article <c21b36$cgq$> 1@nntp.qnx.com> >, Chris McKillop wrote:

By default the serial driver isn’t using software flow control, which
is the XON/XOFF setting under Windows. You can enable it using stty…

stty -ohflow -ihflow +osflow +isflow < /dev/ser2


The stty command worked. Thanks.

The UPS will display a menu when I send it a carriage return over the
serial port. This works fine from within qtalk but now I am trying to
write a program that will send commands and parse output from the serial
port. The write in the following program appears to work (doesn’t
return an error) but the subsequent read never gets any characters.

#include <stdio.h
#include <fcntl.h
#include <termios.h

void dump(unsigned char *buffer, int bufferLen);

int main(int argc, char *argv[])
{
int fd;

if ( (fd = open("/dev/ser2", O_RDWR) ) >= 0)
{
int iReadLen;
char aBuf[255];
do {
if (1 != write(fd, “\n”, 1) )
{
fprintf(stderr, “Write failed\n”);
break;
}
fprintf(stderr, “.”);

} while (0 == (iReadLen = read(fd, aBuf, sizeof(aBuf) ) ) );
fprintf(stderr, “iReadLen = %d\n”, iReadLen);
fprintf(stderr, “%s\n”, aBuf);
(void)close(fd);
}
return(0);
}

In article <c27mfr$lnv$1@inn.qnx.com>, Marty Doane wrote:

I’m not sure a \n is a carriage return. Try \r.

Actually, this was the problem. I had to use “\r\n”.

…Stephen