1. Serial device /dev/tty1p0 on HPUX 10.20
I'm trying to interface with a serial device (actually the console port of
a routing switch) attached to /dev/tty1p0. If I set up /etc/uucp/Devices to
list it as direct and 9600 bps, cu can connect to it and I can talk to it
just fine.
I now want to automate some of the things I was doing manually through cu. I
created a program which does the following:
..
fd = open("/dev/tty1p0", O_RDWR | O_NDELAY);
/* Undo the O_NDELAY */
fcntl(fd, F_SETFL, 0);
tcgetattr(fd, &ts);
ts.c_iflags = 0;
ts.c_oflags = 0;
ts.c_cflags = CS8|CREAD|CLOCAL|B9600;
ts.c_lflags = IGNBRK|IGNPAR;
ts.c_cc[VMIN] = 0;
ts.c_cc[VTIME] = 10;
tcsetattr(fd, TCSANOW, &ts);
/* Write something, anything */
cmds = "commands\n";
wr = write(fd, cmds, strlen(cmds));
printf("write: %d\n", wr);
/* Read the output */
while((rd = read(fd, buf, buf_sz)) >= 0)
{
/* just print the size */
printf("read: %d\n", rd);
}
..
It's just a little test to see if I can communicate. I have tried playing
with the cflags some. I started up cu on the line and used stty to dump
the settings. No change. On the other hand, if I start cu, then suspend it,
then start my test program, it works correctly. What is it that cu is doing
that I am not? cu apparently undoes whatever it is when it exits -- unless
I kill it with a -9.
It's driving me crazy!!!
Russ
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
2. Dummy display with X ?
3. compiling libg++ (also compiling ACE) on an HPUX 10.20 system
4. status of ntfs write-support in 2.4.20
5. hpux 10.20 boot problem
6. USB Ethernet
7. NIS problems between HPUX 10.20 and FreeBSD 3.0
8. : reiser4 [5/8] export remove_from_page_cache()
9. Trygin to run an Applet on Netscape 4.7 on HPUX 10.20
10. Problems with following sym links in HPUX 10.20
11. Adding new syscall to HPUX 10.20 / 11.00
12. Apache compile problem under HPUX 10.20
13. problems mounting CD in HPUX 10.20