DCD, DTR on sys5
Brandon Allbery
allbery at ncoast.UUCP
Tue Apr 29 07:47:20 AEST 1986
Expires:
Quoted from <417 at ukecc.UUCP> ["Re: 3B2/300 uucp ports & Permissions"], by edward at ukecc.UUCP (Edward C. Bennett)...
+---------------
| All this raises the more useful question:
|
| 1. Can the 3B2 control its outgoing DTR signal?
+---------------
$ stty 0 > /dev/ttyxx # turn off DTR
$ # turning it on is more difficult, you have to open the port without
$ # DCD and ioctl() the baud rate to non-zero (see below)
+---------------
| 2. Can a tty port be opened without the incoming CD signal
| being high?
+---------------
#include <fcntl.h>
#include <termio.h>
#include <sys/ioctl.h>
#define TTY "/dev/ttyxx"
main() {
int fd;
struct termio ttydat;
if ((fd = open(TTY, O_RDONLY|O_NDELAY)) < 0)
exit(1);
ioctl(fd, TCGETA, &ttydat);
ttydat.c_cflag &= ~CBAUD;
ttydat.c_cflag |= Bmybaud; /* substitute your baud rate */
ioctl(fd, TCSETA, &ttydat);
exit(0);
}
The above program uses the fact that you can open for O_NDELAY a tty despite
neither DTR nor DCD being asserted; you can't read or write, but you CAN
ioctl. These are tested under System III (I have a much more complex version
of the above C program, run as ``dtr +tty22'' or similar, ``+'' for on, ``-''
for off), but should work under sys5 because the tty structure and code hasn't
changed (modulo sxt's).
If you want my ``dtr'' program, let me know.
--Brandon
--
decvax!cwruecmp!ncoast!allbery ncoast!allbery at Case.CSNET ncoast!tdi2!brandon
(ncoast!tdi2!root for business) 6615 Center St. #A1-105, Mentor, OH 44060-4101
Phone: +01 216 974 9210 CIS 74106,1032 MCI MAIL BALLBERY (part-time)
PC UNIX/UNIX PC - which do you like best? See <1129 at ncoast.UUCP> in net.unix.
More information about the Comp.unix.wizards
mailing list