kopia lustrzana https://github.com/Hamlib/Hamlib
Add more diagnostics and error checks to serial line control
rodzic
e1a0e9121c
commit
0e0779877d
13
src/rig.c
13
src/rig.c
|
@ -480,7 +480,8 @@ int HAMLIB_API rig_open(RIG *rig)
|
||||||
rs->rigport.pathname);
|
rs->rigport.pathname);
|
||||||
return -RIG_ECONF;
|
return -RIG_ECONF;
|
||||||
}
|
}
|
||||||
if (!strcmp(rs->pttport.pathname, rs->rigport.pathname))
|
if ('\0' == rs->pttport.pathname[0]
|
||||||
|
|| !strcmp(rs->pttport.pathname, rs->rigport.pathname))
|
||||||
{
|
{
|
||||||
/* check for control line conflicts */
|
/* check for control line conflicts */
|
||||||
if (rs->rigport.parm.serial.rts_state != RIG_SIGNAL_UNSET &&
|
if (rs->rigport.parm.serial.rts_state != RIG_SIGNAL_UNSET &&
|
||||||
|
@ -529,13 +530,17 @@ int HAMLIB_API rig_open(RIG *rig)
|
||||||
status = -RIG_EIO;
|
status = -RIG_EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (RIG_OK == status)
|
if (RIG_OK == status)
|
||||||
{
|
{
|
||||||
/* Needed on Linux because the kernel forces RTS/DTR at open */
|
/* Needed on Linux because the kernel forces RTS/DTR at open */
|
||||||
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
|
if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR)
|
||||||
ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
|
status = ser_set_dtr(&rs->pttport, RIG_PTT_OFF);
|
||||||
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
|
else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS)
|
||||||
ser_set_rts(&rs->pttport, RIG_PTT_OFF);
|
status = ser_set_rts(&rs->pttport, RIG_PTT_OFF);
|
||||||
|
if (status != RIG_OK)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: Cannot set serial control line - %s\n", __func__, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIG_PTT_PARALLEL:
|
case RIG_PTT_PARALLEL:
|
||||||
|
|
|
@ -431,6 +431,8 @@ int HAMLIB_API ser_set_rts(hamlib_port_t *p, int state)
|
||||||
{
|
{
|
||||||
unsigned int y = TIOCM_RTS;
|
unsigned int y = TIOCM_RTS;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: RTS=%d\n", __func__, state);
|
||||||
|
|
||||||
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
||||||
return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ?
|
return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ?
|
||||||
-RIG_EIO : RIG_OK;
|
-RIG_EIO : RIG_OK;
|
||||||
|
@ -472,6 +474,8 @@ int HAMLIB_API ser_set_dtr(hamlib_port_t *p, int state)
|
||||||
{
|
{
|
||||||
unsigned int y = TIOCM_DTR;
|
unsigned int y = TIOCM_DTR;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: DTR=%d\n", __func__, state);
|
||||||
|
|
||||||
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
||||||
return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ?
|
return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ?
|
||||||
-RIG_EIO : RIG_OK;
|
-RIG_EIO : RIG_OK;
|
||||||
|
|
Ładowanie…
Reference in New Issue