HPE 9000 and HPE e3000 Servers
1752480 Members
5584 Online
108788 Solutions
New Discussion

Can't set modem control lines on the serial port /dev/tty1p2 on an rp4440

 
Kevin Lister
Frequent Advisor

Can't set modem control lines on the serial port /dev/tty1p2 on an rp4440

Hi Folks,

I'm attempting to set the control lines on the /dev/tty1p2 port on an rp4440 with no luck.

The HP SE's told me it wasn't possible to activate the "remote" port on the rear of the rp4440 and that the "console" port was the only way to get any terminal or modem access. I got it to work quite easily by simply adding a line in the /etc/inittab file to start up a getty on /dev/tty1p2.

However, my real goal is to be able to set and get the status of the control lines, DTR, CTS, RTS, etc. My C program does allow me to open the tty using ioctl and allows me to set the control lines but when I get the status they are always zero.

My C program:

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <sys/modem.h>

static int fd = 0;

int main() {
  int state = 0;

  char *tty = "/dev/tty1p2";

  /* Open the serial port or die */
  fd = open(tty, O_RDWR | O_NOCTTY | O_NDELAY);

  if (fd < 0)

  {
    fprintf(stderr, "ERROR: can not open \"%s\"\n", tty);
    exit(2);
  }

/* Set DTR on the port. */

  ioctl(fd, TIOCMSET, TIOCM_DTR);

  /* Get the status of the port. */

  ioctl(fd, TIOCMGET, &state);

  close(fd);

  printf("Port -> %011x\n", state);

  return (0);

When I run the program I always get the following output regardless of what I set:

./tty
Port -> 00000000000

I know the port is working as I put an HP terminal on it and I'm able to log in.

Yes! I have an HP terminal 700/96 that I still use on my servers in emergencies. ;o)

As always, thanks in advance for any insight, suggestions, recommendations, etc. ;o)

kev