Need help w/serial communication under interactive unix

Need help w/serial communication under interactive unix

Post by Morten Knudse » Fri, 15 Mar 1996 04:00:00



I'm trying to do serial communication between a computer running dos and
one running Interactive Unix. The problem is that I can't find out how
to enable RTS/CTS (hardware) handshaking for the port.

This is the initialization code i use:

int com_init(void)
{
  struct termio tio;
  int rc;
  int com; /* Serial port file descriptor */
  com = open("/dev/ttyd0", O_RDWR);
  rc = ioctl(com, TCGETA, &tio);
  if (rc == -1)
    return 0;
  tio.c_cflag = B9600 | CREAD | CS8;
  tio.c_iflag = 0;
  tio.c_oflag = 0;
  tio.c_lflag = 0;
  tio.c_line = 0;
  rc = ioctl(com, TCSETA, &tio);
  if (rc == -1)
      return 0;
  tcflush(com, TCIOFLUSH);
  return com;

Quote:}

I first wrote this code for linux. Linux had a CRTSCTS flag which I
could set in tio.c_cflag to enable hardware handshaking. Unfortuately I
am forced to run the application under Interactive Unix.

Any help is appreciated.

Morten.

 
 
 

Need help w/serial communication under interactive unix

Post by K Goldm » Tue, 19 Mar 1996 04:00:00


|> I'm trying to do serial communication between a computer running dos and
|> one running Interactive Unix. The problem is that I can't find out how
|> to enable RTS/CTS (hardware) handshaking for the port.
|>
|> This is the initialization code i use:
|>
|> int com_init(void)
|> {
|>   struct termio tio;
|>   int rc;
|>   int com; /* Serial port file descriptor */
|>   com = open("/dev/ttyd0", O_RDWR);
|>   rc = ioctl(com, TCGETA, &tio);
|>   if (rc == -1)
|>     return 0;
|>   tio.c_cflag = B9600 | CREAD | CS8;
|>   tio.c_iflag = 0;
|>   tio.c_oflag = 0;
|>   tio.c_lflag = 0;
|>   tio.c_line = 0;
|>   rc = ioctl(com, TCSETA, &tio);
|>   if (rc == -1)
|>       return 0;
|>   tcflush(com, TCIOFLUSH);
|>   return com;
|> }
|>
|> I first wrote this code for linux. Linux had a CRTSCTS flag which I
|> could set in tio.c_cflag to enable hardware handshaking. Unfortuately I
|> am forced to run the application under Interactive Unix.
|>

Under AIX (IBM's UNIX) it's:

ioctl(file_descriptor,TXADDCD,"rts")

This adds RTS/CTS flow control to the discipline stack.  I'm not
aware of any portable way to do it.  Stevens notes the cflag
CCTS_OFLOW and CRTS_IFLOW as BSD4.3 extensions.

--


 
 
 

Need help w/serial communication under interactive unix

Post by John Hitchin » Fri, 22 Mar 1996 04:00:00



: |> I'm trying to do serial communication between a computer running dos and
: |> one running Interactive Unix. The problem is that I can't find out how
: |> to enable RTS/CTS (hardware) handshaking for the port.
: |>
: Under AIX (IBM's UNIX) it's:

: ioctl(file_descriptor,TXADDCD,"rts")

: This adds RTS/CTS flow control to the discipline stack.  I'm not
: aware of any portable way to do it.  Stevens notes the cflag
: CCTS_OFLOW and CRTS_IFLOW as BSD4.3 extensions.

Hi,

I don't think there is a portable way of setting hardware flowcontrol.

HP's use termiox to set hardware flow control which might be a POSIX
extension to termios, I'm not sure.

I think AT&T Unix and NCR Unix uses termiox as well.

Other systems I have used are -

  SCO Unix -
    RTSFLOW and CTSFLOW in cflags.

  MIPS -
        CNEW_RTSCTS in cflags.

Variety is the spice of life.

Hope this is of some help.

John.

--
John Hitchins.             | Atlas Products International Ltd,

                           | Manchester, M17 1HH, England.
                           | +44 161 872 2022, Fax +44 161 872 2024

 
 
 

1. Need help on program for serial line communication of UNIX

I've been going to develop a C program to do the communication of a data
device to UNIX through a serial line.  My environment is Sun Solaris
2.4.  The communication is two-way.  The data device will response by
get request from UNIX through the line.

Can anyone give me a simple program to start with or suggestions or
guidelines.

Thanks

Elson Chan

2. SVGATextMode with Riva TNT (Diamond Viper V550)

3. Serial Communication from UNIX box, please help!

4. SOMEONE ANSWER ME!!

5. Linux serial port communication - Need help!!!!!!!!!

6. How to setup mailing list?

7. Serial port communication - Need help!!!

8. eth0 and eth0:0

9. Serial Communications Help needed...

10. Serial port communication - Need help!!!