Lower both RTS and DTR on alternate PTT serial port

Before this  change only the  line used for  PTT was being  lowered on
open.   It is  necessary for  platforms  other than  Windows to  avoid
issues with other uses of the line not used for PTT such as interfaces
that wire-or RTS and DTR together or use it for CW or FSK keying. This
is because  platforms other  than Windows  raise both  DTR and  RTS on
serial port opening.

Also changed  code that opens CAT  port to lower  RTS or DTR if  it is
used for PTT. In this case there is no need to lower the other line of
DTR  or RTS  as there  is  already a  config parameter  to control  it
(dtr_state or rts_state). This change is necessary to maintain current
functionality.
Hamlib-3.0
Bill Somerville 2015-04-13 16:25:21 +01:00
rodzic 2c0134ae4c
commit de3fccf033
1 zmienionych plików z 19 dodań i 9 usunięć

Wyświetl plik

@ -505,7 +505,6 @@ int HAMLIB_API rig_open(RIG *rig)
if (status < 0)
return status;
switch(rs->pttport.type.ptt) {
case RIG_PTT_NONE:
case RIG_PTT_RIG:
@ -519,6 +518,15 @@ int HAMLIB_API rig_open(RIG *rig)
if (!strcmp(rs->pttport.pathname, rs->rigport.pathname))
{
rs->pttport.fd = rs->rigport.fd;
/* Needed on Linux because the serial port driver sets RTS/DTR
on open - only need to address the PTT line as we offer
config parameters to control the other (dtr_state &
rts_state) */
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
status = ser_set_dtr(&rs->pttport, 0);
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
status = ser_set_rts(&rs->pttport, 0);
}
else
{
@ -529,15 +537,17 @@ int HAMLIB_API rig_open(RIG *rig)
rs->pttport.pathname);
status = -RIG_EIO;
}
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR
|| rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
{
/* Needed on Linux because the serial port driver sets
RTS/DTR high on open - set both low since we offer no
control of the non-PTT line and low is better than
high */
status = ser_set_dtr(&rs->pttport, 0);
status = ser_set_rts(&rs->pttport, 0);
}
}
if (RIG_OK == status)
{
/* Needed on Linux because the kernel forces RTS/DTR at open */
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
status = ser_set_dtr(&rs->pttport, 0);
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
status = ser_set_rts(&rs->pttport, 0);
}
break;
case RIG_PTT_PARALLEL:
rs->pttport.fd = par_open(&rs->pttport);