home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sun.hardware
- Path: sparky!uunet!usc!rpi!batcomputer!cornell!rochester!udel!news.udel.edu!bach.udel.edu!flaregun
- From: flaregun@bach.udel.edu (Edwin Phillips)
- Subject: Re: Flow control and /dev/ttya serial port
- Message-ID: <BzI0pB.991@news.udel.edu>
- Keywords: flow,serial,port,communication
- Sender: usenet@news.udel.edu
- Nntp-Posting-Host: bach.udel.edu
- Organization: University of Delaware
- References: <BzFCAM.2H8@news.udel.edu>
- Distribution: na
- Date: Sat, 19 Dec 1992 08:53:34 GMT
- Lines: 66
-
- Thanks for all of the responses so far on this...
- I negleted to mention that I also fiddled with the /etc/printcap extensively.
- The printcap entry looks like this:
-
- DeskJet Plus|lp|prt1:\
- :lp=/dev/ttya:\
- :br#9600:\
- :ms=cs8,-parenb,-clocal,cread,-opost:\
- :sd=/var/spool/lpd-deskjet:\
- :cf=/usr/local/XWP/shbin/wpp:
-
- This is not really used though because I'm not using lpr during testing.
- Here's a bit of the code I've used to test with: (I realize it does not
- set master.c_cc but I've set them as well during testing).
-
- struct termios master;
-
- lp = open(PRINTER, O_WRONLY | O_NOCTTY);
- if (lp < 0)
- {
- printf("Error opening printer device %s\n", PRINTER);
- return;
- }
-
- master.c_iflag = IGNBRK | IGNPAR | IXON;
- master.c_oflag = OPOST | ONLCR;
- master.c_cflag = B9600 | CS8 | CREAD;
- master.c_lflag = ISIG;
- master.c_line = 0;
-
- noterr = ioctl(lp, TCSETS, &master);
- if (noterr < 0)
- {
- printf("Return code from ioctl() = %d\n\n", noterr);
- perror("ioctl()");
- return;
- }
- printf("termio setup\n");
- checkterm(lp); /* get the termios for lp and prints out vals */
-
- noterr = 1;
- while (noterr > 0)
- {
- noterr = read(0, buff, BUFF_SIZE);
- if (noterr > 0)
- {
- if (write(lp, buff, noterr) != noterr)
- {
- printf("write() error %d", noterr);
- perror("write()");
- return;
- }
- }
- }
-
- if (noterr < 0)
- perror("read() error");
- else
- printf("\n\nComplete.\n\n");
- close(lp);
-
- --
- /***************************************************************************/
- /* Ed Phillips flaregun@brahms.udel.edu University of Delaware */
- /* Jr. Systems Programmer (302) 831-1129 NSS/Software Systems */
- /***************************************************************************/
-