murli@bobcat.ent.ohiou.edu (murli-ramakrishnan-ISE-272-90-2726) (02/02/91)
Can someone help me write a program to control a robot through the serial port of Sun 3/80. Is there a way I can set the pairty, baud rate, no of bits from a C Program?. I do know that I can have a printcap with #br9600 for baud, But the man pages are not very clear about how to set the bits,parity etc? Murli Ram murli@cubix.ent.ohiou.edu(NeXT Mail) Ohio University murli@bobcat.ent.ohiou.edu Athens mramakri@oucsace.cs.ohiou.edu
perl%step@uunet.uu.net (Robert Perlberg) (02/19/91)
You should look at the manual pages for stty(1), ioctl(2), and termio(4). Termio(4) will explain all about how to use the ioctl() function to set baud rate, parity, and a bunch of other parameters on tty ports. The stty command can be used to make these same settings from a shell prompt or within a shell script (or even with a C program using system(3), if you are so inclined, but ioctl is the preferred method). If you want to set the tty settings from within the lpr spooler, use the `ms' capability in the printcap. You pass it a set of arguments to be used with stty(1), e.g.: :ms=parenb -parodd cs7 -cstopb: Robert Perlberg Dean Witter Reynolds Inc., New York {murphy | philabs | chuo}!step!perl