[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. d11d7b2d0029e901e90f6
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2025-10-06 16:42:33
|
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 d11d7b2d0029e901e90f62e866e2a3c3e9924c50 (commit) via d3769bf948a8bbe57dd982de2fc2dfbe4dea1d4d (commit) via 4ad91cad0a70d2a50e98317076484f420d2d4414 (commit) via d391e569ce4bb370720376363eacd6ba062f7702 (commit) via 8bd19c4db80d22f0a710c487bfe4acc1a15e9179 (commit) via 00020e6d9d1c7c17544fb3ce8f9ec64ae8ad0be4 (commit) via 22834737075ddbb0a7a36e179a58a8d1439415cf (commit) from 54a5097c7e44148dc5c02ad6194744c60fbd86f4 (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 d11d7b2d0029e901e90f62e866e2a3c3e9924c50 Merge: 54a5097c7 d3769bf94 Author: Nate Bargmann <n0...@n0...> Date: Mon Oct 6 11:26:12 2025 -0500 Merge GitHub PR #1932 commit d3769bf948a8bbe57dd982de2fc2dfbe4dea1d4d Author: George Baltz N3GB <Geo...@gm...> Date: Fri Oct 3 11:56:04 2025 -0400 Don't forget the noise diff --git a/bindings/python/test_Hamlib_class.py b/bindings/python/test_Hamlib_class.py index 0493eb717..3ee2df26d 100755 --- a/bindings/python/test_Hamlib_class.py +++ b/bindings/python/test_Hamlib_class.py @@ -131,7 +131,6 @@ class TestClass: 'HAMLIB_ELAPSED_GET', 'HAMLIB_ELAPSED_INVALIDATE', 'HAMLIB_ELAPSED_SET', -'HAMLIB_FIFO_SIZE', 'HAMLIB_FILPATHLEN', 'HAMLIB_FLTLSTSIZ', 'HAMLIB_FRQRANGESIZ', commit 4ad91cad0a70d2a50e98317076484f420d2d4414 Author: George Baltz N3GB <Geo...@gm...> Date: Fri Oct 3 11:12:06 2025 -0400 Add a fallback function for spaces() This shouldn't be needed, but somebody somewhere sometime is going to use an old rigctl with a new hamlib and get an undefined symbol. Should go away with 5.0. diff --git a/src/misc.c b/src/misc.c index 92469f34f..b3244b737 100644 --- a/src/misc.c +++ b/src/misc.c @@ -2834,6 +2834,21 @@ const char *hl_stars(int len) return &s[MAX_STARS - len]; } +//---Start cut here--- +//! @cond Doxygen_Suppress +/* Dummy definition for mismatched rigctl|rigctld|<whatever> + * that still references old function + * Should go away with 5.0 + * Not prototyped or referenced in any current code + */ +// cppcheck-suppress unusedFunction +const char *spaces(int len) +{ + return hl_stars(len); +} +//! @endcond + +//---End cut here--- //! @cond Doxygen_Suppress char *date_strget(char *buf, int buflen, int localtime) { commit d391e569ce4bb370720376363eacd6ba062f7702 Author: George Baltz N3GB <Geo...@gm...> Date: Tue Sep 30 11:09:18 2025 -0400 Add rig to opened list even if skip_init is set. Just in case someone finishes CHECK_RIG_ARG, or checks status from remove_opened_rig(). diff --git a/src/rig.c b/src/rig.c index a390db1d1..52f81171b 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1593,7 +1593,11 @@ int HAMLIB_API rig_open(RIG *rig) } } - if (skip_init) { RETURNFUNC2(RIG_OK); } + if (skip_init) + { + add_opened_rig(rig); + RETURNFUNC2(RIG_OK); + } status = async_data_handler_start(rig); commit 8bd19c4db80d22f0a710c487bfe4acc1a15e9179 Author: George Baltz N3GB <Geo...@gm...> Date: Mon Sep 22 04:56:32 2025 -0400 Change pseudo-anonymous structure name to convention. diff --git a/include/hamlib/rig_state.h b/include/hamlib/rig_state.h index 99a9396ea..626807489 100644 --- a/include/hamlib/rig_state.h +++ b/include/hamlib/rig_state.h @@ -46,7 +46,7 @@ __BEGIN_DECLS * * Structures pointed to by rig_state and defined elsewhere */ -struct fifo_rig; /* Defined in src/fifo.h */ +struct FIFO_RIG_s; /* Defined in src/fifo.h */ /** * \brief Rig state containing live data and customized fields. @@ -230,7 +230,7 @@ struct rig_state { int spectrum_attenuator[HAMLIB_MAXDBLSTSIZ]; /*!< Spectrum attenuator list in dB, 0 terminated */ volatile int morse_data_handler_thread_run; /*!< Morse data handler thread flag. */ void *morse_data_handler_priv_data; /*!< Morse data handler private structure. */ - struct fifo_rig *fifo_morse; /*!< FIFO queue for Morse Code transmission. */ + struct FIFO_RIG_s *fifo_morse; /*!< FIFO queue for Morse Code transmission. */ int doppler; /*!< True if doppler changing detected */ char *multicast_data_addr; /*!< Multicast data UDP address for publishing rig data and state */ int multicast_data_port; /*!< Multicast data UDP port for publishing rig data and state */ diff --git a/src/fifo.h b/src/fifo.h index c60d55ced..111dc46c7 100644 --- a/src/fifo.h +++ b/src/fifo.h @@ -31,7 +31,7 @@ __BEGIN_DECLS // FIFO currently used for send_morse queue #define HAMLIB_FIFO_SIZE 1024 -typedef struct fifo_rig +typedef struct FIFO_RIG_s { char data[HAMLIB_FIFO_SIZE]; int head; commit 00020e6d9d1c7c17544fb3ce8f9ec64ae8ad0be4 Author: George Baltz N3GB <Geo...@gm...> Date: Fri Sep 19 17:06:05 2025 -0400 Add 'hl_' prefix to names of push(), pop() and peek() to avoid conflict with app code. Add header to fifo.c Drop unused structure member in rig.c diff --git a/src/fifo.c b/src/fifo.c index 19080e217..b7da0637c 100644 --- a/src/fifo.c +++ b/src/fifo.c @@ -1,3 +1,25 @@ +/* + * Hamlib Interface - FIFO routines + * Copyright (c) 2023-2025 by the Hamlib group + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + #include "hamlib/config.h" #include <stdio.h> @@ -23,7 +45,7 @@ void resetFIFO(FIFO_RIG *fifo) // returns RIG_OK if added // return -RIG error if overflow -int push(FIFO_RIG *fifo, const char *msg) +int hl_push(FIFO_RIG *fifo, const char *msg) { pthread_mutex_lock(&fifo->mutex); int len = strlen(msg); @@ -59,7 +81,7 @@ int push(FIFO_RIG *fifo, const char *msg) return RIG_OK; } -int peek(FIFO_RIG *fifo) +int hl_peek(FIFO_RIG *fifo) { if (fifo == NULL) { return -1; } @@ -87,7 +109,7 @@ int peek(FIFO_RIG *fifo) return c; } -int pop(FIFO_RIG *fifo) +int hl_pop(FIFO_RIG *fifo) { if (fifo->tail == fifo->head) { return -1; } @@ -118,12 +140,12 @@ int main() const char *str = "Hello, World!\n"; // Pushing the string onto the FIFO - push(&fifo, str); + hl_push(&fifo, str); // Popping and printing one character at a time int c; - while ((c = pop(&fifo)) != -1) + while ((c = hl_pop(&fifo)) != -1) { printf("%c", c); } diff --git a/src/fifo.h b/src/fifo.h index 888a77218..c60d55ced 100644 --- a/src/fifo.h +++ b/src/fifo.h @@ -43,9 +43,9 @@ typedef struct fifo_rig /* Function prototypes */ void initFIFO(FIFO_RIG *fifo); void resetFIFO(FIFO_RIG *fifo); -int push(FIFO_RIG *fifo, const char *msg); -int pop(FIFO_RIG *fifo); -int peek(FIFO_RIG *fifo); +int hl_push(FIFO_RIG *fifo, const char *msg); +int hl_pop(FIFO_RIG *fifo); +int hl_peek(FIFO_RIG *fifo); __END_DECLS diff --git a/src/rig.c b/src/rig.c index 684a023f3..a390db1d1 100644 --- a/src/rig.c +++ b/src/rig.c @@ -309,7 +309,6 @@ typedef struct morse_data_handler_priv_data_s { pthread_t thread_id; morse_data_handler_args args; - volatile FIFO_RIG fifo_morse; int keyspd; } morse_data_handler_priv_data; @@ -7532,7 +7531,7 @@ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg) retcode = caps->send_morse(rig, vfo, msg); LOCK(0); #else - retcode = push(rs->fifo_morse, msg); + retcode = hl_push(rs->fifo_morse, msg); #endif RETURNFUNC(retcode); } @@ -8614,7 +8613,7 @@ static int morse_data_handler_stop(RIG *rig) hl_usleep(100 * 1000); //HAMLIB_TRACE; - while (peek(rs->fifo_morse) >= 0) + while (hl_peek(rs->fifo_morse) >= 0) { HAMLIB_TRACE; rig_debug(RIG_DEBUG_TRACE, "%s: waiting for fifo queue to flush\n", __func__); @@ -8771,21 +8770,21 @@ static void *morse_data_handler(void *arg) c = calloc(1, qsize + 1); - while (rs->morse_data_handler_thread_run || (peek(rs->fifo_morse) >= 0)) + while (rs->morse_data_handler_thread_run || (hl_peek(rs->fifo_morse) >= 0)) { int n = 0; memset(c, 0, qsize); for (n = 0; n < qsize; n++) { - int d = peek(rs->fifo_morse); + int d = hl_peek(rs->fifo_morse); if (d < 0) { break; } - d = pop(rs->fifo_morse); + d = hl_pop(rs->fifo_morse); c[n] = (char) d; } commit 22834737075ddbb0a7a36e179a58a8d1439415cf Author: George Baltz N3GB <Geo...@gm...> Date: Thu Sep 18 22:19:00 2025 -0400 Move FIFO_RIG from hamlib/rig.h to fifo.h where it belongs. Add header to fifo.h Update structure pointer in rig_state diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index ec6400b19..bc1e8e73f 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -169,19 +169,6 @@ __BEGIN_DECLS -// FIFO currently used for send_morse queue -#define HAMLIB_FIFO_SIZE 1024 - -typedef struct -{ - char data[HAMLIB_FIFO_SIZE]; - int head; - int tail; - int flush; // flush flag for stop_morse - pthread_mutex_t mutex; -} FIFO_RIG; - - /** * \brief size of cookie request buffer * Minimum size of cookie buffer to pass to rig_cookie diff --git a/include/hamlib/rig_state.h b/include/hamlib/rig_state.h index 5d32089d7..99a9396ea 100644 --- a/include/hamlib/rig_state.h +++ b/include/hamlib/rig_state.h @@ -42,6 +42,12 @@ __BEGIN_DECLS * This file contains the live data structure of the rig (radio). */ +/* Forward declarations + * + * Structures pointed to by rig_state and defined elsewhere + */ +struct fifo_rig; /* Defined in src/fifo.h */ + /** * \brief Rig state containing live data and customized fields. * @@ -222,9 +228,9 @@ struct rig_state { freq_t spectrum_spans[HAMLIB_MAX_SPECTRUM_SPANS]; /*!< Supported spectrum scope frequency spans in Hz in center mode. Last entry must be 0. */ struct rig_spectrum_avg_mode spectrum_avg_modes[HAMLIB_MAX_SPECTRUM_AVG_MODES]; /*!< Supported spectrum scope averaging modes. Last entry must have NULL name. */ int spectrum_attenuator[HAMLIB_MAXDBLSTSIZ]; /*!< Spectrum attenuator list in dB, 0 terminated */ - volatile int morse_data_handler_thread_run; /*!< Morse data handler thread flag. */ - void *morse_data_handler_priv_data; /*!< Morse data handler private structure. */ - FIFO_RIG *fifo_morse; /*!< FIFO queue for Morse Code transmission. */ + volatile int morse_data_handler_thread_run; /*!< Morse data handler thread flag. */ + void *morse_data_handler_priv_data; /*!< Morse data handler private structure. */ + struct fifo_rig *fifo_morse; /*!< FIFO queue for Morse Code transmission. */ int doppler; /*!< True if doppler changing detected */ char *multicast_data_addr; /*!< Multicast data UDP address for publishing rig data and state */ int multicast_data_port; /*!< Multicast data UDP port for publishing rig data and state */ diff --git a/src/fifo.h b/src/fifo.h index 2855a00a6..888a77218 100644 --- a/src/fifo.h +++ b/src/fifo.h @@ -1,5 +1,52 @@ +/* + * Hamlib Interface - FIFO support + * Copyright (c) 2023-2025 by the Hamlib group + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#ifndef _HL_FIFO_H +#define _HL_FIFO_H + +//#include "hamlib/rig.h" +//#include <pthread.h> + +__BEGIN_DECLS + +// FIFO currently used for send_morse queue +#define HAMLIB_FIFO_SIZE 1024 + +typedef struct fifo_rig +{ + char data[HAMLIB_FIFO_SIZE]; + int head; + int tail; + int flush; // flush flag for stop_morse + pthread_mutex_t mutex; +} FIFO_RIG; + +/* Function prototypes */ void initFIFO(FIFO_RIG *fifo); void resetFIFO(FIFO_RIG *fifo); int push(FIFO_RIG *fifo, const char *msg); int pop(FIFO_RIG *fifo); int peek(FIFO_RIG *fifo); + +__END_DECLS + +#endif /* _HL_FIFO_H */ ----------------------------------------------------------------------- Summary of changes: bindings/python/test_Hamlib_class.py | 1 - include/hamlib/rig.h | 13 --------- include/hamlib/rig_state.h | 12 ++++++-- src/fifo.c | 32 ++++++++++++++++++---- src/fifo.h | 53 ++++++++++++++++++++++++++++++++++-- src/misc.c | 15 ++++++++++ src/rig.c | 17 +++++++----- 7 files changed, 111 insertions(+), 32 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |