>>>>> "Gus" == Gus  <[EMAIL PROTECTED]> writes:

    Gus> i figured this was the most relevant list to ask...

    Gus> i've got a small device (random number generator) which plugs
    Gus> into a serial port and takes its power off the RTS and DTR
    Gus> lines

    Gus> i need to raise one and lower the other (and hold them there
    Gus> - this thing needs some time to 'warm up')

    Gus> how do i do this?  (all the termios info i've been able to
    Gus> find doesn't seem to say..)

    Gus> --
    Gus> - Gus

Here is the RTS - DTR is similar (this is gcc2.7.x and glibc2, kernel
2.0.32, not sure if that matters).

S.

int waketel(int fd)
{
     int arg, status;
     if((status = ioctl(fd, TIOCMGET, &arg)) != 0) {
          msglog("waketel: ioctl: %m");
          return(-1);
     }
     arg |= TIOCM_RTS;          /* set RTS */
     if((status = ioctl(fd, TIOCMSET, &arg)) != 0) {
          msglog("waketel: ioctl: %m");
          return(-1);
     }
     usleep(60000);             /* wait for Telonics */
     arg &= ~TIOCM_RTS;         /* reset RTS */
     if((status = ioctl(fd, TIOCMSET, &arg)) != 0) {
          msglog("waketel: ioctl: %m");
          return(-1);
     }
     usleep(50000);             /* wait for Telonics */
     return(0);
}

-- 
Sridhar Anandakrishnan                  email:  [EMAIL PROTECTED]
ESSC, 208 Deike Bldg                    Phone:  (814) 865-7124/863-1700
Pennsylvania State University           Dept:         865-1073
University Park, PA 16802-2711          Fax:          865-3191

Reply via email to