[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. b2acf0b6f5e34fcc9dd0a
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Michael B. <mdb...@us...> - 2021-08-22 03:39:15
|
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 b2acf0b6f5e34fcc9dd0a5d1f8ff3a3f45e35971 (commit)
via 0be978abcd77471442c1ce3c8d8f9df70fcdd835 (commit)
from a396dc88255bfe8a18fd9efdd72d561449cb6ad3 (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 b2acf0b6f5e34fcc9dd0a5d1f8ff3a3f45e35971
Author: Mike Black W9MDB <mdb...@ya...>
Date: Sat Aug 21 22:38:44 2021 -0500
Improve debug in ser_open
diff --git a/src/serial.c b/src/serial.c
index 1d852051..caa313ca 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -680,7 +680,7 @@ int ser_open(hamlib_port_t *p)
{
int ret;
- rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+ rig_debug(RIG_DEBUG_VERBOSE, "%s called port=%s\n", __func__, p->pathname);
if (!strncmp(p->pathname, "uh-rig", 6))
{
commit 0be978abcd77471442c1ce3c8d8f9df70fcdd835
Author: Mike Black W9MDB <mdb...@ya...>
Date: Sat Aug 21 22:31:15 2021 -0500
Add more retries to PTT serial port open
https://github.com/Hamlib/Hamlib/issues/768
diff --git a/src/serial.c b/src/serial.c
index 57d6eff7..1d852051 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -224,25 +224,16 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
/*
* Open in Non-blocking mode. Watch for EAGAIN errors!
*/
- fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- if (fd == -1) // some serial ports fail to open 1st time for some unknown reason
- {
- rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#1\n", __func__, __LINE__);
- hl_usleep(500*1000);
+ int i=1;
+ do { // some serial ports fail to open 1st time for some unknown reason
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- }
- if (fd == -1)
- {
- rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#2\n", __func__, __LINE__);
- hl_usleep(500*1000);
- fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- }
- if (fd == -1)
- {
- rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#3\n", __func__, __LINE__);
- hl_usleep(500*1000);
- fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- }
+ if (fd == -1) // some serial ports fail to open 1st time for some unknown reason
+ {
+ rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#%d\n", __func__, __LINE__, i);
+ hl_usleep(500*1000);
+ fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
+ }
+ } while(++i <= 4 && fd == -1);
if (fd == -1)
{
@@ -719,13 +710,17 @@ int ser_open(hamlib_port_t *p)
/*
* pathname is not uh_rig or uh_ptt: simply open()
*/
- ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- if (ret == -1) // some serial ports fail to open 1st time
+ int i=1;
+ do // some serial ports fail to open 1st time
{
- rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#1\n", __func__, __LINE__);
- hl_usleep(500*1000);
ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
- }
+ if (ret == -1) // some serial ports fail to open 1st time
+ {
+ rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#%d\n", __func__, __LINE__, i);
+ hl_usleep(500*1000);
+ ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
+ }
+ } while(++i <= 4 && ret == -1);
}
}
-----------------------------------------------------------------------
Summary of changes:
src/serial.c | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
hooks/post-receive
--
Hamlib -- Ham radio control libraries
|