From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076335021221.tru64-unix-managers.marc@archive.invalid> From: mgaluza () dejarnette ! com (Mike Galuza) Date: Tue, 02 Jul 1996 10:26:45 +0000 To: tru64-unix-managers Subject: Summary #3 (last one, I promise): Serial control X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076335021221 After a lot of head scratching, sending messages to this list and even suspecting a bug in DU I've finally figured out why I was having trouble doing I/O on my serial device. (See original post below). It was all because of a silly little mistake in my code. I apologize to those who wasted their time reading and/or responding to my messages. Here's the bug: in my routine that opens the device I had a line like this: if (fd = open(...) >= 0) return(fd) The ">=" has precedence over "=" so the inequality was performed first, always resulting in 1, so fd was always one. Later in my code, I was doing my ioctl's and fstat's on an fd of 1, or stdout! Thus the results I describe below occured. Thank you to those who tried in vain to help me, especially Tom Blinn who went far beyond the call of duty. Regards, Mike ------------------- Original question ------------------- managers: As promised in my previous summary, here is my 3rd question about my problem controlling a device connected to the serial port. Here's a recap: I am trying to use ioctl() calls to control a device (a barcode reader) connected to my serial port. I am able to open() /dev/tty01 and change the port settings with ioctl()'s. However when I change port settings it seems to affect my terminal, not the connection to the device. For example, when I turn off echo, characters no longer appear at my prompt when I type. One experiment I've tried is to look at the major and minor device numbers of the devie and /dev/tty before and after opening, using stat() and fstat(). BTW, the "ace" serial port driver (major # 35) is configured for tty01. Before opening, tty01 and tty have a major/minor pair of 35/1 and 1/0 respectively, as would be expected. However, after opening each device, the major/minor pair becomes 6/4 for both devices. This happens to be the same pair as my terminal device /dev/ttyp4. Does anyone have any clue why, after opening, I am getting access to the terminal rather than to the actual physical device? Is there some sort of terminal or serial port configuration I don't know about? Thanks, Mike P.S. An addendum to my previous summary: One reason I became confused about the appropriate driver for my serial port was that there is no man page for the ace driver. There are man pages for the scc and iscc drivers however. There is a man page for ace in DU 4.0. Someone has emailed it to me. ---------------------------------------------------------------------- Michael Galuza DeJarnette Research Systems mgaluza@dejarnette.com 401 Washington Ave Suite 700 Voice: +1(410)583-0680 x691 Towson, MD 21204 Fax: +1(410)583-0696 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Michael Galuza DeJarnette Research Systems mgaluza@dejarnette.com 401 Washington Ave Suite 700 Voice: +1(410)583-0680 x691 Towson, MD 21204 Fax: +1(410)583-0696 ----------------------------------------------------------------------