Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2001 19:25:29 +0200
From:      lixu@mail.com
To:        questions@FreeBSD.ORG
Subject:   control RTS & RTS
Message-ID:  <3BDEE289.9030109@mail.com>

next in thread | raw e-mail | index | archive | help
Hi, All!
I have try to control RTS and DTR signal on my /dev/cuaa0.
I use this code from gnokii.org->

-----------------------------------------------------------------------------------------------
int port_setdtrrts(int fd, int dtr, int rts) {

  unsigned int flags;


  flags = TIOCM_DTR;

  if ( !dtr )
    if( ioctl( fd, TIOCMBIS, &flags) == -1 ) {
      perror("port_setdtrrts: ioctl\n");
      return -1;
    }
  else
    if( ioctl( fd, TIOCMBIC, &flags) == -1 ) {
      perror("port_setdtrrts: ioctl\n");
      return -1;
    }


  flags = TIOCM_RTS;

  if ( !rts)
    if( ioctl( fd, TIOCMBIS, &flags) == -1 ) {
       perror("port_setdtrrts: ioctl\n");
       return -1;
    }
  else
    if( ioctl( fd, TIOCMBIC, &flags) == -1 ) {
       perror("port_setdtrrts: ioctl\n");
       return -1;
    }

  return 0;
}// port_setdtrrts
------------------------------------------------------------------

but it seems it is don't work right,
anybody have experience in serial port programming?
i need advise, where is may be a bug ???

in my case when i do port_setdtrrts( port, 1, 0) i have:
DTR= CTS or DSR;
RTS= CTS or DSR;

so the DTR&RTS is depend from CTS&DSR, but i expect a
DTR= 1;(+12V)
RTS= 0; (-12V)

Where are exist a programm for manual control of DTR & RTS ???
any suggestion


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BDEE289.9030109>