Exemplo n.º 1
0
void tty_init (void)
{
	stty_raw ();
	install_atexit_handler ();
	/*printf ("\x1b""c");*/
	tty_attr_reset ();
}
Exemplo n.º 2
0
int find_ptyxx (char *ptyname)
{
  int fd, ttyfd;
  
  if (my_openpty(&fd,&ttyfd,ptyname) < 0)
    errorf("Couldn't openpty: %s\n",strerror(errno));

  if (stty_raw(ttyfd) != 0)
    errorf("Couldn't put pty into raw mode: %s\n",strerror(errno));
  /* Throw away the ttyfd.  We'll keep it open because it prevents
   * errors when the client disconnects, but we don't ever plan to
   * read or write any data, so we needn't remember it.
   */

  return fd;
}
Exemplo n.º 3
0
int setup_back_tty(char *backend, int f[2])
{
  int serialfd;
  
  /* Open the serial port */
  serialfd = open(backend, O_RDWR | O_NOCTTY | O_SYNC | O_NOCTTY);
  if (serialfd < 0)
    errorf("error opening backend device '%s': %s\n",backend,strerror(errno));
  if (stty_raw(serialfd) != 0)
    errorf("Error putting serial device '%s' in raw mode: %s\n",backend,strerror(errno));
  
  /* Process settings from the -s switch */
  if (settings) {
    fstty(serialfd,settings);
  }

  return f[0]=f[1]=serialfd;
}