[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 6fcb7ccd37b4eaadc2219
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-03-11 16:25:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 6fcb7ccd37b4eaadc2219bfe7dab91c2907da844 (commit) from 198f1cb43e467cf3657f348fdbe23f6f8c10086a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6fcb7ccd37b4eaadc2219bfe7dab91c2907da844 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Mar 11 10:24:22 2021 -0600 Fixed icom ACK/NAK and frame responses https://github.com/Hamlib/Hamlib/issues/600 diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 9968e2a3..2d1664a9 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -269,6 +269,9 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd, /* Ok, normal frame */ break; + case NAK: + RETURNFUNC(-RIG_ERJCTED); + default: /* Timeout after reading at least one character */ /* Problem on ci-v bus? */ @@ -277,13 +280,14 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd, if (frm_len < ACKFRMLEN) { RETURNFUNC(-RIG_EPROTO); } + rig_debug(RIG_DEBUG_TRACE, "%s: frm_len=%d, frm_len-1=%02x, frm_len-2=%02x\n", __func__, frm_len, buf[frm_len-1], buf[frm_len-2]); if (NAK == buf[frm_len - 2]) { RETURNFUNC(-RIG_ERJCTED); } - if (ACK != buf[frm_len - 2]) { RETURNFUNC(-RIG_BUSBUSY); } + // has to be one of these two now or frame is corrupt + if (FI != buf[frm_len - 1] && ACK != buf[frm_len - 1]) { RETURNFUNC(-RIG_BUSBUSY); } *data_len = frm_len - (ACKFRMLEN - 1); - rig_debug(RIG_DEBUG_TRACE, "%s: data_len=%d, frm_len=%d\n", __func__, *data_len, - frm_len); + if (*data_len <= 0) { RETURNFUNC(-RIG_EPROTO); } memcpy(data, buf + 4, *data_len); /* ----------------------------------------------------------------------- Summary of changes: rigs/icom/frame.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |