Corrected logic in ptt_linux.c.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@49 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2006-01-05 20:38:27 +00:00
parent aae9ccb6d5
commit c909fc794e
1 changed files with 5 additions and 13 deletions

View File

@ -7,7 +7,7 @@
int ptt_(int *nport, int *ntx, int *iptt)
{
static int nopen=0;
int i;
int control = TIOCM_RTS | TIOCM_DTR;
int fd;
char s[11];
@ -27,23 +27,15 @@ int ptt_(int *nport, int *ntx, int *iptt)
return(0);
}
//enable privileges for I/O port controls
if(ioperm(0,0x3ff,1) < 0) {
printf("Cannot set privileges for serial I/O\n");
return(1);
}
// ioctl(fd, TIOCMGET, &flags); //get line bits for serial port
if(*ntx && nopen) {
i = TIOCM_RTS + TIOCM_DTR;
ioctl(fd, TIOCMSET, &i); // Set DTR and RTS
// printf("Set DTR/RTS %d %d\n",TIOCMBIS,control);
ioctl(fd, TIOCMBIS, &control); // Set DTR and RTS
*iptt=1;
}
else {
i=0;
ioctl(fd, TIOCMSET, &i);
// printf("Clear DTR/RTS %d %d\n",TIOCMBIC,control);
ioctl(fd, TIOCMBIC, &control);
close(fd);
*iptt=0;
nopen=0;