Article View: net.micro.att
Article #964DCD, DTR on sys5
From: Brandon Allbery
Date: Mon, 28 Apr 1986 21:47
Date: Mon, 28 Apr 1986 21:47
52 lines
2422 bytes
2422 bytes
Expires:
Quoted from <417@ukecc.UUCP> ["Re: 3B2/300 uucp ports & Permissions"], by edward@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@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@ncoast.UUCP> in net.unix.
Technical Details
Message-ID:
<1159@ncoast.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!cwruecmp!hal!ncoast!allberyReferences:
<81@vaxb.calgary.UUCP> <417@ukecc.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ncoast.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!cwruecmp!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: net.micro.att,net.unix-wizards Subject: DCD, DTR on sys5 Message-ID: <1159@ncoast.UUCP> Date: Mon, 28-Apr-86 17:47:20 EDT Article-I.D.: ncoast.1159 Posted: Mon Apr 28 17:47:20 1986 Date-Received: Thu, 1-May-86 04:06:31 EDT References: <81@vaxb.calgary.UUCP> <417@ukecc.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: net.micro.att Organization: North Coast Computer Resources Lines: 50