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

View File

@ -7,7 +7,7 @@
int ptt_(int *nport, int *ntx, int *iptt) int ptt_(int *nport, int *ntx, int *iptt)
{ {
static int nopen=0; static int nopen=0;
int i; int control = TIOCM_RTS | TIOCM_DTR;
int fd; int fd;
char s[11]; char s[11];
@ -27,23 +27,15 @@ int ptt_(int *nport, int *ntx, int *iptt)
return(0); 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) { if(*ntx && nopen) {
i = TIOCM_RTS + TIOCM_DTR; // printf("Set DTR/RTS %d %d\n",TIOCMBIS,control);
ioctl(fd, TIOCMSET, &i); // Set DTR and RTS ioctl(fd, TIOCMBIS, &control); // Set DTR and RTS
*iptt=1; *iptt=1;
} }
else { else {
i=0; // printf("Clear DTR/RTS %d %d\n",TIOCMBIC,control);
ioctl(fd, TIOCMSET, &i); ioctl(fd, TIOCMBIC, &control);
close(fd); close(fd);
*iptt=0; *iptt=0;
nopen=0; nopen=0;