kopia lustrzana https://github.com/Hamlib/Hamlib
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
rodzic
e6889901da
commit
ef28e435d8
47
src/rig.c
47
src/rig.c
|
@ -503,21 +503,28 @@ int HAMLIB_API rig_open(RIG *rig)
|
||||||
break;
|
break;
|
||||||
case RIG_PTT_SERIAL_RTS:
|
case RIG_PTT_SERIAL_RTS:
|
||||||
case RIG_PTT_SERIAL_DTR:
|
case RIG_PTT_SERIAL_DTR:
|
||||||
if (rs->pttport.pathname[0] == '\0' &&
|
if (rs->pttport.pathname[0] == '\0' &&
|
||||||
rs->rigport.type.rig == RIG_PORT_SERIAL)
|
rs->rigport.type.rig == RIG_PORT_SERIAL)
|
||||||
strcpy(rs->pttport.pathname, rs->rigport.pathname);
|
strcpy(rs->pttport.pathname, rs->rigport.pathname);
|
||||||
rs->pttport.fd = ser_open(&rs->pttport);
|
if (!strcmp(rs->pttport.pathname, rs->rigport.pathname))
|
||||||
if (rs->pttport.fd < 0)
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n",
|
rs->pttport.fd = rs->rigport.fd;
|
||||||
rs->pttport.pathname);
|
}
|
||||||
else {
|
else
|
||||||
/* Needed on Linux because the kernel forces RTS/DTR at open */
|
{
|
||||||
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
|
rs->pttport.fd = ser_open(&rs->pttport);
|
||||||
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
|
if (rs->pttport.fd < 0)
|
||||||
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
|
rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n",
|
||||||
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
|
rs->pttport.pathname);
|
||||||
}
|
else {
|
||||||
break;
|
/* 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:
|
case RIG_PTT_PARALLEL:
|
||||||
rs->pttport.fd = par_open(&rs->pttport);
|
rs->pttport.fd = par_open(&rs->pttport);
|
||||||
if (rs->pttport.fd < 0)
|
if (rs->pttport.fd < 0)
|
||||||
|
@ -652,11 +659,17 @@ int HAMLIB_API rig_close(RIG *rig)
|
||||||
break;
|
break;
|
||||||
case RIG_PTT_SERIAL_RTS:
|
case RIG_PTT_SERIAL_RTS:
|
||||||
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
|
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;
|
break;
|
||||||
case RIG_PTT_SERIAL_DTR:
|
case RIG_PTT_SERIAL_DTR:
|
||||||
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
|
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;
|
break;
|
||||||
case RIG_PTT_PARALLEL:
|
case RIG_PTT_PARALLEL:
|
||||||
par_ptt_set(&rs->pttport, RIG_PTT_OFF);
|
par_ptt_set(&rs->pttport, RIG_PTT_OFF);
|
||||||
|
|
Ładowanie…
Reference in New Issue