Patch to allow same serial port for PTT and CAT.

Hi,

patch attached to enable the above which was partially coded but not
quite working.

73
Bill
G4WJS.

>From 9dab3a250dfad7203772df91aadf79d38c108f04 Mon Sep 17 00:00:00 2001
From: Bill Somerville <bill@classdesign.com>
Date: Fri, 6 Sep 2013 01:13:34 +0100
Subject: [PATCH] Fix using same serail port for PTT and CAT

src/rig.c was coded to allow the same serial port for PTT and
CAT but them tried to open the port twice. I have added code
to share the file descriptor in this situation.

Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
Hamlib-3.0
Bill Somerville 2013-09-06 01:18:35 +01:00 zatwierdzone przez Nate Bargmann
rodzic e6889901da
commit ef28e435d8
1 zmienionych plików z 30 dodań i 17 usunięć

Wyświetl plik

@ -503,21 +503,28 @@ int HAMLIB_API rig_open(RIG *rig)
break;
case RIG_PTT_SERIAL_RTS:
case RIG_PTT_SERIAL_DTR:
if (rs->pttport.pathname[0] == '\0' &&
rs->rigport.type.rig == RIG_PORT_SERIAL)
strcpy(rs->pttport.pathname, rs->rigport.pathname);
rs->pttport.fd = ser_open(&rs->pttport);
if (rs->pttport.fd < 0)
rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n",
rs->pttport.pathname);
else {
/* Needed on Linux because the kernel forces RTS/DTR at open */
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
}
break;
if (rs->pttport.pathname[0] == '\0' &&
rs->rigport.type.rig == RIG_PORT_SERIAL)
strcpy(rs->pttport.pathname, rs->rigport.pathname);
if (!strcmp(rs->pttport.pathname, rs->rigport.pathname))
{
rs->pttport.fd = rs->rigport.fd;
}
else
{
rs->pttport.fd = ser_open(&rs->pttport);
if (rs->pttport.fd < 0)
rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n",
rs->pttport.pathname);
else {
/* Needed on Linux because the kernel forces RTS/DTR at open */
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
}
}
break;
case RIG_PTT_PARALLEL:
rs->pttport.fd = par_open(&rs->pttport);
if (rs->pttport.fd < 0)
@ -652,11 +659,17 @@ int HAMLIB_API rig_close(RIG *rig)
break;
case RIG_PTT_SERIAL_RTS:
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
port_close(&rs->pttport, RIG_PORT_SERIAL);
if (rs->pttport.fd != rs->rigport.fd)
{
port_close(&rs->pttport, RIG_PORT_SERIAL);
}
break;
case RIG_PTT_SERIAL_DTR:
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
port_close(&rs->pttport, RIG_PORT_SERIAL);
if (rs->pttport.fd != rs->rigport.fd)
{
port_close(&rs->pttport, RIG_PORT_SERIAL);
}
break;
case RIG_PTT_PARALLEL:
par_ptt_set(&rs->pttport, RIG_PTT_OFF);