Serial device /dev/tty1p0 on HPUX 10.20

Serial device /dev/tty1p0 on HPUX 10.20

Post by laslohollyf.. » Thu, 01 Mar 2001 06:05:48



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

 
 
 

Serial device /dev/tty1p0 on HPUX 10.20

Post by LasloHollyf.. » Thu, 01 Mar 2001 23:04:44



writes:

Quote:>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!!!

See, it's got me so confused that I forgot to mention the exact behavior
(without running cu) that I see: The read comes back every 10 seconds (like
I expect) with 0 bytes. No data. Nothing. AND, as far as I can tell, the
commands are not getting out to the switch, either.

Does anyone have any suggestions?

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


 
 
 

Serial device /dev/tty1p0 on HPUX 10.20

Post by Martin Jos » Fri, 02 Mar 2001 23:48:50



> 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:

[...]

Quote:> It's driving me crazy!!!

Ok, maybe I miss the point completely, but....

Sounds to me like a problem for "expect"
(http://expect.nist.gov/)
expect is a TCL-extension (actualy the first one published...) to
automate interactive programs. So if cu does some "magic", you can use
expect, which will use 'cu' to do the magic.

If you are more comfortable with perl than with TCL, there is a
Expect-module for perl (See your nearest CPAN).

HTH

Martin

 
 
 

Serial device /dev/tty1p0 on HPUX 10.20

Post by Martin Jos » Fri, 02 Mar 2001 23:49:15



> 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:

[...]

Quote:> It's driving me crazy!!!

Ok, maybe I miss the point completely, but....

Sounds to me like a problem for "expect"
(http://expect.nist.gov/)
expect is a TCL-extension (actually the first one published...) to
automate interactive programs. So if cu does some "magic", you can use
expect, which will use 'cu' to do the magic.

If you are more comfortable with perl than with TCL, there is a Expect
module for perl (See your nearest CPAN).

HTH

Martin

 
 
 

Serial device /dev/tty1p0 on HPUX 10.20

Post by Frank da Cr » Sat, 03 Mar 2001 07:06:49




: > 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:
:
That's what Kermit is for.   It's in /bin/kermit on HP-UX 10.20.  It's
like cu but has a built-in script programming language.   It's also like
Telnet.   It also transfers files, etc etc.  Just type "kermit" to start it,
"man kermit" to get more info.  To see more recent releases, visit:

  http://www.columbia.edu/kermit/

- Frank

 
 
 

1. How can i find the address of a device on HPUX 10.20 system

Hi all,

I'd like to learn how to find the address (in the memory address
space) of any device on a HPUX 10.20 machine.

I'm just trying to write a basic device driver; and currently
managed to write a pseudo device driver. The next step is accessing
a real hardware. In order to do this I have to learn the address of
the devices in the memory address space.

Maybe a UNIX command displaying the addresses, or any other
utility.

Cheers,

--

================================================================
Bahri OKUROGLU

Netas R&D        RL-5 : Product Performance & Automation Support


http://193.140.184.5/r748/member/bahrio               (internal)
Netas   Alemdag Cad.    Umraniye 81244           ISTANBUL TURKEY
Tel: +90(216)344 00 44 / 3512              Fax:+90(216)328 02 13
================================================================

2. HP UX Systems Administration

3. hpux 10.20 boot problem

4. SCSI card & scanner hangs kernel?

5. NIS problems between HPUX 10.20 and FreeBSD 3.0

6. sendmail without dns

7. Trygin to run an Applet on Netscape 4.7 on HPUX 10.20

8. Question - Writing my Own Shell

9. Problems with following sym links in HPUX 10.20

10. Adding new syscall to HPUX 10.20 / 11.00

11. Apache compile problem under HPUX 10.20

12. problems mounting CD in HPUX 10.20

13. HPUX 10.20 sendmail problem.