Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Set DTR of serial-Port to a high value



----- Original Message -----
From: "Patrick Maier" <maierp@informatik.tu-muenchen.de>
>
> (...)
> So my question is: how can I set the DTR line to a high value to support
> the
> RTS line?


Hi Patrick,

don't know if adjusting the DTR line will solve your initial problem, but
you may want to try something like this:

#include <fcntl.h>
#include <sys/ioctl.h>

// open the serial device
int fd;
fd = open("/dev/ttyS0", O_RDWR || O_NONBLOCK);

// adjust serial communuication parameters
struct termios ComParams;
tcgetattr(fd, &ComParams);
ComParams.c_cflag &= ~CBAUD; // baud rate = 9600 bd
ComParams.c_cflag |= B9600;
tcsetattr( fd, TCSANOW, &ComParams );

// play with RTS & DTR
int iFlags;

// turn on RTS
iFlags = TIOCM_RTS;
ioctl(fd, TIOCMBIS, &iFlags);

// turn off RTS
iFlags = TIOCM_RTS;
ioctl(fd, TIOCMBIC, &iFlags);

// turn on DTR
iFlags = TIOCM_DTR;
ioctl(fd, TIOCMBIS, &iFlags);

// turn off DTR
iFlags = TIOCM_DTR;
ioctl(fd, TIOCMBIC, &iFlags);

greetings
Christian





-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index