Need help with serial port i/o

Shermane Austin SAACC at cunyvm.cuny.edu
Sat Aug 11 11:52:57 AEST 1990


Here's my problem:

I am trying to port routines from an MSDOS machine controlling a robotic
arm to my Sparcstation. My problem is with the routines to transmit ASCII
characters to the robot controller via the serial port. (The robot
controller uses an RS232C serial interface).

I thought that this would be fairly simple, that all I had to do was open
the right port /dev/tty*, and make minor changes in the line parameters
for calls. (Of course, I had never done it before.) At any rate, it's not
working, and since so many different things may be wrong, I'm trying to
isolate where the problem lies.

My questions are:

1. coding side: below are fragments of my routine related to opening the
   line, modifying the parameters, and writing to the port. Is this
   sufficient for a non-terminal device?

    #include <termio.h>
             .
             .
      fd = open("/dev/ttyb",0_RDWR);
             .
      ioctl(fd,TCGETA,&tparam); /*gets current parameters*/
         /*minor changes*/
      ioctl(fd,TCSETA,&tparam); /*sets parameters*/
             .
      write(fd,str,1);

2. do the settings for this line have to be changed in the /etc/ttytab
   file. They are still at the setup default:

    "usr/etc/getty std.9600"  unknown off


3. Are there changes needed elsewhere? E.g. is a special device driver
   needed?

I know that these questions are probably very elementary, but I have no
unix experience in termio handling, and our local wizard is on a leave of
absence. I'd appreciate any pointers in the right direction. Please email
replies. Thanks.



More information about the Comp.sys.sun mailing list