Skip to content

Fix unnecessary rig re-open cycles by refactoring rigctl_parse return values#614

Merged
mdblack98 merged 1 commit into
Hamlib:masterfrom
mikaelnousiainen:fix-unnecessary-rig-reopen
Mar 17, 2021
Merged

Fix unnecessary rig re-open cycles by refactoring rigctl_parse return values#614
mdblack98 merged 1 commit into
Hamlib:masterfrom
mikaelnousiainen:fix-unnecessary-rig-reopen

Conversation

@mikaelnousiainen
Copy link
Copy Markdown
Collaborator

The current command loop in both rigctl and the rigctld server perform rig close/open cycles in case of hardware or I/O errors. However, the logic to detect these errors is not very accurate, as rigctl_parse returns value 2 (indicating re-open is required) for all RIG_E* errors from rig_ commands. There are many errors, e.g. "invalid parameter", which do not indicate an issue in the rig communication and re-opening the rig is totally unnecessary in this case.

Re-opening the rig causes real trouble when there are multiple clients connected to rigctld server and one of the clients issues a command resulting in "invalid parameter" error, for example. This will lead to the rig being unavailable for some time all other clients. See #612 for a more detailed explanation.

This PR includes:

  1. New, more deterministic return values in rigctl_prase function. The function returns the negative RIG_E* errors as they are, uses RIG_OK for indicating a successful command and two positive integers RIGCTL_PARSE_END (1) and RIGCTL_PARSE_ERROR (2) to indicate end-of-stream and other internal parsing errors -- both of which will make the command loop exit.

  2. New macro RIG_IS_SOFT_ERRCODE for determining if a particular error code is a "soft error", indicating it is not a hardware or I/O fault and cannot be potentially fixed by re-opening the rig. The soft errcodes are: RIG_EINVAL, RIG_ENIMPL, RIG_ERJCTED, RIG_ETRUNC, RIG_ENAVAIL, RIG_ENTARGET, RIG_EVFO and RIG_EDOM.

  3. Some fixes to Icom backend to remove ACK/NAK detection in commands that get/read data from the rig, as the ACK/NAK bytes are present in responses to commands that set/change the rig state only.

@mikaelnousiainen
Copy link
Copy Markdown
Collaborator Author

That was fast! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants