hamlib-cvs-digest Mailing List for Ham Radio Control Libraries
Library to control radio transceivers and receivers
Brought to you by:
n0nb
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(57) |
Nov
(27) |
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(41) |
Feb
(101) |
Mar
(60) |
Apr
(32) |
May
(32) |
Jun
(198) |
Jul
(95) |
Aug
(60) |
Sep
(48) |
Oct
(96) |
Nov
(27) |
Dec
(222) |
2002 |
Jan
(180) |
Feb
(46) |
Mar
(68) |
Apr
(11) |
May
(36) |
Jun
(34) |
Jul
(113) |
Aug
(42) |
Sep
(71) |
Oct
(65) |
Nov
(116) |
Dec
(40) |
2003 |
Jan
(32) |
Feb
(92) |
Mar
(29) |
Apr
(102) |
May
(21) |
Jun
(34) |
Jul
(3) |
Aug
(60) |
Sep
(30) |
Oct
(62) |
Nov
(57) |
Dec
(33) |
2004 |
Jan
(28) |
Feb
(46) |
Mar
(16) |
Apr
(14) |
May
(31) |
Jun
(21) |
Jul
(10) |
Aug
(80) |
Sep
(42) |
Oct
(11) |
Nov
(28) |
Dec
(13) |
2005 |
Jan
(35) |
Feb
(26) |
Mar
(20) |
Apr
(118) |
May
(2) |
Jun
(5) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(13) |
Dec
(1) |
2006 |
Jan
(9) |
Feb
(25) |
Mar
(22) |
Apr
(6) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(3) |
Oct
(46) |
Nov
(13) |
Dec
(7) |
2007 |
Jan
(9) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(6) |
Jun
(1) |
Jul
|
Aug
(11) |
Sep
(7) |
Oct
(8) |
Nov
(41) |
Dec
(3) |
2008 |
Jan
(27) |
Feb
(16) |
Mar
(13) |
Apr
(23) |
May
(39) |
Jun
(4) |
Jul
(7) |
Aug
(1) |
Sep
(13) |
Oct
(52) |
Nov
(44) |
Dec
(55) |
2009 |
Jan
(72) |
Feb
(69) |
Mar
|
Apr
|
May
|
Jun
(13) |
Jul
(1) |
Aug
(6) |
Sep
(15) |
Oct
(11) |
Nov
(31) |
Dec
(20) |
2010 |
Jan
(24) |
Feb
(21) |
Mar
(22) |
Apr
(40) |
May
(38) |
Jun
(4) |
Jul
(2) |
Aug
(22) |
Sep
(19) |
Oct
(14) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(14) |
Feb
(36) |
Mar
(6) |
Apr
|
May
|
Jun
(23) |
Jul
(13) |
Aug
(8) |
Sep
(7) |
Oct
|
Nov
(3) |
Dec
(9) |
2012 |
Jan
(17) |
Feb
(13) |
Mar
(10) |
Apr
|
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(12) |
Sep
(2) |
Oct
(24) |
Nov
(14) |
Dec
(2) |
2013 |
Jan
(4) |
Feb
(3) |
Mar
(3) |
Apr
(3) |
May
(10) |
Jun
(4) |
Jul
(7) |
Aug
|
Sep
(15) |
Oct
(5) |
Nov
(1) |
Dec
(2) |
2014 |
Jan
|
Feb
(8) |
Mar
(1) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(7) |
Nov
(6) |
Dec
(3) |
2015 |
Jan
(4) |
Feb
(5) |
Mar
(8) |
Apr
(8) |
May
(2) |
Jun
|
Jul
(4) |
Aug
(7) |
Sep
(8) |
Oct
|
Nov
(6) |
Dec
(4) |
2016 |
Jan
(6) |
Feb
(26) |
Mar
(3) |
Apr
(10) |
May
(6) |
Jun
(5) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(4) |
Nov
(3) |
Dec
(10) |
2017 |
Jan
(11) |
Feb
(11) |
Mar
(2) |
Apr
(1) |
May
(7) |
Jun
(2) |
Jul
(11) |
Aug
(9) |
Sep
(5) |
Oct
(5) |
Nov
(1) |
Dec
(2) |
2018 |
Jan
(5) |
Feb
(2) |
Mar
(19) |
Apr
(7) |
May
(11) |
Jun
(3) |
Jul
(4) |
Aug
(10) |
Sep
(2) |
Oct
(8) |
Nov
(6) |
Dec
(9) |
2019 |
Jan
(9) |
Feb
(6) |
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(9) |
Jul
(6) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(8) |
Dec
(9) |
2020 |
Jan
(15) |
Feb
(1) |
Mar
(18) |
Apr
(33) |
May
(43) |
Jun
(87) |
Jul
(45) |
Aug
(8) |
Sep
(43) |
Oct
(3) |
Nov
(5) |
Dec
(42) |
2021 |
Jan
(116) |
Feb
(40) |
Mar
(58) |
Apr
(48) |
May
(29) |
Jun
(2) |
Jul
|
Aug
(22) |
Sep
(18) |
Oct
(1) |
Nov
|
Dec
(3) |
2022 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
(6) |
Nov
(2) |
Dec
(9) |
2023 |
Jan
(10) |
Feb
|
Mar
|
Apr
(10) |
May
(3) |
Jun
(1) |
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(3) |
2024 |
Jan
(4) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(5) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(9) |
2025 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
(10) |
May
(20) |
Jun
(43) |
Jul
(24) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
From: n0nb <n0...@us...> - 2025-08-14 14:05:25
|
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 ee03370cdfe6eee8bdafb0d9bd043567af9f9d75 (commit) via 7549f66aa126fb829e92d59fe2f3feda5f2bf5b6 (commit) via 053178ccbd08f8e0473c61165c997011e97690d6 (commit) via 0e36d4faa48f0f7ee0e48aa81ac63bbc3e7d089a (commit) via 74558224a9d3baf151582d0cfd9b155c8f265423 (commit) via 2e5696b7e32bb9129f4419a5f9659803372d97b4 (commit) from 98f6da8ae325f7383a8b1d2a9026516aa6fcf414 (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 ee03370cdfe6eee8bdafb0d9bd043567af9f9d75 Merge: 98f6da8ae 7549f66aa Author: Nate Bargmann <n0...@n0...> Date: Thu Aug 14 08:11:27 2025 -0500 Merge GitHub PR #1846 commit 7549f66aa126fb829e92d59fe2f3feda5f2bf5b6 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Aug 13 13:06:47 2025 -0400 Replace uthash.h(1.9.4) with latest release(2.3.0) From https://troydhanson.github.io/uthash/ Fixes diagnostics from cppcheck and -fanalyzer diff --git a/tests/uthash.h b/tests/uthash.h index 6724600b1..06c2eebdb 100644 --- a/tests/uthash.h +++ b/tests/uthash.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, Troy D. Hanson http://uthash.sourceforge.net +Copyright (c) 2003-2025, Troy D. Hanson https://troydhanson.github.io/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without @@ -22,162 +22,415 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UTHASH_H -#define UTHASH_H +#define UTHASH_H -#include <string.h> /* memcmp,strlen */ +#define UTHASH_VERSION 2.3.0 + +#include <string.h> /* memcmp, memset, strlen */ #include <stddef.h> /* ptrdiff_t */ -#include <stdlib.h> /* exit() */ +#include <stdlib.h> /* exit */ + +#if defined(HASH_NO_STDINT) && HASH_NO_STDINT +/* The user doesn't have <stdint.h>, and must figure out their own way + to provide definitions for uint8_t and uint32_t. */ +#else +#include <stdint.h> /* uint8_t, uint32_t */ +#endif /* These macros use decltype or the earlier __typeof GNU extension. As decltype is only available in newer compilers (VS2010 or gcc 4.3+ when compiling c++ source) this code uses whatever method is needed or, for VS2008 where neither is available, uses casting workarounds. */ -#ifdef _MSC_VER /* MS compiler */ +#if !defined(DECLTYPE) && !defined(NO_DECLTYPE) +#if defined(_MSC_VER) /* MS compiler */ #if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ #define DECLTYPE(x) (decltype(x)) #else /* VS2008 or older (or VS2010 in C mode) */ #define NO_DECLTYPE -#define DECLTYPE(x) #endif +#elif defined(__MCST__) /* Elbrus C Compiler */ +#define DECLTYPE(x) (__typeof(x)) +#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) +#define NO_DECLTYPE #else /* GNU, Sun and other compilers */ #define DECLTYPE(x) (__typeof(x)) #endif +#endif #ifdef NO_DECLTYPE +#define DECLTYPE(x) #define DECLTYPE_ASSIGN(dst,src) \ do { \ char **_da_dst = (char**)(&(dst)); \ *_da_dst = (char*)(src); \ -} while(0) -#else +} while (0) +#else #define DECLTYPE_ASSIGN(dst,src) \ do { \ (dst) = DECLTYPE(dst)(src); \ -} while(0) +} while (0) #endif -/* a number of the hash function use uint32_t which isn't defined on win32 */ -#ifdef _MSC_VER -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#else -#include <inttypes.h> /* uint32_t */ +#ifndef uthash_malloc +#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ +#endif +#ifndef uthash_free +#define uthash_free(ptr,sz) free(ptr) /* free fcn */ +#endif +#ifndef uthash_bzero +#define uthash_bzero(a,n) memset(a,'\0',n) +#endif +#ifndef uthash_strlen +#define uthash_strlen(s) strlen(s) #endif -#define UTHASH_VERSION 1.9.4 +#ifndef HASH_FUNCTION +#define HASH_FUNCTION(keyptr,keylen,hashv) HASH_JEN(keyptr, keylen, hashv) +#endif -#define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ -#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ -#define uthash_free(ptr,sz) free(ptr) /* free fcn */ +#ifndef HASH_KEYCMP +#define HASH_KEYCMP(a,b,n) memcmp(a,b,n) +#endif +#ifndef uthash_noexpand_fyi #define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ +#endif +#ifndef uthash_expand_fyi #define uthash_expand_fyi(tbl) /* can be defined to log expands */ +#endif + +#ifndef HASH_NONFATAL_OOM +#define HASH_NONFATAL_OOM 0 +#endif + +#if HASH_NONFATAL_OOM +/* malloc failures can be recovered from */ + +#ifndef uthash_nonfatal_oom +#define uthash_nonfatal_oom(obj) do {} while (0) /* non-fatal OOM error */ +#endif + +#define HASH_RECORD_OOM(oomed) do { (oomed) = 1; } while (0) +#define IF_HASH_NONFATAL_OOM(x) x + +#else +/* malloc failures result in lost memory, hash tables are unusable */ + +#ifndef uthash_fatal +#define uthash_fatal(msg) exit(-1) /* fatal OOM error */ +#endif + +#define HASH_RECORD_OOM(oomed) uthash_fatal("out of memory") +#define IF_HASH_NONFATAL_OOM(x) + +#endif /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS 32 /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS_LOG2 5 /* lg2 of initial number of buckets */ -#define HASH_BKT_CAPACITY_THRESH 10 /* expand when bucket count reaches */ +#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ +#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ -/* calculate the element whose hash handle address is hhe */ +/* calculate the element whose hash handle address is hhp */ #define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) +/* calculate the hash handle from element address elp */ +#define HH_FROM_ELMT(tbl,elp) ((UT_hash_handle*)(void*)(((char*)(elp)) + ((tbl)->hho))) + +#define HASH_ROLLBACK_BKT(hh, head, itemptrhh) \ +do { \ + struct UT_hash_handle *_hd_hh_item = (itemptrhh); \ + unsigned _hd_bkt; \ + HASH_TO_BKT(_hd_hh_item->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ + (head)->hh.tbl->buckets[_hd_bkt].count++; \ + _hd_hh_item->hh_next = NULL; \ + _hd_hh_item->hh_prev = NULL; \ +} while (0) + +#define HASH_VALUE(keyptr,keylen,hashv) \ +do { \ + HASH_FUNCTION(keyptr, keylen, hashv); \ +} while (0) + +#define HASH_FIND_BYHASHVALUE(hh,head,keyptr,keylen,hashval,out) \ +do { \ + (out) = NULL; \ + if (head) { \ + unsigned _hf_bkt; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ + if (HASH_BLOOM_TEST((head)->hh.tbl, hashval)) { \ + HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \ + } \ + } \ +} while (0) #define HASH_FIND(hh,head,keyptr,keylen,out) \ do { \ - unsigned _hf_bkt,_hf_hashv; \ - out=NULL; \ + (out) = NULL; \ if (head) { \ - HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \ - if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \ - HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \ - keyptr,keylen,out); \ - } \ + unsigned _hf_hashv; \ + HASH_VALUE(keyptr, keylen, _hf_hashv); \ + HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \ } \ } while (0) #ifdef HASH_BLOOM -#define HASH_BLOOM_BITLEN (1ULL << HASH_BLOOM) -#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8) + ((HASH_BLOOM_BITLEN%8) ? 1:0) -#define HASH_BLOOM_MAKE(tbl) \ +#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) +#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) +#define HASH_BLOOM_MAKE(tbl,oomed) \ do { \ (tbl)->bloom_nbits = HASH_BLOOM; \ (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ - if (!((tbl)->bloom_bv)) { uthash_fatal( "out of memory"); } \ - memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ - (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ -} while (0); + if (!(tbl)->bloom_bv) { \ + HASH_RECORD_OOM(oomed); \ + } else { \ + uthash_bzero((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ + (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ + } \ +} while (0) #define HASH_BLOOM_FREE(tbl) \ do { \ uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ -} while (0); +} while (0) -#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8] |= (1U << ((idx)%8))) -#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8] & (1U << ((idx)%8))) +#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) +#define HASH_BLOOM_BITTEST(bv,idx) ((bv[(idx)/8U] & (1U << ((idx)%8U))) != 0) #define HASH_BLOOM_ADD(tbl,hashv) \ - HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) + HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) #define HASH_BLOOM_TEST(tbl,hashv) \ - HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) + HASH_BLOOM_BITTEST((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) #else -#define HASH_BLOOM_MAKE(tbl) -#define HASH_BLOOM_FREE(tbl) -#define HASH_BLOOM_ADD(tbl,hashv) -#define HASH_BLOOM_TEST(tbl,hashv) (1) +#define HASH_BLOOM_MAKE(tbl,oomed) +#define HASH_BLOOM_FREE(tbl) +#define HASH_BLOOM_ADD(tbl,hashv) +#define HASH_BLOOM_TEST(tbl,hashv) 1 +#define HASH_BLOOM_BYTELEN 0U #endif -#define HASH_MAKE_TABLE(hh,head) \ -do { \ - (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \ - sizeof(UT_hash_table)); \ - if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \ - memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ - (head)->hh.tbl->tail = &((head)->hh); \ - (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ - (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ - (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ - (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ - HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ - if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \ - memset((head)->hh.tbl->buckets, 0, \ - HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_MAKE((head)->hh.tbl); \ - (head)->hh.tbl->signature = HASH_SIGNATURE; \ -} while(0) +#define HASH_MAKE_TABLE(hh,head,oomed) \ +do { \ + (head)->hh.tbl = (UT_hash_table*)uthash_malloc(sizeof(UT_hash_table)); \ + if (!(head)->hh.tbl) { \ + HASH_RECORD_OOM(oomed); \ + } else { \ + uthash_bzero((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head)->hh.tbl->tail = &((head)->hh); \ + (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ + (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ + (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ + (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ + HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ + (head)->hh.tbl->signature = HASH_SIGNATURE; \ + if (!(head)->hh.tbl->buckets) { \ + HASH_RECORD_OOM(oomed); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + } else { \ + uthash_bzero((head)->hh.tbl->buckets, \ + HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ + HASH_BLOOM_MAKE((head)->hh.tbl, oomed); \ + IF_HASH_NONFATAL_OOM( \ + if (oomed) { \ + uthash_free((head)->hh.tbl->buckets, \ + HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + } \ + ) \ + } \ + } \ +} while (0) + +#define HASH_REPLACE_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,replaced,cmpfcn) \ +do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \ +} while (0) + +#define HASH_REPLACE_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,replaced) \ +do { \ + (replaced) = NULL; \ + HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ + if (replaced) { \ + HASH_DELETE(hh, head, replaced); \ + } \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \ +} while (0) + +#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ +do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \ +} while (0) + +#define HASH_REPLACE_INORDER(hh,head,fieldname,keylen_in,add,replaced,cmpfcn) \ +do { \ + unsigned _hr_hashv; \ + HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ + HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \ +} while (0) + +#define HASH_APPEND_LIST(hh, head, add) \ +do { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ + (head)->hh.tbl->tail->next = (add); \ + (head)->hh.tbl->tail = &((add)->hh); \ +} while (0) + +#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ +do { \ + do { \ + if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) { \ + break; \ + } \ + } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ +} while (0) + +#ifdef NO_DECLTYPE +#undef HASH_AKBI_INNER_LOOP +#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ +do { \ + char *_hs_saved_head = (char*)(head); \ + do { \ + DECLTYPE_ASSIGN(head, _hs_iter); \ + if (cmpfcn(head, add) > 0) { \ + DECLTYPE_ASSIGN(head, _hs_saved_head); \ + break; \ + } \ + DECLTYPE_ASSIGN(head, _hs_saved_head); \ + } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ +} while (0) +#endif + +#if HASH_NONFATAL_OOM + +#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ +do { \ + if (!(oomed)) { \ + unsigned _ha_bkt; \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ + if (oomed) { \ + HASH_ROLLBACK_BKT(hh, head, &(add)->hh); \ + HASH_DELETE_HH(hh, head, &(add)->hh); \ + (add)->hh.tbl = NULL; \ + uthash_nonfatal_oom(add); \ + } else { \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ + } \ + } else { \ + (add)->hh.tbl = NULL; \ + uthash_nonfatal_oom(add); \ + } \ +} while (0) + +#else + +#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ +do { \ + unsigned _ha_bkt; \ + (head)->hh.tbl->num_items++; \ + HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ + HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ + HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ + HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ +} while (0) + +#endif + + +#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh,head,keyptr,keylen_in,hashval,add,cmpfcn) \ +do { \ + IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (char*) (keyptr); \ + (add)->hh.keylen = (unsigned) (keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + HASH_MAKE_TABLE(hh, add, _ha_oomed); \ + IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ + (head) = (add); \ + IF_HASH_NONFATAL_OOM( } ) \ + } else { \ + void *_hs_iter = (head); \ + (add)->hh.tbl = (head)->hh.tbl; \ + HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn); \ + if (_hs_iter) { \ + (add)->hh.next = _hs_iter; \ + if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \ + HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \ + } else { \ + (head) = (add); \ + } \ + HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \ + } else { \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + } \ + HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ + HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE_INORDER"); \ +} while (0) + +#define HASH_ADD_KEYPTR_INORDER(hh,head,keyptr,keylen_in,add,cmpfcn) \ +do { \ + unsigned _hs_hashv; \ + HASH_VALUE(keyptr, keylen_in, _hs_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \ +} while (0) + +#define HASH_ADD_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,cmpfcn) \ + HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn) + +#define HASH_ADD_INORDER(hh,head,fieldname,keylen_in,add,cmpfcn) \ + HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn) + +#define HASH_ADD_KEYPTR_BYHASHVALUE(hh,head,keyptr,keylen_in,hashval,add) \ +do { \ + IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ + (add)->hh.hashv = (hashval); \ + (add)->hh.key = (const void*) (keyptr); \ + (add)->hh.keylen = (unsigned) (keylen_in); \ + if (!(head)) { \ + (add)->hh.next = NULL; \ + (add)->hh.prev = NULL; \ + HASH_MAKE_TABLE(hh, add, _ha_oomed); \ + IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ + (head) = (add); \ + IF_HASH_NONFATAL_OOM( } ) \ + } else { \ + (add)->hh.tbl = (head)->hh.tbl; \ + HASH_APPEND_LIST(hh, head, add); \ + } \ + HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ + HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE"); \ +} while (0) -#define HASH_ADD(hh,head,fieldname,keylen_in,add) \ - HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add) - #define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ do { \ - unsigned _ha_bkt; \ - (add)->hh.next = NULL; \ - (add)->hh.key = (char*)keyptr; \ - (add)->hh.keylen = keylen_in; \ - if (!(head)) { \ - head = (add); \ - (head)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh,head); \ - } else { \ - (head)->hh.tbl->tail->next = (add); \ - (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ - (head)->hh.tbl->tail = &((add)->hh); \ - } \ - (head)->hh.tbl->num_items++; \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \ - (add)->hh.hashv, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \ - HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \ - HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \ - HASH_FSCK(hh,head); \ -} while(0) - -#define HASH_TO_BKT( hashv, num_bkts, bkt ) \ -do { \ - bkt = ((hashv) & ((num_bkts) - 1)); \ -} while(0) + unsigned _ha_hashv; \ + HASH_VALUE(keyptr, keylen_in, _ha_hashv); \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \ +} while (0) + +#define HASH_ADD_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add) \ + HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add) + +#define HASH_ADD(hh,head,fieldname,keylen_in,add) \ + HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add) + +#define HASH_TO_BKT(hashv,num_bkts,bkt) \ +do { \ + bkt = ((hashv) & ((num_bkts) - 1U)); \ +} while (0) /* delete "delptr" from the hash table. * "the usual" patch-up process for the app-order doubly-linked-list. @@ -192,54 +445,65 @@ do { * scratch pointer rather than through the repointed (users) symbol. */ #define HASH_DELETE(hh,head,delptr) \ + HASH_DELETE_HH(hh, head, &(delptr)->hh) + +#define HASH_DELETE_HH(hh,head,delptrhh) \ do { \ - struct UT_hash_handle *_hd_hh_del; \ - if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - head = NULL; \ + const struct UT_hash_handle *_hd_hh_del = (delptrhh); \ + if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \ + HASH_BLOOM_FREE((head)->hh.tbl); \ + uthash_free((head)->hh.tbl->buckets, \ + (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ + uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ + (head) = NULL; \ + } else { \ + unsigned _hd_bkt; \ + if (_hd_hh_del == (head)->hh.tbl->tail) { \ + (head)->hh.tbl->tail = HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev); \ + } \ + if (_hd_hh_del->prev != NULL) { \ + HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev)->next = _hd_hh_del->next; \ } else { \ - unsigned _hd_bkt; \ - _hd_hh_del = &((delptr)->hh); \ - if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \ - (head)->hh.tbl->tail = \ - (UT_hash_handle*)((char*)((delptr)->hh.prev) + \ - (head)->hh.tbl->hho); \ - } \ - if ((delptr)->hh.prev) { \ - ((UT_hash_handle*)((char*)((delptr)->hh.prev) + \ - (head)->hh.tbl->hho))->next = (delptr)->hh.next; \ - } else { \ - DECLTYPE_ASSIGN(head,(delptr)->hh.next); \ - } \ - if (_hd_hh_del->next) { \ - ((UT_hash_handle*)((char*)_hd_hh_del->next + \ - (head)->hh.tbl->hho))->prev = \ - _hd_hh_del->prev; \ - } \ - HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ - (head)->hh.tbl->num_items--; \ + DECLTYPE_ASSIGN(head, _hd_hh_del->next); \ } \ - HASH_FSCK(hh,head); \ + if (_hd_hh_del->next != NULL) { \ + HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->next)->prev = _hd_hh_del->prev; \ + } \ + HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ + HASH_DEL_IN_BKT((head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ + (head)->hh.tbl->num_items--; \ + } \ + HASH_FSCK(hh, head, "HASH_DELETE_HH"); \ } while (0) - /* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ #define HASH_FIND_STR(head,findstr,out) \ - HASH_FIND(hh,head,findstr,strlen(findstr),out) +do { \ + unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(findstr); \ + HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \ +} while (0) #define HASH_ADD_STR(head,strfield,add) \ - HASH_ADD(hh,head,strfield,strlen(add->strfield),add) +do { \ + unsigned _uthash_hastr_keylen = (unsigned)uthash_strlen((add)->strfield); \ + HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \ +} while (0) +#define HASH_REPLACE_STR(head,strfield,add,replaced) \ +do { \ + unsigned _uthash_hrstr_keylen = (unsigned)uthash_strlen((add)->strfield); \ + HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \ +} while (0) #define HASH_FIND_INT(head,findint,out) \ HASH_FIND(hh,head,findint,sizeof(int),out) #define HASH_ADD_INT(head,intfield,add) \ HASH_ADD(hh,head,intfield,sizeof(int),add) +#define HASH_REPLACE_INT(head,intfield,add,replaced) \ + HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) #define HASH_FIND_PTR(head,findptr,out) \ HASH_FIND(hh,head,findptr,sizeof(void *),out) #define HASH_ADD_PTR(head,ptrfield,add) \ HASH_ADD(hh,head,ptrfield,sizeof(void *),add) +#define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ + HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced) #define HASH_DEL(head,delptr) \ HASH_DELETE(hh,head,delptr) @@ -247,120 +511,115 @@ do { * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. */ #ifdef HASH_DEBUG -#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) -#define HASH_FSCK(hh,head) \ +#include <stdio.h> /* fprintf, stderr */ +#define HASH_OOPS(...) do { fprintf(stderr, __VA_ARGS__); exit(-1); } while (0) +#define HASH_FSCK(hh,head,where) \ do { \ + struct UT_hash_handle *_thh; \ + if (head) { \ unsigned _bkt_i; \ - unsigned _count, _bkt_count; \ + unsigned _count = 0; \ char *_prev; \ - struct UT_hash_handle *_thh; \ - if (head) { \ - _count = 0; \ - for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ - _bkt_count = 0; \ - _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ - _prev = NULL; \ - while (_thh) { \ - if (_prev != (char*)(_thh->hh_prev)) { \ - HASH_OOPS("invalid hh_prev %p, actual %p\n", \ - _thh->hh_prev, _prev ); \ - } \ - _bkt_count++; \ - _prev = (char*)(_thh); \ - _thh = _thh->hh_next; \ - } \ - _count += _bkt_count; \ - if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ - HASH_OOPS("invalid bucket count %u, actual %u\n", \ - (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ - } \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("invalid hh item count %u, actual %u\n", \ - (head)->hh.tbl->num_items, _count ); \ - } \ - /* traverse hh in app order; check next/prev integrity, count */ \ - _count = 0; \ - _prev = NULL; \ - _thh = &(head)->hh; \ - while (_thh) { \ - _count++; \ - if (_prev !=(char*)(_thh->prev)) { \ - HASH_OOPS("invalid prev %p, actual %p\n", \ - _thh->prev, _prev ); \ - } \ - _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ - _thh = ( _thh->next ? (UT_hash_handle*)((char*)(_thh->next) + \ - (head)->hh.tbl->hho) : NULL ); \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("invalid app item count %u, actual %u\n", \ - (head)->hh.tbl->num_items, _count ); \ + for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; ++_bkt_i) { \ + unsigned _bkt_count = 0; \ + _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ + _prev = NULL; \ + while (_thh) { \ + if (_prev != (char*)(_thh->hh_prev)) { \ + HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", \ + (where), (void*)_thh->hh_prev, (void*)_prev); \ } \ + _bkt_count++; \ + _prev = (char*)(_thh); \ + _thh = _thh->hh_next; \ + } \ + _count += _bkt_count; \ + if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ + HASH_OOPS("%s: invalid bucket count %u, actual %u\n", \ + (where), (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ + } \ } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("%s: invalid hh item count %u, actual %u\n", \ + (where), (head)->hh.tbl->num_items, _count); \ + } \ + _count = 0; \ + _prev = NULL; \ + _thh = &(head)->hh; \ + while (_thh) { \ + _count++; \ + if (_prev != (char*)_thh->prev) { \ + HASH_OOPS("%s: invalid prev %p, actual %p\n", \ + (where), (void*)_thh->prev, (void*)_prev); \ + } \ + _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ + _thh = (_thh->next ? HH_FROM_ELMT((head)->hh.tbl, _thh->next) : NULL); \ + } \ + if (_count != (head)->hh.tbl->num_items) { \ + HASH_OOPS("%s: invalid app item count %u, actual %u\n", \ + (where), (head)->hh.tbl->num_items, _count); \ + } \ + } \ } while (0) #else -#define HASH_FSCK(hh,head) +#define HASH_FSCK(hh,head,where) #endif -/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to +/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to * the descriptor to which this macro is defined for tuning the hash function. * The app can #include <unistd.h> to get the prototype for write(2). */ #ifdef HASH_EMIT_KEYS #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ do { \ - unsigned _klen = fieldlen; \ - write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ - write(HASH_EMIT_KEYS, keyptr, fieldlen); \ + unsigned _klen = fieldlen; \ + write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ + write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ } while (0) -#else -#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) -#endif - -/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ -#ifdef HASH_FUNCTION -#define HASH_FCN HASH_FUNCTION #else -#define HASH_FCN HASH_JEN +#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) #endif -/* The Bernstein hash function, used in Perl prior to v5.6 */ -#define HASH_BER(key,keylen,num_bkts,hashv,bkt) \ +/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ +#define HASH_BER(key,keylen,hashv) \ do { \ - unsigned _hb_keylen=keylen; \ - char *_hb_key=(char*)(key); \ + unsigned _hb_keylen = (unsigned)keylen; \ + const unsigned char *_hb_key = (const unsigned char*)(key); \ (hashv) = 0; \ - while (_hb_keylen--) { (hashv) = ((hashv) * 33) + *_hb_key++; } \ - bkt = (hashv) & (num_bkts-1); \ + while (_hb_keylen-- != 0U) { \ + (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ + } \ } while (0) -/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at - * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ -#define HASH_SAX(key,keylen,num_bkts,hashv,bkt) \ +/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at + * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx + * (archive link: https://archive.is/Ivcan ) + */ +#define HASH_SAX(key,keylen,hashv) \ do { \ unsigned _sx_i; \ - char *_hs_key=(char*)(key); \ + const unsigned char *_hs_key = (const unsigned char*)(key); \ hashv = 0; \ - for(_sx_i=0; _sx_i < keylen; _sx_i++) \ - hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ - bkt = hashv & (num_bkts-1); \ + for (_sx_i=0; _sx_i < keylen; _sx_i++) { \ + hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ + } \ } while (0) - -#define HASH_FNV(key,keylen,num_bkts,hashv,bkt) \ +/* FNV-1a variation */ +#define HASH_FNV(key,keylen,hashv) \ do { \ unsigned _fn_i; \ - char *_hf_key=(char*)(key); \ - hashv = 2166136261UL; \ - for(_fn_i=0; _fn_i < keylen; _fn_i++) \ - hashv = (hashv * 16777619) ^ _hf_key[_fn_i]; \ - bkt = hashv & (num_bkts-1); \ -} while(0); - -#define HASH_OAT(key,keylen,num_bkts,hashv,bkt) \ + const unsigned char *_hf_key = (const unsigned char*)(key); \ + (hashv) = 2166136261U; \ + for (_fn_i=0; _fn_i < keylen; _fn_i++) { \ + hashv = hashv ^ _hf_key[_fn_i]; \ + hashv = hashv * 16777619U; \ + } \ +} while (0) + +#define HASH_OAT(key,keylen,hashv) \ do { \ unsigned _ho_i; \ - char *_ho_key=(char*)(key); \ + const unsigned char *_ho_key=(const unsigned char*)(key); \ hashv = 0; \ for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ hashv += _ho_key[_ho_i]; \ @@ -370,8 +629,7 @@ do { hashv += (hashv << 3); \ hashv ^= (hashv >> 11); \ hashv += (hashv << 15); \ - bkt = hashv & (num_bkts-1); \ -} while(0) +} while (0) #define HASH_JEN_MIX(a,b,c) \ do { \ @@ -386,14 +644,14 @@ do { c -= a; c -= b; c ^= ( b >> 15 ); \ } while (0) -#define HASH_JEN(key,keylen,num_bkts,hashv,bkt) \ +#define HASH_JEN(key,keylen,hashv) \ do { \ unsigned _hj_i,_hj_j,_hj_k; \ - char *_hj_key=(char*)(key); \ - hashv = 0xfeedbeef; \ - _hj_i = _hj_j = 0x9e3779b9; \ - _hj_k = keylen; \ - while (_hj_k >= 12) { \ + unsigned const char *_hj_key=(unsigned const char*)(key); \ + hashv = 0xfeedbeefu; \ + _hj_i = _hj_j = 0x9e3779b9u; \ + _hj_k = (unsigned)(keylen); \ + while (_hj_k >= 12U) { \ _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ + ( (unsigned)_hj_key[2] << 16 ) \ + ( (unsigned)_hj_key[3] << 24 ) ); \ @@ -407,35 +665,25 @@ do { HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ \ _hj_key += 12; \ - _hj_k -= 12; \ + _hj_k -= 12U; \ } \ - hashv += keylen; \ + hashv += (unsigned)(keylen); \ switch ( _hj_k ) { \ - case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); \ - HL_FALLTHROUGH \ - case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); \ - HL_FALLTHROUGH \ - case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); \ - HL_FALLTHROUGH \ - case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); \ - HL_FALLTHROUGH \ - case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); \ - HL_FALLTHROUGH \ - case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); \ - HL_FALLTHROUGH \ - case 5: _hj_j += _hj_key[4]; \ - HL_FALLTHROUGH \ - case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); \ - HL_FALLTHROUGH \ - case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); \ - HL_FALLTHROUGH \ - case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); \ - HL_FALLTHROUGH \ - case 1: _hj_i += _hj_key[0]; \ + case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \ + case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \ + case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \ + case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \ + case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \ + case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \ + case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ + case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \ + case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \ + case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \ + case 1: _hj_i += _hj_key[0]; /* FALLTHROUGH */ \ + default: ; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ - bkt = hashv & (num_bkts-1); \ -} while(0) +} while (0) /* The Paul Hsieh hash function */ #undef get16bits @@ -448,21 +696,21 @@ do { #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ +(uint32_t)(((const uint8_t *)(d))[0]) ) #endif -#define HASH_SFH(key,keylen,num_bkts,hashv,bkt) \ +#define HASH_SFH(key,keylen,hashv) \ do { \ - char *_sfh_key=(char*)(key); \ - uint32_t _sfh_tmp, _sfh_len = keylen; \ + unsigned const char *_sfh_key=(unsigned const char*)(key); \ + uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ \ - int _sfh_rem = _sfh_len & 3; \ + unsigned _sfh_rem = _sfh_len & 3U; \ _sfh_len >>= 2; \ - hashv = 0xcafebabe; \ + hashv = 0xcafebabeu... [truncated message content] |
From: n0nb <n0...@us...> - 2025-08-14 13:06:59
|
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, Hamlib-4.6.3 has been updated via 02363078fc379b6772a9593954585f27a3518093 (commit) via 2de29624a0ad1a662c63fac3b6aa6733ce2da62f (commit) via 1b70351bf7892e34bc56b7ad1ea1b1d7ddfa4cf1 (commit) from 8aca7436b539406bf9df1f7543a606c73227865b (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 02363078fc379b6772a9593954585f27a3518093 Author: Nate Bargmann <n0...@n0...> Date: Thu Aug 14 08:05:32 2025 -0500 Update Segfault-award for rigctl fix Thanks, Daniele. diff --git a/Segfault-award b/Segfault-award index 69234e7f6..2081711a8 100644 --- a/Segfault-award +++ b/Segfault-award @@ -7,6 +7,8 @@ A developer cannot apply for HSHR for segfaults on his/her own code. Here is the list of the brave fellows: +* Daniele Forsi, IU5HKX, v4.6.4, Fix segfault with set_parm KEYERTYPE. + * Daniele Forsi, IU5HKX, v4.6.4, Improper indexing in netrigctl_open(). * Christoph Berg DF7CB python with Hamlib.rig_parse(None) commit 2de29624a0ad1a662c63fac3b6aa6733ce2da62f Author: Nate Bargmann <n0...@n0...> Date: Thu Aug 14 08:04:20 2025 -0500 Update NEWS with seg fault fix in rigctl diff --git a/NEWS b/NEWS index 7f207bc23..65adb642d 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ Version 4.6.5 * Update Kenwood CW buffer max message size, fix one byte buffer overrun in icom.c. (TNX George Baltz). * Fix Segmentation Fault in rigs/dummy/netrigctl.c. (TNX Daniele Forsi) + * Fix segfault with set_parm KEYERTYPE in rigctl_parse.c. (TNX Daniele + Forsi) Version 4.6.4 * 2025-07-18--Hamlib's 25th birthday!!! commit 1b70351bf7892e34bc56b7ad1ea1b1d7ddfa4cf1 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 14:25:54 2025 +0200 Fix segfault with set_parm KEYERTYPE Steps to reproduce: tests/rigctl -m 1 \ set_parm KEYERTYPE BUG Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 warning: 142 ../sysdeps/x86_64/multiarch/strlen-sse2.S: File o directory non esistente (gdb) bt #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 #1 0x00007ffac346e300 in __printf_buffer (buf=buf@entry=0x7ffc3bcf40d0, format=0x7ffac38aef17 "%s", ap=0x7ffc3bcf4190, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435 #2 0x00007ffac3491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc3bcf4190, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96 #3 0x00007ffac3469642 in __GI___snprintf (s=s@entry=0x7ffc3bcf4290 "", maxlen=maxlen@entry=32, format=format@entry=0x7ffac38aef17 "%s") at ./stdio-common/snprintf.c:31 #4 0x00007ffac370b7b9 in dummy_set_parm (rig=0x558fe1991b20, parm=2048, val=...) at dummy.c:1704 #5 0x0000558fb536afbe in rigctl_set_parm (rig=0x558fe1991b20, fout=0x7ffac35f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x558fb5388000 <test_list+1440>, vfo=536870912, arg1=0x7ffc3bcf4e10 "KEYERTYPE", arg2=0x558fb537fdb1 "1", arg3=0x558fb537ece8 "") at rigctl_parse.c:3829 #6 0x0000558fb53727d6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc3bcf6fd8, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #7 0x0000558fb535cadc in main (argc=<optimized out>, argv=0x7ffc3bcf6fd8) at rigctl.c:801 (cherry picked from commit 12ba55834370d0b314079f6a67983c11bb26a3b9) diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index f67d7d179..79475a8ac 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3794,11 +3794,13 @@ declare_proto_rig(set_parm) } else if (RIG_PARM_IS_STRING(parm)) { +#if 0 if (parm == RIG_PARM_KEYERTYPE) { val.i = atoi(arg2); } else +#endif { val.cs = arg2; } ----------------------------------------------------------------------- Summary of changes: NEWS | 2 ++ Segfault-award | 2 ++ tests/rigctl_parse.c | 2 ++ 3 files changed, 6 insertions(+) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-14 13:00:28
|
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 98f6da8ae325f7383a8b1d2a9026516aa6fcf414 (commit) via 2f2b703ccf9417ca07b7f1e54603514f89ebea31 (commit) via b5b9e136a14138a33c79f782b01e9e586dbc22ea (commit) via fb4d2c6455d6cbc6b832f9bbc9365bc691e137e3 (commit) via 301391211102efba2e01ecb5fbdd059a2a00071c (commit) via 12ba55834370d0b314079f6a67983c11bb26a3b9 (commit) via a81aab6e116ba34fb20aaf01ae06edbe725d9bff (commit) via 762caa85c0eb094f0b311aaba74fe686b5e1970c (commit) via ff5500b2d933195344cb458e689d26c58a7a5f32 (commit) from 4b6b5415f546a7dd0ffa3aaff09c7275449adbc5 (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 98f6da8ae325f7383a8b1d2a9026516aa6fcf414 Merge: 4b6b5415f 2f2b703cc Author: Nate Bargmann <n0...@n0...> Date: Wed Aug 13 20:43:09 2025 -0500 Merge GitHub PR #1845 commit 2f2b703ccf9417ca07b7f1e54603514f89ebea31 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 22:02:59 2025 +0200 Handle the question mark as second argument of set_parm KEYERTYPE in rigctl Test case: tests/rigctl -m 1 \ set_parm KEYERTYPE '?' \ set_parm BANDSELECT '?' STRAIGHT BUG PADDLE BANDUNUSED BAND70CM BAND33CM BAND23CM diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 8503317e6..711dd7502 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3719,11 +3719,10 @@ declare_proto_rig(set_parm) parm = rig_parse_parm(arg1); - if (parm == RIG_PARM_BANDSELECT && !strcmp(arg2, "?")) + if ((parm == RIG_PARM_BANDSELECT || parm == RIG_PARM_KEYERTYPE) && !strcmp(arg2, "?")) { char s[SPRINTF_MAX_SIZE]; - rig_sprintf_parm_gran(s, sizeof(s) - 1, RIG_PARM_BANDSELECT, - rig->caps->parm_gran); + rig_sprintf_parm_gran(s, sizeof(s) - 1, parm, rig->caps->parm_gran); char *p = strchr(s, ')'); if (p) { *p = 0; } commit b5b9e136a14138a33c79f782b01e9e586dbc22ea Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 17:27:06 2025 +0200 Do not use strcmp() when we are going to get a RIG_PARM_* define anyway diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 2fef0aadc..8503317e6 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3717,7 +3717,9 @@ declare_proto_rig(set_parm) RETURNFUNC2(RIG_OK); } - if (strcmp(arg1, "BANDSELECT") == 0 && !strcmp(arg2, "?")) + parm = rig_parse_parm(arg1); + + if (parm == RIG_PARM_BANDSELECT && !strcmp(arg2, "?")) { char s[SPRINTF_MAX_SIZE]; rig_sprintf_parm_gran(s, sizeof(s) - 1, RIG_PARM_BANDSELECT, @@ -3740,7 +3742,7 @@ declare_proto_rig(set_parm) else { RETURNFUNC2(-RIG_EINTERNAL); } } - if (strcmp(arg1, "KEYERTYPE") == 0 && strcmp(arg2, "?") != 0) + if (parm == RIG_PARM_KEYERTYPE && strcmp(arg2, "?") != 0) { if (strcmp(arg2, "STRAIGHT") == 0) {arg2 = "0";} else if (strcmp(arg2, "BUG") == 0) {arg2 = "1";} @@ -3748,8 +3750,6 @@ declare_proto_rig(set_parm) else {RETURNFUNC2(-RIG_EINVAL)} } - parm = rig_parse_parm(arg1); - if (!rig_has_set_parm(rig, parm)) { const struct confparams *cfp; commit fb4d2c6455d6cbc6b832f9bbc9365bc691e137e3 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 16:43:32 2025 +0200 Fix segfault when using the dummy driver Steps to reproduce: tests/rigctl -m 1 \ get_parm KEYERTYPE Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. 0x0000556aff4f890d in rigctl_get_parm (rig=<optimized out>, fout=0x7f87517f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=1, prompt=1, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x556aff516050 <test_list+1520>, vfo=536870912, arg1=0x7ffc5985b5c0 "KEYERTYPE", arg2=0x556aff50cce8 "", arg3=0x556aff50cce8 "") at rigctl_parse.c:3947 3947 if (strcmp(val.s, "0") == 0) {s = "STRAIGHT";} (gdb) bt #0 0x0000556aff4f890d in rigctl_get_parm (rig=<optimized out>, fout=0x7f87517f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=1, prompt=1, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x556aff516050 <test_list+1520>, vfo=536870912, arg1=0x7ffc5985b5c0 "KEYERTYPE", arg2=0x556aff50cce8 "", arg3=0x556aff50cce8 "") at rigctl_parse.c:3947 #1 0x0000556aff5007f6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc5985d788, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #2 0x0000556aff4eaadc in main (argc=<optimized out>, argv=0x7ffc5985d788) at rigctl.c:801 diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 509031227..2fef0aadc 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3944,7 +3944,8 @@ declare_proto_rig(get_parm) { const char *cs; - if (strcmp(val.cs, "0") == 0) {cs = "STRAIGHT";} + if (val.cs == NULL) {cs = "(null)";} + else if (strcmp(val.cs, "0") == 0) {cs = "STRAIGHT";} else if (strcmp(val.cs, "1") == 0) {cs = "BUG";} else if (strcmp(val.cs, "2") == 0) {cs = "PADDLE";} else {cs = "UNKNOWN";} commit 301391211102efba2e01ecb5fbdd059a2a00071c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 16:21:57 2025 +0200 Make get_param read back the value passed to set_param Test case: tests/rigctl -m 1 \ set_parm KEYERTYPE BUG get_parm KEYERTYPE \ set_parm KEYERTYPE PADDLE get_parm KEYERTYPE \ set_parm KEYERTYPE STRAIGHT get_parm KEYERTYPE BUG PADDLE STRAIGHT diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 4bcb0b9d9..509031227 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3942,12 +3942,14 @@ declare_proto_rig(get_parm) if (parm == RIG_PARM_KEYERTYPE) { - char *s = "STRAIGHT"; + const char *cs; - if (val.i == 1) { s = "BUG"; } - else if (val.i == 2) { s = "PADDLE"; } + if (strcmp(val.cs, "0") == 0) {cs = "STRAIGHT";} + else if (strcmp(val.cs, "1") == 0) {cs = "BUG";} + else if (strcmp(val.cs, "2") == 0) {cs = "PADDLE";} + else {cs = "UNKNOWN";} - fprintf(fout, "%s%c", s, resp_sep); + fprintf(fout, "%s%c", cs, resp_sep); } else if (RIG_PARM_IS_FLOAT(parm)) { commit 12ba55834370d0b314079f6a67983c11bb26a3b9 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 14:25:54 2025 +0200 Fix segfault with set_parm KEYERTYPE Steps to reproduce: tests/rigctl -m 1 \ set_parm KEYERTYPE BUG Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 warning: 142 ../sysdeps/x86_64/multiarch/strlen-sse2.S: File o directory non esistente (gdb) bt #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 #1 0x00007ffac346e300 in __printf_buffer (buf=buf@entry=0x7ffc3bcf40d0, format=0x7ffac38aef17 "%s", ap=0x7ffc3bcf4190, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435 #2 0x00007ffac3491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc3bcf4190, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96 #3 0x00007ffac3469642 in __GI___snprintf (s=s@entry=0x7ffc3bcf4290 "", maxlen=maxlen@entry=32, format=format@entry=0x7ffac38aef17 "%s") at ./stdio-common/snprintf.c:31 #4 0x00007ffac370b7b9 in dummy_set_parm (rig=0x558fe1991b20, parm=2048, val=...) at dummy.c:1704 #5 0x0000558fb536afbe in rigctl_set_parm (rig=0x558fe1991b20, fout=0x7ffac35f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x558fb5388000 <test_list+1440>, vfo=536870912, arg1=0x7ffc3bcf4e10 "KEYERTYPE", arg2=0x558fb537fdb1 "1", arg3=0x558fb537ece8 "") at rigctl_parse.c:3829 #6 0x0000558fb53727d6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc3bcf6fd8, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #7 0x0000558fb535cadc in main (argc=<optimized out>, argv=0x7ffc3bcf6fd8) at rigctl.c:801 diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 849bc23ad..4bcb0b9d9 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3812,11 +3812,13 @@ declare_proto_rig(set_parm) } else if (RIG_PARM_IS_STRING(parm)) { +#if 0 if (parm == RIG_PARM_KEYERTYPE) { val.i = atoi(arg2); } else +#endif { val.cs = arg2; } commit a81aab6e116ba34fb20aaf01ae06edbe725d9bff Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 14:20:14 2025 +0200 Return an error if the keyer type is unknown Instead of quietly doing nothing. diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 75c1c1bea..849bc23ad 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3745,6 +3745,7 @@ declare_proto_rig(set_parm) if (strcmp(arg2, "STRAIGHT") == 0) {arg2 = "0";} else if (strcmp(arg2, "BUG") == 0) {arg2 = "1";} else if (strcmp(arg2, "PADDLE") == 0) {arg2 = "2";} + else {RETURNFUNC2(-RIG_EINVAL)} } parm = rig_parse_parm(arg1); commit 762caa85c0eb094f0b311aaba74fe686b5e1970c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 12:54:58 2025 +0200 Remove stray char after printing value of KEYERTYPE Steps to reproduce: tests/rigctl -m 1 get_parm KEYERTYPE STRAIGHT v <-- this 'v' shouldn't be there diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 732745b3f..75c1c1bea 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3944,7 +3944,7 @@ declare_proto_rig(get_parm) if (val.i == 1) { s = "BUG"; } else if (val.i == 2) { s = "PADDLE"; } - fprintf(fout, "%s%cv", s, resp_sep); + fprintf(fout, "%s%c", s, resp_sep); } else if (RIG_PARM_IS_FLOAT(parm)) { commit ff5500b2d933195344cb458e689d26c58a7a5f32 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 12:31:56 2025 +0200 Avoid segfaulting when val.cs is NULL This is the case for BANDSELECT and KEYERTYPE. Use SNPRINTF() which deals with NULLs printing (null) and it is used with the other datatypes.. Steps to reproduce: tests/rigctl -m 1 set_parm KEYERTYPE '?' tests/rigctl -m 1 set_parm BANDSELECT 1 Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. __strcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:302 warning: 302 ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: File o directory non esistente (gdb) bt #0 __strcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:302 #1 0x00007f8ab4d0b7ab in dummy_set_parm (rig=0x55d19b6cab20, parm=2048, val=...) at dummy.c:1704 #2 0x000055d175b8c03d in rigctl_set_parm (rig=0x55d19b6cab20, fout=0x7f8ab4bf25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x55d175ba9000 <test_list+1440>, vfo=536870912, arg1=0x7ffd730281e0 "KEYERTYPE", arg2=0x7ffd730283e0 "'?'", arg3=0x55d175b9fce8 "") at rigctl_parse.c:3828 #3 0x000055d175b93756 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffd7302a3a8, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #4 0x000055d175b7dadc in main (argc=<optimized out>, argv=0x7ffd7302a3a8) at rigctl.c:801 diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 544de59cc..dc9b5c69a 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -1701,7 +1701,7 @@ static int dummy_set_parm(RIG *rig, setting_t parm, value_t val) if (RIG_PARM_IS_STRING(parm)) { - strcpy(pstr, val.cs); + SNPRINTF(pstr, sizeof(pstr), "%s", val.cs); } else { ----------------------------------------------------------------------- Summary of changes: rigs/dummy/dummy.c | 2 +- tests/rigctl_parse.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-13 13:07: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 4b6b5415f546a7dd0ffa3aaff09c7275449adbc5 (commit) via 663fd4f738f770c27a6928012e443b35c0ff5fe6 (commit) from 99047473585dcac9ccaff6a87015f974b73e9fd8 (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 4b6b5415f546a7dd0ffa3aaff09c7275449adbc5 Merge: 990474735 663fd4f73 Author: Nate Bargmann <n0...@n0...> Date: Wed Aug 13 07:06:43 2025 -0500 Merge GitHub PR #1844 commit 663fd4f738f770c27a6928012e443b35c0ff5fe6 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 13 11:33:40 2025 +0200 Fix compiler warnings Fixes: hamlibpy_wrap.c: In function 'Rig_send_raw': hamlibpy_wrap.c:4668:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 4668 | send = PyUnicode_AsUTF8AndSize(send_obj, &send_len); | ^ hamlibpy_wrap.c:4679:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 4679 | term = PyUnicode_AsUTF8AndSize(term_obj, NULL); | ^ Thanks to @GeoBaltz diff --git a/bindings/rig.swg b/bindings/rig.swg index 808183d2a..7aca173ef 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -739,13 +739,16 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin PyObject *send_raw(PyObject *send_obj, PyObject *term_obj=NULL) { char *send, *term; + PyObject *bytes_obj; size_t send_len; int reply_len = MAX_RETURNSTR; unsigned char reply_buffer[MAX_RETURNSTR]; int count; if (PyUnicode_Check(send_obj)) { - send = PyUnicode_AsUTF8AndSize(send_obj, &send_len); + bytes_obj = PyUnicode_AsUTF8String(send_obj); + PyBytes_AsStringAndSize(bytes_obj, &send, &send_len); + Py_XDECREF(bytes_obj); } else if (PyBytes_Check(send_obj)) { PyBytes_AsStringAndSize(send_obj, &send, &send_len); } else { @@ -756,7 +759,9 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin // Using NULL for length in PyUnicode_AsUTF8AndSize() and PyBytes_AsStringAndSize() // because we can't accept '\0' because there is no length for term in rig_send_raw() if (PyUnicode_Check(term_obj)) { - term = PyUnicode_AsUTF8AndSize(term_obj, NULL); + bytes_obj = PyUnicode_AsUTF8String(term_obj); + PyBytes_AsStringAndSize(bytes_obj, &term, NULL); + Py_XDECREF(bytes_obj); } else if (PyBytes_Check(term_obj)) { PyBytes_AsStringAndSize(term_obj, &term, NULL); } else if (term_obj == Py_None) { ----------------------------------------------------------------------- Summary of changes: bindings/rig.swg | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-13 02:50: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 99047473585dcac9ccaff6a87015f974b73e9fd8 (commit) via 2a2f33673ea987c3f314e58c90b0231349aa683e (commit) via 4187e9f4a31a1c4c7d7e5d456e6012007bf0dfeb (commit) from f32b744ac98a1d9e3c7231c46b4ae3b5323b4628 (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 99047473585dcac9ccaff6a87015f974b73e9fd8 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 12 23:24:32 2025 +0200 Handle the question mark as second argument of set_level in ampctl Test command: tests/ampctl -m 1 \ set_level FAULT '?' \ set_level NH '?' \ set_level PF '?' \ set_level PWRFORWARD '?' \ set_level PWRINPUT '?' \ set_level PWRPEAK '?' \ set_level PWRREFLECTED '?' \ set_level SWR '?' diff --git a/tests/ampctl_parse.c b/tests/ampctl_parse.c index e359b20b6..44705b8d5 100644 --- a/tests/ampctl_parse.c +++ b/tests/ampctl_parse.c @@ -1713,6 +1713,25 @@ declare_proto_amp(set_level) level = rig_parse_level(arg1); + if (!strcmp(arg2, "?")) + { + const gran_t *gran = STATE(amp)->level_gran; + int idx = rig_setting2idx(level); + + if (AMP_LEVEL_IS_FLOAT(level)) + { + fprintf(fout, "(%f..%f/%f)%c", gran[idx].min.f, + gran[idx].max.f, gran[idx].step.f, resp_sep); + } + else + { + fprintf(fout, "(%d..%d/%d)%c", gran[idx].min.i, + gran[idx].max.i, gran[idx].step.i, resp_sep); + } + + return RIG_OK; + } + // some Java apps send comma in international setups so substitute period char *p = strchr(arg2, ','); commit 2a2f33673ea987c3f314e58c90b0231349aa683e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 12 20:38:48 2025 +0200 Handle the question mark as second argument of set_level in rotctl Test command: tests/rotctl -m 1 \ set_level MGC '?' \ set_level MGF '?' \ set_level MGL '?' \ set_level SPEED '?' diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 9c0553e2f..861bbf41c 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -1950,6 +1950,25 @@ declare_proto_rot(set_level) level = rot_parse_level(arg1); + if (!strcmp(arg2, "?")) + { + const gran_t *gran = STATE(rot)->level_gran; + int idx = rig_setting2idx(level); + + if (ROT_LEVEL_IS_FLOAT(level)) + { + fprintf(fout, "(%f..%f/%f)%c", gran[idx].min.f, + gran[idx].max.f, gran[idx].step.f, resp_sep); + } + else + { + fprintf(fout, "(%d..%d/%d)%c", gran[idx].min.i, + gran[idx].max.i, gran[idx].step.i, resp_sep); + } + + return RIG_OK; + } + if (!rot_has_set_level(rot, level)) { const struct confparams *cfp; commit 4187e9f4a31a1c4c7d7e5d456e6012007bf0dfeb Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 12 17:24:52 2025 +0200 Handle the question mark as second argument of set_level in rigctl Closes #720. Test command: tests/rigctl -m 1 \ set_level AF '?' set_level AGC '?' set_level AGC_TIME '?' \ set_level ANTIVOX '?' set_level APF '?' set_level ATT '?' \ set_level BAL '?' set_level BAND_SELECT '?' set_level BKINDL '?' \ set_level BKIN_DLYMS '?' set_level COMP '?' set_level CWPITCH '?' \ set_level IF '?' set_level KEYSPD '?' set_level METER '?' \ set_level MGC '?' set_level MGF '?' set_level MGL '?' \ set_level MICGAIN '?' set_level MONITOR_GAIN '?' set_level NB '?' \ set_level NOTCHF '?' set_level NOTCHF_RAW '?' set_level NR '?' \ set_level PBT_IN '?' set_level PBT_OUT '?' set_level PREAMP '?' \ set_level RF '?' set_level RFPOWER '?' set_level SLOPE_HIGH '?' \ set_level SLOPE_LOW '?' set_level SPECTRUM_ATT '?' set_level SPECTRUM_AVG '?' \ set_level SPECTRUM_EDGE_HIGH '?' set_level SPECTRUM_EDGE_LOW '?' set_level SPECTRUM_MODE '?' \ set_level SPECTRUM_REF '?' set_level SPECTRUM_SPAN '?' set_level SPECTRUM_SPEED '?' \ set_level SQL '?' set_level USB_AF '?' set_level USB_AF_INPUT '?' \ set_level VOXDELAY '?' set_level VOXGAIN '?' diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 4db850e87..732745b3f 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -3352,9 +3352,27 @@ declare_proto_rig(set_level) level = rig_parse_level(arg1); - if ((!strcmp(arg2, "?") || arg2[0] == 0) && level == RIG_LEVEL_METER) + if (!strcmp(arg2, "?")) { - fprintf(fout, "COMP ALC SWR ID/IC VDD DB PO TEMP%c", resp_sep); + if (level == RIG_LEVEL_METER) + { + fprintf(fout, "COMP ALC SWR ID/IC VDD DB PO TEMP%c", resp_sep); + } else { + const gran_t *gran = STATE(rig)->level_gran; + int idx = rig_setting2idx(level); + + if (RIG_LEVEL_IS_FLOAT(level)) + { + fprintf(fout, "(%f..%f/%f)%c", gran[idx].min.f, + gran[idx].max.f, gran[idx].step.f, resp_sep); + } + else + { + fprintf(fout, "(%d..%d/%d)%c", gran[idx].min.i, + gran[idx].max.i, gran[idx].step.i, resp_sep); + } + } + RETURNFUNC2(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: tests/ampctl_parse.c | 19 +++++++++++++++++++ tests/rigctl_parse.c | 22 ++++++++++++++++++++-- tests/rotctl_parse.c | 19 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-12 17:00:48
|
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 f32b744ac98a1d9e3c7231c46b4ae3b5323b4628 (commit) via 84fbe1df4a2357b00e48430f0206d2f7b641817d (commit) via 9e6ff6edccde4e3ebd346d7f07a2889a0c43735e (commit) from c51357388cb8b52456e2c8561f2f3f329d12cb86 (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 f32b744ac98a1d9e3c7231c46b4ae3b5323b4628 Author: Nate Bargmann <n0...@n0...> Date: Tue Aug 12 11:57:10 2025 -0500 Update Segfault-award for netrigctl_open() fix Congrats, Daniele! diff --git a/Segfault-award b/Segfault-award index e775238db..69234e7f6 100644 --- a/Segfault-award +++ b/Segfault-award @@ -7,6 +7,8 @@ A developer cannot apply for HSHR for segfaults on his/her own code. Here is the list of the brave fellows: +* Daniele Forsi, IU5HKX, v4.6.4, Improper indexing in netrigctl_open(). + * Christoph Berg DF7CB python with Hamlib.rig_parse(None) * Saku Nyland OH1KH v4.5.1, 10/2022, rigctld.c using ptt_type=RTS commit 84fbe1df4a2357b00e48430f0206d2f7b641817d Merge: c51357388 9e6ff6edc Author: Nate Bargmann <n0...@n0...> Date: Tue Aug 12 07:50:53 2025 -0500 Merge GitHub PR #1842 commit 9e6ff6edccde4e3ebd346d7f07a2889a0c43735e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 12 14:01:30 2025 +0200 Fix segfault when executing the dump_caps command Need to convert the level number 0..63 to the level bit mask. Steps to reproduce tests/rigctld -m 1 & tests/rigctl -m 2 dump_caps Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. [..] (gdb) bt #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:174 #1 0x00007f532c46e300 in __printf_buffer (buf=buf@entry=0x7ffc320ad970, format=0x7f532c8aba22 "%s(%s) ", ap=0x7ffc320ada30, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435 #2 0x00007f532c491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc320ada30, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96 #3 0x00007f532c469642 in __GI___snprintf ( s=s@entry=0x7ffc320aec94 "BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0.000000/0.000000) PBT_IN(0.000000..0.000000/0.000000) PBT_OUT(0.000000..0.000000/0.000000) CWPITCH(0..0/10) RFPOWER(0.050000..1.000000/0.001957) MICG"..., maxlen=maxlen@entry=3948, format=format@entry=0x7f532c8aba22 "%s(%s) ") at ./stdio-common/snprintf.c:31 #4 0x00007f532c6dc14a in rig_sprintf_parm_gran ( str=str@entry=0x7ffc320aec00 "ANN(0..0/0) APO(0..0/0) BACKLIGHT(0..0/0) BEEP(0..1316880384/1315832322) TIME(0..0/0) BAT(0..0/0) KEYLIGHT(0..0/0) SCREENSAVER(0..4/0) AFIF(0..0/0) BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0."..., nlen=nlen@entry=4096, parm=9223372036854775807, gran=gran@entry=0x55f1f3cac338) at sprintflst.c:646 #5 0x000055f1eb6cd487 in dumpstate (rig=rig@entry=0x55f1f3ca5b20, fout=fout@entry=0x7f532c5f25c0 <_IO_2_1_stdout_>) at dumpstate.c:408 #6 0x000055f1eb6b4b81 in rigctl_dump_caps (rig=0x55f1f3ca5b20, fout=0x7f532c5f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x55f1eb6dc0e0 <test_list+5760>, vfo=536870912, arg1=0x0, arg2=0x55f1eb6d1ce8 "", arg3=0x55f1eb6d1ce8 "") at rigctl_parse.c:4622 #7 0x000055f1eb6c65f6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc320b2138, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #8 0x000055f1eb6b0adc in main (argc=<optimized out>, argv=0x7ffc320b2138) at rigctl.c:801 diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 9e39365ea..b5551ca14 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -861,8 +861,9 @@ static int netrigctl_open(RIG *rig) for (i = 0; p != NULL && i < RIG_SETTING_MAX; ++i) { - int level; - sscanf(p, "%d", &level); + int idx, level; + sscanf(p, "%d", &idx); + level = rig_idx2setting(idx); rig->caps->parm_gran[i].step.s = 0; ----------------------------------------------------------------------- Summary of changes: Segfault-award | 2 ++ rigs/dummy/netrigctl.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-12 16:59:17
|
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, Hamlib-4.6.3 has been updated via 8aca7436b539406bf9df1f7543a606c73227865b (commit) via 9141b47057e4ebf20f1f0fafd8a1f2a3cfd2ae49 (commit) via f88beb1a8e2902b44da0d1f7c05083a8596c82cb (commit) from 2d63d05da7d80132392b25a8405844fceea4480f (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 8aca7436b539406bf9df1f7543a606c73227865b Author: Nate Bargmann <n0...@n0...> Date: Tue Aug 12 11:57:10 2025 -0500 Update Segfault-award for netrigctl_open() fix Congrats, Daniele! diff --git a/Segfault-award b/Segfault-award index e775238db..69234e7f6 100644 --- a/Segfault-award +++ b/Segfault-award @@ -7,6 +7,8 @@ A developer cannot apply for HSHR for segfaults on his/her own code. Here is the list of the brave fellows: +* Daniele Forsi, IU5HKX, v4.6.4, Improper indexing in netrigctl_open(). + * Christoph Berg DF7CB python with Hamlib.rig_parse(None) * Saku Nyland OH1KH v4.5.1, 10/2022, rigctld.c using ptt_type=RTS commit 9141b47057e4ebf20f1f0fafd8a1f2a3cfd2ae49 Author: Nate Bargmann <n0...@n0...> Date: Tue Aug 12 11:56:41 2025 -0500 Update NEWS with seg fault fix diff --git a/NEWS b/NEWS index 1b9c5c1e1..7f207bc23 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ Version 4.6.5 * 2025-??-?? * Update Kenwood CW buffer max message size, fix one byte buffer overrun in icom.c. (TNX George Baltz). + * Fix Segmentation Fault in rigs/dummy/netrigctl.c. (TNX Daniele Forsi) Version 4.6.4 * 2025-07-18--Hamlib's 25th birthday!!! commit f88beb1a8e2902b44da0d1f7c05083a8596c82cb Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 12 14:01:30 2025 +0200 Fix segfault when executing the dump_caps command Need to convert the level number 0..63 to the level bit mask. Steps to reproduce tests/rigctld -m 1 & tests/rigctl -m 2 dump_caps Fixes: Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault. [..] (gdb) bt #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:174 #1 0x00007f532c46e300 in __printf_buffer (buf=buf@entry=0x7ffc320ad970, format=0x7f532c8aba22 "%s(%s) ", ap=0x7ffc320ada30, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435 #2 0x00007f532c491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc320ada30, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96 #3 0x00007f532c469642 in __GI___snprintf ( s=s@entry=0x7ffc320aec94 "BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0.000000/0.000000) PBT_IN(0.000000..0.000000/0.000000) PBT_OUT(0.000000..0.000000/0.000000) CWPITCH(0..0/10) RFPOWER(0.050000..1.000000/0.001957) MICG"..., maxlen=maxlen@entry=3948, format=format@entry=0x7f532c8aba22 "%s(%s) ") at ./stdio-common/snprintf.c:31 #4 0x00007f532c6dc14a in rig_sprintf_parm_gran ( str=str@entry=0x7ffc320aec00 "ANN(0..0/0) APO(0..0/0) BACKLIGHT(0..0/0) BEEP(0..1316880384/1315832322) TIME(0..0/0) BAT(0..0/0) KEYLIGHT(0..0/0) SCREENSAVER(0..4/0) AFIF(0..0/0) BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0."..., nlen=nlen@entry=4096, parm=9223372036854775807, gran=gran@entry=0x55f1f3cac338) at sprintflst.c:646 #5 0x000055f1eb6cd487 in dumpstate (rig=rig@entry=0x55f1f3ca5b20, fout=fout@entry=0x7f532c5f25c0 <_IO_2_1_stdout_>) at dumpstate.c:408 #6 0x000055f1eb6b4b81 in rigctl_dump_caps (rig=0x55f1f3ca5b20, fout=0x7f532c5f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n', cmd=0x55f1eb6dc0e0 <test_list+5760>, vfo=536870912, arg1=0x0, arg2=0x55f1eb6d1ce8 "", arg3=0x55f1eb6d1ce8 "") at rigctl_parse.c:4622 #7 0x000055f1eb6c65f6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc320b2138, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847 #8 0x000055f1eb6b0adc in main (argc=<optimized out>, argv=0x7ffc320b2138) at rigctl.c:801 diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 382f5f039..e57c3eab8 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -861,8 +861,9 @@ static int netrigctl_open(RIG *rig) for (i = 0; p != NULL && i < RIG_SETTING_MAX; ++i) { - int level; - sscanf(p, "%d", &level); + int idx, level; + sscanf(p, "%d", &idx); + level = rig_idx2setting(idx); rig->caps->parm_gran[i].step.s = 0; ----------------------------------------------------------------------- Summary of changes: NEWS | 1 + Segfault-award | 2 ++ rigs/dummy/netrigctl.c | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-12 12:41:10
|
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 c51357388cb8b52456e2c8561f2f3f329d12cb86 (commit) via 3b79b13f6d521a955faeac4274237478dcaeb57e (commit) via e2feb1d1d07c1e66b75c1e3d4d0414d790fce7e7 (commit) via 19dce9dc3256a1cac13dca2c43e11fef1462e3e5 (commit) via 6dec5791443a1d5e5bdb4684cfeaeb1cf37c8f04 (commit) via 65439c671961f589258427c4fbfd8ddc596ee744 (commit) from 5e13d102af3f90a16515982ccf5f23b93ea6a2dc (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 c51357388cb8b52456e2c8561f2f3f329d12cb86 Merge: 5e13d102a 3b79b13f6 Author: Nate Bargmann <n0...@n0...> Date: Tue Aug 12 07:04:50 2025 -0500 Merge GitHub PR #1841 commit 3b79b13f6d521a955faeac4274237478dcaeb57e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 23:41:39 2025 +0200 Make the tests for set_conf() and get_conf() more meaningful diff --git a/bindings/python/test_amp.py b/bindings/python/test_amp.py index 1a0b5eac3..4f8608761 100755 --- a/bindings/python/test_amp.py +++ b/bindings/python/test_amp.py @@ -27,11 +27,15 @@ class TestClass: assert amp.set_conf("", "") is None assert amp.get_conf("") == "" assert amp.get_conf(0) == "" - conf = amp.get_conf("mcfg") - assert isinstance(conf, str) - assert amp.set_conf("mcfg", "foo") is None - conf = amp.get_conf("mcfg") - assert conf == "" # FIXME: should return "foo" + if model == Hamlib.AMP_MODEL_DUMMY: + conf = amp.get_conf("mcfg") + assert conf == "" + assert amp.set_conf("mcfg", "foobar") is None + conf = amp.get_conf("mcfg") + assert conf == "" # FIXME: should return "foobar" + else: + conf = amp.get_conf("mcfg") + assert conf == "" assert amp.token_lookup("") is None diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 5c0c305ec..a7545bd8e 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -29,13 +29,14 @@ class TestClass: assert rig.set_conf("", "") is None assert rig.get_conf("") == "" assert rig.get_conf(0) == "" - conf = rig.get_conf("mcfg") - assert isinstance(conf, str) - assert rig.set_conf("mcfg", "foo") is None - conf = rig.get_conf("mcfg") if model == Hamlib.RIG_MODEL_DUMMY: - assert conf == "foo" + conf = rig.get_conf("mcfg") + assert conf == "DX" + assert rig.set_conf("mcfg", "foobar") is None + conf = rig.get_conf("mcfg") + assert conf == "foobar" else: + conf = rig.get_conf("mcfg") assert conf == "" assert rig.token_lookup("") is None diff --git a/bindings/python/test_rot.py b/bindings/python/test_rot.py index c87835534..73cce79af 100755 --- a/bindings/python/test_rot.py +++ b/bindings/python/test_rot.py @@ -36,13 +36,14 @@ class TestClass: assert rot.set_conf("", "") is None assert rot.get_conf("") == "" assert rot.get_conf(0) == "" - conf = rot.get_conf("mcfg") - assert isinstance(conf, str) - assert rot.set_conf("mcfg", "foo") is None - conf = rot.get_conf("mcfg") if model == Hamlib.ROT_MODEL_DUMMY: - assert conf == "foo" + conf = rot.get_conf("mcfg") + assert conf == "ROTATOR" + assert rot.set_conf("mcfg", "foobar") is None + conf = rot.get_conf("mcfg") + assert conf == "foobar" else: + conf = rot.get_conf("mcfg") assert conf == "" assert rot.token_lookup("") is None commit e2feb1d1d07c1e66b75c1e3d4d0414d790fce7e7 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 23:40:01 2025 +0200 Fix "val_len" paramenter for rot_get_conf2() and amp_get_conf2() Thanks to @GeoBaltz. diff --git a/bindings/amplifier.swg b/bindings/amplifier.swg index 00ab8d533..136e9d5c1 100644 --- a/bindings/amplifier.swg +++ b/bindings/amplifier.swg @@ -124,7 +124,7 @@ typedef struct Amp { const char *get_conf(hamlib_token_t tok) { static char s[128] = ""; - self->error_status = amp_get_conf2(self->amp, tok, s, sizeof *s); + self->error_status = amp_get_conf2(self->amp, tok, s, sizeof s); return s; } @@ -134,7 +134,7 @@ typedef struct Amp { if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else - self->error_status = amp_get_conf2(self->amp, tok, s, sizeof *s); + self->error_status = amp_get_conf2(self->amp, tok, s, sizeof s); return s; } diff --git a/bindings/rotator.swg b/bindings/rotator.swg index 0cfa13cbe..8691e4730 100644 --- a/bindings/rotator.swg +++ b/bindings/rotator.swg @@ -133,7 +133,7 @@ typedef struct Rot { const char *get_conf(hamlib_token_t tok) { static char s[128] = ""; - self->error_status = rot_get_conf2(self->rot, tok, s, sizeof *s); + self->error_status = rot_get_conf2(self->rot, tok, s, sizeof s); return s; } @@ -143,7 +143,7 @@ typedef struct Rot { if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else - self->error_status = rot_get_conf2(self->rot, tok, s, sizeof *s); + self->error_status = rot_get_conf2(self->rot, tok, s, sizeof s); return s; } commit 19dce9dc3256a1cac13dca2c43e11fef1462e3e5 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 15:29:11 2025 +0200 Remove deprecated functions and methods from the bindings diff --git a/bindings/ignore.swg b/bindings/ignore.swg index 34f634034..4765a41b9 100644 --- a/bindings/ignore.swg +++ b/bindings/ignore.swg @@ -5,6 +5,7 @@ %rename("$ignore", regexmatch$name="^AMP_") ""; %rename("$ignore", regexmatch$name="^RIG_") ""; %rename("$ignore", regexmatch$name="^ROT_") ""; +%rename("$ignore", regexmatch$name="deprecated") ""; // re-add useful defines @@ -86,6 +87,7 @@ %rename("$ignore", regexmatch$name="^amp_", %$isfunction) ""; %rename("$ignore", regexmatch$name="^rig_", %$isfunction) ""; %rename("$ignore", regexmatch$name="^rot_", %$isfunction) ""; + // re-add some methods %rename("%s") rig_set_debug; %rename("%s", regexmatch$name="^rig_str", %$isfunction) ""; @@ -111,7 +113,9 @@ %ignore PRIfreq; %ignore SCNfreq; +// others %rename("$ignore", regexmatch$name="python_callbacks") ""; // internal structs and methods used by bindings +%ignore rig_state::cache; // deprecated #ifdef SWIGLUA %ignore Rig::set_level(setting_t,int,vfo_t); diff --git a/bindings/python/test_Hamlib_class.py b/bindings/python/test_Hamlib_class.py index 98f767f7e..f0323958d 100755 --- a/bindings/python/test_Hamlib_class.py +++ b/bindings/python/test_Hamlib_class.py @@ -52,7 +52,6 @@ class TestClass: 'multicast_s', 'netrigctl_get_vfo_mode', 'qrb', -'rig_cache_deprecated', 'rig_callbacks', 'rig_caps', 'rig_set_debug', @@ -60,7 +59,6 @@ class TestClass: 'rig_spectrum_line', 'rig_spectrum_scope', 'rig_state', -'rig_state_deprecated', 'rig_stragclevel', 'rig_strcommstatus', 'rig_strfunc', commit 6dec5791443a1d5e5bdb4684cfeaeb1cf37c8f04 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 15:09:49 2025 +0200 Replace library functions deprecated in Hamlib diff --git a/bindings/amplifier.swg b/bindings/amplifier.swg index ed28c8046..00ab8d533 100644 --- a/bindings/amplifier.swg +++ b/bindings/amplifier.swg @@ -124,7 +124,7 @@ typedef struct Amp { const char *get_conf(hamlib_token_t tok) { static char s[128] = ""; - self->error_status = amp_get_conf(self->amp, tok, s); + self->error_status = amp_get_conf2(self->amp, tok, s, sizeof *s); return s; } @@ -134,7 +134,7 @@ typedef struct Amp { if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else - self->error_status = amp_get_conf(self->amp, tok, s); + self->error_status = amp_get_conf2(self->amp, tok, s, sizeof *s); return s; } diff --git a/bindings/rig.swg b/bindings/rig.swg index a062bcfef..61f8674f3 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -699,7 +699,7 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin void get_conf(hamlib_token_t tok, char *returnstr) { returnstr[0] = '\0'; - self->error_status = rig_get_conf(self->rig, tok, returnstr); + self->error_status = rig_get_conf2(self->rig, tok, returnstr, MAX_RETURNSTR); } void get_conf(const char *name, char *returnstr) { @@ -708,7 +708,7 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else - self->error_status = rig_get_conf(self->rig, tok, returnstr); + self->error_status = rig_get_conf2(self->rig, tok, returnstr, MAX_RETURNSTR); } void recv_dtmf(char *returnstr, vfo_t vfo = RIG_VFO_CURR) { diff --git a/bindings/rotator.swg b/bindings/rotator.swg index eb615319b..0cfa13cbe 100644 --- a/bindings/rotator.swg +++ b/bindings/rotator.swg @@ -133,7 +133,7 @@ typedef struct Rot { const char *get_conf(hamlib_token_t tok) { static char s[128] = ""; - self->error_status = rot_get_conf(self->rot, tok, s); + self->error_status = rot_get_conf2(self->rot, tok, s, sizeof *s); return s; } @@ -143,7 +143,7 @@ typedef struct Rot { if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else - self->error_status = rot_get_conf(self->rot, tok, s); + self->error_status = rot_get_conf2(self->rot, tok, s, sizeof *s); return s; } commit 65439c671961f589258427c4fbfd8ddc596ee744 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 14:47:06 2025 +0200 Fix typo diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index 028128eeb..88af10a99 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -618,7 +618,7 @@ int drake_report_all(RIG *rig, char* owner) // strings show mem off, ch 00, NB off, AGC fast, RF off, MN off, ant 1, AM mode, 6.0 bw, VFOA, sync off, not scanning // r8 //char testbuf[25] = {' ','0','0',' ','2','0','2','<','8',' ',' ','1','5','.','0','0','0','0','0','#','m','H','z', 0x0d, 0x0a }; - // r8a/b - TODO Note 7-char channel name that eitehr starts at [25] or [26] + // r8a/b - TODO Note 7-char channel name that either starts at [25] or [26] //char testbuf[35] = {' ','0','0','0',' ','2','0','2','<','8',' ',' ','1','5','.','0','0','0','0','0','#','m','H','z',' ','M','E','M','N','A','M','E',' ', 0x0d, 0x0a }; //drake_trans_rept(owner, "RA" EOM, 3, mdbuf, mdbuf_len, retval); ----------------------------------------------------------------------- Summary of changes: bindings/amplifier.swg | 4 ++-- bindings/ignore.swg | 4 ++++ bindings/python/test_Hamlib_class.py | 2 -- bindings/python/test_amp.py | 14 +++++++++----- bindings/python/test_rig.py | 11 ++++++----- bindings/python/test_rot.py | 11 ++++++----- bindings/rig.swg | 4 ++-- bindings/rotator.swg | 4 ++-- rigs/drake/drake.c | 2 +- 9 files changed, 32 insertions(+), 24 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-12 12:04:02
|
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 5e13d102af3f90a16515982ccf5f23b93ea6a2dc (commit) via e16f4077e75e70b461bbeb8608af17aa62c642b5 (commit) via 289a3952cefb259da0e39bc3db8b58a31001581c (commit) via 12ec55c3d7493c60a3444beb2a976fe12de2c650 (commit) via 5e336b90c1bef2b972e9e5c0b68177b47554d3c3 (commit) from 0d1481d86f9ebf889525cc53b0f02e14d340361a (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 5e13d102af3f90a16515982ccf5f23b93ea6a2dc Merge: 0d1481d86 e16f4077e Author: Nate Bargmann <n0...@n0...> Date: Mon Aug 11 08:31:20 2025 -0500 Merge merge GitHub PR #1840 commit e16f4077e75e70b461bbeb8608af17aa62c642b5 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 12:32:46 2025 +0200 Implement the Python bindings and the tests for rig_send_raw() Allows to send either string or bytes and to receive a response converted to the same datatype. Also the "term" argument can be of either type (but it can't contain NULs, it's a single char or byte anyway). Closes #1624. diff --git a/bindings/python/test_Hamlib_Rig_class.py b/bindings/python/test_Hamlib_Rig_class.py index 3f60f0ce6..83387836f 100755 --- a/bindings/python/test_Hamlib_Rig_class.py +++ b/bindings/python/test_Hamlib_Rig_class.py @@ -70,6 +70,7 @@ class TestClass: 'scan', 'send_dtmf', 'send_morse', +'send_raw', 'set_ant', 'set_bank', 'set_channel', diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 5c0c305ec..ee3c28e31 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -190,6 +190,23 @@ class TestClass: assert rig.set_spectrum_callback(None) is None + def do_test_send_raw(self, rig): + """rig_send_raw() tests""" + + # When using the Dummy driver, rig.c replies with a copy of the data + test_string_1 = "test string 012\n" + test_string_2 = test_string_1 * 2 + assert rig.send_raw(test_string_1) == test_string_1 + assert rig.send_raw(test_string_2, "\n") == test_string_1 + assert rig.send_raw(test_string_2, bytes([10])) == test_string_1 + + test_bytes_1 = bytes("test bytes\x00\x01\x02", "ASCII") + test_bytes_2 = test_bytes_1 * 2 + assert rig.send_raw(test_bytes_1) == test_bytes_1 + assert rig.send_raw(test_bytes_1, "s") == b"tes" + assert rig.send_raw(test_bytes_2, b"\x02") == test_bytes_1 + + def test_with_open(self, model, rig_file, serial_speed): """Call all the methods that depend on open()""" rig = Hamlib.Rig(model) @@ -211,6 +228,9 @@ class TestClass: self.do_test_antenna(rig) self.do_test_squelch(rig) self.do_test_callback(rig) + # When using the Dummy driver, rig.c replies with a copy of the data + if model == Hamlib.RIG_MODEL_DUMMY: + self.do_test_send_raw(rig) assert rig.close() is None assert rig.state.comm_state == 0 diff --git a/bindings/rig.swg b/bindings/rig.swg index a062bcfef..7d577afc3 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -735,6 +735,48 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin return status; } +#ifdef SWIGPYTHON + PyObject *send_raw(PyObject *send_obj, PyObject *term_obj=NULL) + { + char *send, *term; + size_t send_len; + int reply_len = MAX_RETURNSTR; + unsigned char reply_buffer[MAX_RETURNSTR]; + int count; + + if (PyUnicode_Check(send_obj)) { + send = PyUnicode_AsUTF8AndSize(send_obj, &send_len); + } else if (PyBytes_Check(send_obj)) { + PyBytes_AsStringAndSize(send_obj, &send, &send_len); + } else { + SWIG_Python_RaiseOrModifyTypeError("Expected string or bytes for send argument"); + return NULL; + } + + // Using NULL for length in PyUnicode_AsUTF8AndSize() and PyBytes_AsStringAndSize() + // because we can't accept '\0' because there is no length for term in rig_send_raw() + if (PyUnicode_Check(term_obj)) { + term = PyUnicode_AsUTF8AndSize(term_obj, NULL); + } else if (PyBytes_Check(term_obj)) { + PyBytes_AsStringAndSize(term_obj, &term, NULL); + } else if (term_obj == Py_None) { + term = NULL; + } else { + SWIG_Python_RaiseOrModifyTypeError("Expected string or bytes or NULL for term argument"); + return NULL; + } + + count = rig_send_raw(self->rig, send, send_len, reply_buffer, reply_len, term); + self->error_status = count < 0 ? count : RIG_OK; + + if (PyUnicode_Check(send_obj)) { + return PyUnicode_FromStringAndSize(reply_buffer, count); + } else { + return PyBytes_FromStringAndSize(reply_buffer, count); + } + } +#endif + //#ifndef SWIGJAVA /* TODO */ void get_level(setting_t level, vfo_t vfo = RIG_VFO_CURR) commit 289a3952cefb259da0e39bc3db8b58a31001581c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 11 12:16:33 2025 +0200 Change the dummy implementation of rig_send_raw() Makes it more similar to the regular version handling also the reply and term arguments. diff --git a/src/rig.c b/src/rig.c index ab800d884..4807011db 100644 --- a/src/rig.c +++ b/src/rig.c @@ -8923,13 +8923,9 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send, if (simulate) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating response for model %s\n", - __func__, rig->caps->model_name); - memcpy(reply, send, send_len); - retval = send_len; - set_transaction_inactive(rig); - ELAPSED2; - RETURNFUNC(retval); + rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating write for model %s\n", + __func__, rig->caps->model_name); + retval = RIG_OK; } else { @@ -8950,8 +8946,18 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send, if (simulate) { // Simulate a response by copying the command - memcpy(buf, send, send_len); - nbytes = send_len + 1; + rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating response for model %s\n", + __func__, rig->caps->model_name); + + nbytes = send_len < reply_len ? send_len : reply_len; + for (int i = 0; i < nbytes; i++) + { + buf[i] = send[i]; + if (term && memchr(term, send[i], 1)) { + nbytes = i + 1; + break; + } + } } else { commit 12ec55c3d7493c60a3444beb2a976fe12de2c650 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Aug 10 21:39:15 2025 +0200 Add missing set_transaction_inactive() Otherwise no other command will be executed afterwards. diff --git a/src/rig.c b/src/rig.c index a27e511c7..ab800d884 100644 --- a/src/rig.c +++ b/src/rig.c @@ -8927,6 +8927,7 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send, __func__, rig->caps->model_name); memcpy(reply, send, send_len); retval = send_len; + set_transaction_inactive(rig); ELAPSED2; RETURNFUNC(retval); } commit 5e336b90c1bef2b972e9e5c0b68177b47554d3c3 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Aug 10 11:42:50 2025 +0200 Improve Doxygen comments diff --git a/rigs/tentec/orion.c b/rigs/tentec/orion.c index c2c30d31f..eb635863c 100644 --- a/rigs/tentec/orion.c +++ b/rigs/tentec/orion.c @@ -228,7 +228,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, } /** - * \param rig + * \param rig The rig handle * \returns RIG_OK or < 0 * \brief Basically, it just sets up *priv */ @@ -257,7 +257,7 @@ int tt565_close(RIG *rig) } /** - * \param rig + * \param rig The rig handle * \brief tt565_cleanup routine * * the serial port is closed by the frontend @@ -309,7 +309,7 @@ static void start_thread(RIG *rig) } /** - * \param rig + * \param rig The rig handle * \brief tt565_open routine * * Open the rig - check firmware version issues @@ -342,7 +342,7 @@ int tt565_open(RIG *rig) } /** - * \param rig + * \param rig The rig handle * \param vfo RIG_VFO_MAIN or RIG_VFO_SUB * \returns 'M' or 'S' for main or subreceiver or <0 error * \brief vfo must be RIG_VFO_MAIN or RIG_VFO_SUB @@ -375,7 +375,7 @@ static char which_receiver(const RIG *rig, vfo_t vfo) } } /** - * \param rig + * \param rig The rig handle * \param vfo RIG_VFO_A, RIG_VFO_B, or RIG_VFO_NONE * \returns 'A' or 'B' or 'N' for VFO A, B, or null VFO, or <0 error * \brief vfo must be RIG_VFO_A, RIG_VFO_B, or RIG_VFO_NONE. @@ -1972,7 +1972,7 @@ int tt565_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) } /** - * \param rig + * \param rig The rig handle * \param vfo * \param msg A message string (<= 20 char) * \returns RIG_OK diff --git a/src/ext.c b/src/ext.c index 710748d4b..7236f1d79 100644 --- a/src/ext.c +++ b/src/ext.c @@ -218,7 +218,7 @@ int HAMLIB_API rig_ext_parm_foreach(RIG *rig, /** - * \param rig + * \param rig The rig handle * \param name * \brief lookup ext token by its name, return pointer to confparams struct. * @@ -267,7 +267,7 @@ const struct confparams *HAMLIB_API rig_ext_lookup(RIG *rig, const char *name) } /** - * \param rig + * \param rig The rig handle * \param token * \brief lookup ext token, return pointer to confparams struct. * @@ -316,7 +316,7 @@ const struct confparams *HAMLIB_API rig_ext_lookup_tok(RIG *rig, /** - * \param rig + * \param rig The rig handle * \param name * \brief Simple lookup returning token id associated with name */ diff --git a/src/misc.c b/src/misc.c index 1e3e3665b..8d448d2a2 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1031,7 +1031,7 @@ static const struct /** * \brief check input to set_level - * \param rig Pointer to rig data + * \param rig The rig handle * \param level RIG_LEVEL_* trying to set * \param val Raw input from the caller * \param gran If not NULL, set to location of level_gran data diff --git a/src/rig.c b/src/rig.c index 8e0ca4e00..a27e511c7 100644 --- a/src/rig.c +++ b/src/rig.c @@ -8887,9 +8887,23 @@ extern int read_icom_frame(hamlib_port_t *p, const unsigned char rxbuffer[], size_t rxbuffer_len); -// Returns # of bytes read -// reply_len should be max bytes expected + 1 -// if term is null then will read reply_len bytes exactly and reply will not be null terminated +/** + * \brief Send verbatim data + * + * \a reply_len should be max bytes expected + 1 + * + * If \a term is NULL then will read \a reply_len bytes exactly and reply will not be '\0' terminated. + * \param rig The rig handle + * \param send The buffer containing the data to be sent + * \param send_len The length of send buffer + * \param reply The buffer that will contain the data to be received + * \param reply_len The length of the reply buffer + * \param term The optional 1-char string that will terminate the read + * + * \return the number of bytes read if the operation has been successful, otherwise + * a negative value if an error occurred (in which case, cause is + * set appropriately). + */ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send, int send_len, unsigned char *reply, int reply_len, unsigned char *term) { ----------------------------------------------------------------------- Summary of changes: bindings/python/test_Hamlib_Rig_class.py | 1 + bindings/python/test_rig.py | 20 +++++++++++++++ bindings/rig.swg | 42 +++++++++++++++++++++++++++++++ rigs/tentec/orion.c | 12 ++++----- src/ext.c | 6 ++--- src/misc.c | 2 +- src/rig.c | 43 ++++++++++++++++++++++++-------- 7 files changed, 105 insertions(+), 21 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-10 23:14:39
|
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 0d1481d86f9ebf889525cc53b0f02e14d340361a (commit) from c1aaeba5acd6f1a78163d7b9fc86d4f268ef78d4 (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 0d1481d86f9ebf889525cc53b0f02e14d340361a Author: Nate Bargmann <n0...@n0...> Date: Sun Aug 10 10:39:54 2025 -0500 Update W32 and W64 build scripts Renaming the lib\gcc directory to lib\gcc-mingw broke the build of WSJT-X. See (yes, the archive sucks): https://sourceforge.net/p/hamlib/mailman/message/59215755/ diff --git a/scripts/build-w32.sh b/scripts/build-w32.sh index 76c766a4a..e518d27b8 100755 --- a/scripts/build-w32.sh +++ b/scripts/build-w32.sh @@ -100,7 +100,7 @@ hamlib-w32-4.7~git ├── include │ └── hamlib └── lib - ├── gcc-mingw + ├── gcc └── msvc The 'bin' and 'doc' directories will be of interest to users while developers @@ -198,8 +198,8 @@ program is not considered a "derivative work" when using the published Hamlib API and normal linking to the front-end library, and may be of a license of your choosing. -As of 21 Jul 2025 a .lib file is generated using the MinGW dlltool utility. -This file is now installed to the lib\gcc-mingw directory. As it is generated +As of 04 Aug 2025 a .lib file is generated using the MinGW dlltool utility. +This file is now installed to the lib\gcc directory. As it is generated by the MinGW dlltool utility, it is only suitable for use with MinGW/GCC. For developers using Microsoft Visual Studio, the following recipe is @@ -255,9 +255,9 @@ END_OF_README LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW32/dll" -make -j 4 install +make -j 4 --no-print-directory install -mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc-mingw ${ZIP_DIR}/include ${ZIP_DIR}/doc +mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. @@ -291,7 +291,7 @@ do done cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. -cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc-mingw/. +cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. # NB: Strip Hamlib DLLs and EXEs ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll @@ -337,6 +337,6 @@ fi # Generate .lib file for GCC on MinGW per Jonathan Yong from mingw-w64 # https://sourceforge.net/p/mingw-w64/discussion/723798/thread/e23dceba20/?limit=25#51dd/3df2/3708/e62b -${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/gcc-mingw/libhamlib-4.lib +${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/gcc/libhamlib-4.lib /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) diff --git a/scripts/build-w64.sh b/scripts/build-w64.sh index 12a116cc6..40f0643ce 100755 --- a/scripts/build-w64.sh +++ b/scripts/build-w64.sh @@ -100,7 +100,7 @@ hamlib-w64-4.7~git ├── include │ └── hamlib └── lib - ├── gcc-mingw + ├── gcc └── msvc The 'bin' and 'doc' directories will be of interest to users while developers @@ -188,7 +188,7 @@ There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in lib\msvc. Refer to the recipe below to generate a local libhamlib-4.lib file for use with the VC++/VS linker. -Simply '#include <hamlib/rig.h>' (pr any other header) (add directory to +Simply '#include <hamlib/rig.h>' (or any other header) (add directory to include path), include libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot compile all the Hamlib code, but the API defined by rig.h has been made MSVC friendly :-) @@ -198,8 +198,8 @@ program is not considered a "derivative work" when using the published Hamlib API and normal linking to the front-end library, and may be of a license of your choosing. -As of 21 Jul 2025 a .lib file is generated using the MinGW dlltool utility. -This file is now installed to the lib\gcc-mingw directory. As it is generated +As of 04 Aug 2025 a .lib file is generated using the MinGW dlltool utility. +This file is now installed to the lib\gcc directory. As it is generated by the MinGW dlltool utility, it is only suitable for use with MinGW/GCC. For developers using Microsoft Visual Studio, the following recipe is @@ -255,9 +255,9 @@ END_OF_README LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW64/dll" -make -j 4 install +make -j 4 --no-print-directory install -mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc-mingw ${ZIP_DIR}/include ${ZIP_DIR}/doc +mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. @@ -291,7 +291,7 @@ do done cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. -cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc-mingw/. +cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. # NB: Strip Hamlib DLLs and EXEs ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll @@ -337,6 +337,6 @@ fi # Generate .lib file for GCC on MinGW per Jonathan Yong from mingw-w64 # https://sourceforge.net/p/mingw-w64/discussion/723798/thread/e23dceba20/?limit=25#51dd/3df2/3708/e62b -${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/gcc-mingw/libhamlib-4.lib +${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/gcc/libhamlib-4.lib /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) ----------------------------------------------------------------------- Summary of changes: scripts/build-w32.sh | 14 +++++++------- scripts/build-w64.sh | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-09 23:52:29
|
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 c1aaeba5acd6f1a78163d7b9fc86d4f268ef78d4 (commit) via 221cc512bc7f87c540f55fbda8c4482cfc5e527d (commit) from 10303d58038e4b35c00d94c35c417ca7cc2fb73c (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 c1aaeba5acd6f1a78163d7b9fc86d4f268ef78d4 Merge: 10303d580 221cc512b Author: Nate Bargmann <n0...@n0...> Date: Sat Aug 9 18:43:57 2025 -0500 Merge GitHub PR #1837 commit 221cc512bc7f87c540f55fbda8c4482cfc5e527d Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 9 22:31:17 2025 +0200 Fix setting antenna number 3 for Yaesu FTDX3000 The argument ant_t ant is a bit mask, not a scalar. Also use the defines instead of magic numbers. diff --git a/rigs/yaesu/ft3000.c b/rigs/yaesu/ft3000.c index 159197d63..9ca8d37a5 100644 --- a/rigs/yaesu/ft3000.c +++ b/rigs/yaesu/ft3000.c @@ -155,20 +155,21 @@ static int ft3000_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) switch (ant) { - case 1: + case RIG_ANT_1: cmd = "AN01;"; // R3/1 ANT1/ANT3 break; - case 2: + case RIG_ANT_2: cmd = "AN02;"; // RE/2 ANT2/ANT3 break; - case 3: + case RIG_ANT_3: cmd = "AN03;"; // TRX ANT3 break; default: - rig_debug(RIG_DEBUG_ERR, "%s: expected 1,2,3 got %u\n", __func__, ant); + rig_debug(RIG_DEBUG_ERR, "%s: expected one of %u,%u,%u got %u\n", __func__, + RIG_ANT_1, RIG_ANT_2, RIG_ANT_3, ant); RETURNFUNC(-RIG_EINVAL); } ----------------------------------------------------------------------- Summary of changes: rigs/yaesu/ft3000.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-09 23:43:08
|
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 10303d58038e4b35c00d94c35c417ca7cc2fb73c (commit) via 81cb260670471689d7a3543153bb5c56cc26b5ce (commit) via e2214fd2f18f326c0325f2e7abb7c892d13885aa (commit) via 2890da9d79fdcdd070fbc924cd326a5d35d0b53d (commit) via 8e4bcbcede1c42a39b74371c5b337bac2c49ff16 (commit) via 9e1c7b5ec1f33dea1cf5a263c2ec8e12f791ac06 (commit) via 3bc1cc8744e973e314882f1c43a58478c1346e4c (commit) via 8324c85487c416025f6907a920f3528e36c07b8e (commit) from 2462ab0a135ca0274a069e27c319c90957d70ac1 (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 10303d58038e4b35c00d94c35c417ca7cc2fb73c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 9 18:09:17 2025 +0200 Fix function signature of spectrum_callback() diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 474fe1d1f..5c0c305ec 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -181,8 +181,8 @@ class TestClass: assert rig.set_pltune_callback(None) is None # spectrum event callback - def spectrum_callback(vfo, ptt, arg): - print("spectrum_callback", vfo, ptt, arg) + def spectrum_callback(rig_spectrum_line, arg): + print("spectrum_callback", rig_spectrum_line, arg) assert (1, 5000, 2345678901) == (vfo, arg) assert rig.set_spectrum_callback(spectrum_callback, 7890123456) is None commit 81cb260670471689d7a3543153bb5c56cc26b5ce Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 9 14:54:31 2025 +0200 Fix ptt_callback() diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 315b8c5d2..474fe1d1f 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -153,8 +153,7 @@ class TestClass: # PTT event callback def ptt_callback(vfo, ptt, arg): - print("ptt_callback", vfo, ptt, arg) - assert (1, 5000, 4567890123) == (vfo, arg) + assert (Hamlib.RIG_VFO_CURR, Hamlib.RIG_PTT_ON, 4567890123) == (vfo, ptt, arg) assert rig.set_ptt_callback(ptt_callback, 4567890123) is None assert rig.set_ptt(Hamlib.RIG_VFO_CURR, Hamlib.RIG_PTT_ON) is None commit e2214fd2f18f326c0325f2e7abb7c892d13885aa Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 9 14:32:59 2025 +0200 Change .ptt_type to RIG_PTT_RIG for RIG_MODEL_DUMMY With the old value of RIG_PTT_NONE, dummy_get_ptt() and dummy_set_ptt() were never called because rig_get_ptt() and rig_set_ptt() do check .ptt_type and return -RIG_ENAVAIL in that case. Do not change .ptt_type for RIG_MODEL_DUMMY_NOVFO so that both cases can be tested if needed. diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 3f54a655e..544de59cc 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -2460,7 +2460,7 @@ struct rig_caps dummy_caps = .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, .targetable_vfo = RIG_TARGETABLE_PTT | RIG_TARGETABLE_RITXIT | RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE | RIG_TARGETABLE_SPECTRUM, - .ptt_type = RIG_PTT_NONE, + .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_NONE, .has_get_func = DUMMY_FUNC, commit 2890da9d79fdcdd070fbc924cd326a5d35d0b53d Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 9 10:50:10 2025 +0200 Split the tests It makes it easier in future to conditionally run some tests(eg. to not test PTT for receiver-only rigs), or to run tests in isolation (after renaming them). It makes it easier to look at failing tests because pytest prints the code of the failing test up to the failure including any function that called the failed test (in this case would print everything from def test_with_open() up to the line with the failed assert. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index e7966139b..315b8c5d2 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -41,23 +41,10 @@ class TestClass: assert rig.token_lookup("") is None - def test_with_open(self, model, rig_file, serial_speed): - """Call all the methods that depend on open()""" - rig = Hamlib.Rig(model) - assert rig is not None - - assert rig.state.comm_state == 0 - assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED - assert rig.set_conf("rig_pathname", rig_file) is None - assert rig.set_conf("serial_speed", str(serial_speed)) is None - assert rig.open() is None - assert rig.state.comm_state == 1 - assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_OK - info = rig.get_info() - assert isinstance(info, str) - - # Frequency + def do_test_frequency(self, rig): + """Frequency tests""" + # TODO use a frequency suitable for the VFO frequency = 5700000000 assert rig.set_freq(Hamlib.RIG_VFO_CURR, frequency) is None assert rig.get_freq() == 5700000000.0 @@ -66,7 +53,9 @@ class TestClass: assert isinstance(rig.get_freq(Hamlib.RIG_VFO_CURR), float) assert rig.get_freq(Hamlib.RIG_VFO_CURR) == 5700000000.5 - # VFO + + def do_test_vfo(self, rig): + """VFO tests""" assert rig.set_vfo(Hamlib.RIG_VFO_A) is None assert rig.get_vfo() == Hamlib.RIG_VFO_A @@ -78,7 +67,9 @@ class TestClass: assert rig.get_split_vfo() == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] - # RIT and XIT + + def do_test_rit_xit(self, rig): + """RIT and XIT tests""" assert rig.set_rit(Hamlib.RIG_VFO_CURR, 100) is None assert rig.get_rit() == 100 @@ -87,7 +78,9 @@ class TestClass: assert rig.get_xit() == 200 assert rig.get_xit(Hamlib.RIG_VFO_CURR) == 200 - # Antenna + + def do_test_antenna(self, rig): + """Antenna tests""" # FIXME should use a RIG_ANT_* constant but they aren't available in the bindings RIG_ANT_1 = 1<<0 @@ -101,7 +94,9 @@ class TestClass: assert rig.set_ant(RIG_ANT_1, option, Hamlib.RIG_VFO_CURR) is None assert rig.get_ant(RIG_ANT_CURR, Hamlib.RIG_VFO_A) == expected - # Squelch codes and tones + + def do_test_squelch(self, rig): + """Squelch codes and tones""" assert rig.set_ctcss_sql(Hamlib.RIG_VFO_CURR, 885) is None assert rig.get_ctcss_sql() == 885 @@ -116,16 +111,10 @@ class TestClass: assert rig.get_dcs_sql() == 134 assert rig.get_dcs_sql(Hamlib.RIG_VFO_CURR) == 134 - # Callbacks - self.do_test_callbacks(rig) - assert rig.close() is None - assert rig.state.comm_state == 0 - assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED - info = rig.get_info() - assert info is None + def do_test_callback(self, rig): + """Callback tests""" - def do_test_callbacks(self, rig): # Frequency event callback def freq_callback(vfo, freq, arg): assert (1, 144200000.5, 1234567890) == (vfo, freq, arg) @@ -202,6 +191,35 @@ class TestClass: assert rig.set_spectrum_callback(None) is None + def test_with_open(self, model, rig_file, serial_speed): + """Call all the methods that depend on open()""" + rig = Hamlib.Rig(model) + assert rig is not None + + assert rig.state.comm_state == 0 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED + assert rig.set_conf("rig_pathname", rig_file) is None + assert rig.set_conf("serial_speed", str(serial_speed)) is None + assert rig.open() is None + assert rig.state.comm_state == 1 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_OK + info = rig.get_info() + assert isinstance(info, str) + + self.do_test_frequency(rig) + self.do_test_vfo(rig) + self.do_test_rit_xit(rig) + self.do_test_antenna(rig) + self.do_test_squelch(rig) + self.do_test_callback(rig) + + assert rig.close() is None + assert rig.state.comm_state == 0 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED + info = rig.get_info() + assert info is None + + @pytest.mark.skipif('config.getoption("model") != Hamlib.RIG_MODEL_DUMMY') def test_misc(self, model): """Just call all the methods""" commit 8e4bcbcede1c42a39b74371c5b337bac2c49ff16 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Aug 8 23:26:18 2025 +0200 Add another cross-reference in a Doxygen comment diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index a6f472bda..72eb3d105 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2652,7 +2652,8 @@ typedef int (*spectrum_cb_t)(RIG *, * really appropriate in a GUI. * * \sa rig_set_dcd_callback(), rig_set_freq_callback(), rig_set_mode_callback(), - * rig_set_ptt_callback(), rig_set_spectrum_callback(), rig_set_vfo_callback() + * rig_set_pltune_callback(), rig_set_ptt_callback(), rig_set_spectrum_callback(), + * rig_set_vfo_callback() */ // Do NOT add/remove from this structure -- it will break DLL backwards compatibility struct rig_callbacks { commit 9e1c7b5ec1f33dea1cf5a263c2ec8e12f791ac06 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Aug 8 23:36:38 2025 +0200 Allocate zereod memory for struct python_callbacks Otherwise Py_XDECREF() would randomly segfault trying to use uninitialized memory that by chance is not zeroed. diff --git a/bindings/ignore.swg b/bindings/ignore.swg index 4114aabc4..34f634034 100644 --- a/bindings/ignore.swg +++ b/bindings/ignore.swg @@ -68,7 +68,6 @@ %rename("%s", regexmatch$name="^RIG_VFO_") ""; %ignore RIG_EK; // an internal macro %ignore RIG_ELAD; // an internal macro -%rename("$ignore", regexmatch$name="python_callbacks$") ""; // internal structs and methods used by bindings // Rotators @@ -112,6 +111,8 @@ %ignore PRIfreq; %ignore SCNfreq; +%rename("$ignore", regexmatch$name="python_callbacks") ""; // internal structs and methods used by bindings + #ifdef SWIGLUA %ignore Rig::set_level(setting_t,int,vfo_t); %ignore Rig::set_ext_level(setting_t,value_t,vfo_t); diff --git a/bindings/macros.swg b/bindings/macros.swg index 888991858..29396a47a 100644 --- a/bindings/macros.swg +++ b/bindings/macros.swg @@ -122,13 +122,13 @@ void set_ ## event_name ## _callback(PyObject *cb, PyObject *arg=NULL) }; Py_XINCREF(cb); - Py_XDECREF(self->python_callbacks. ## event_name ## _event); + Py_XDECREF(self->python_callbacks-> ## event_name ## _event); Py_XINCREF(arg); - Py_XDECREF(self->python_callbacks. ## event_name ## _arg); + Py_XDECREF(self->python_callbacks-> ## event_name ## _arg); - self->python_callbacks. ## event_name ## _event = cb; - self->python_callbacks. ## event_name ## _arg = arg; + self->python_callbacks-> ## event_name ## _event = cb; + self->python_callbacks-> ## event_name ## _arg = arg; self->error_status = function_prefix ## set_ ## event_name ## _callback(class_pointer, callback, self); return; diff --git a/bindings/rig.swg b/bindings/rig.swg index 2be00320a..a062bcfef 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -45,16 +45,9 @@ #pragma SWIG nowarn=451 -typedef struct Rig { - RIG *rig; - struct rig_caps *caps; /* shortcut to RIG->caps */ - struct rig_state *state; /* shortcut to RIG->state */ - int error_status; - int do_exception; - // Handling of event callbacks #ifdef SWIGPYTHON // This mirrors "struct rig_callbacks" from rig.h using Python types - struct { + typedef struct { PyObject *freq_event; /*!< Frequency change event */ PyObject *freq_arg; /*!< Frequency change argument */ PyObject *mode_event; /*!< Mode change event */ @@ -70,7 +63,17 @@ typedef struct Rig { PyObject *spectrum_event; /*!< Spectrum line reception event */ PyObject *spectrum_arg; /*!< Spectrum line reception argument */ /* etc.. */ - } python_callbacks; + } python_callbacks_t; +#endif + +typedef struct Rig { + RIG *rig; + struct rig_caps *caps; /* shortcut to RIG->caps */ + struct rig_state *state; /* shortcut to RIG->state */ + int error_status; + int do_exception; +#ifdef SWIGPYTHON + python_callbacks_t *python_callbacks; #endif } Rig; @@ -87,10 +90,10 @@ int *rig_freq_cb_python(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) python_arguments = PyTuple_Pack(3, PyLong_FromLong(vfo), PyFloat_FromDouble(freq), - self->python_callbacks.freq_arg + self->python_callbacks->freq_arg ); - PyObject_CallObject(self->python_callbacks.freq_event, python_arguments); + PyObject_CallObject(self->python_callbacks->freq_event, python_arguments); Py_XDECREF(python_arguments); return RIG_OK; @@ -105,10 +108,10 @@ int *rig_mode_cb_python(RIG *rig, vfo_t vfo, rmode_t rmode, pbwidth_t pbwidth, r PyLong_FromLong(vfo), PyLong_FromLong(rmode), PyLong_FromLong(pbwidth), - self->python_callbacks.mode_arg + self->python_callbacks->mode_arg ); - PyObject_CallObject(self->python_callbacks.mode_event, python_arguments); + PyObject_CallObject(self->python_callbacks->mode_event, python_arguments); Py_XDECREF(python_arguments); @@ -120,11 +123,12 @@ int *rig_vfo_cb_python(RIG *rig, vfo_t vfo, rig_ptr_t arg) Rig *self = arg; PyObject *python_arguments; - python_arguments = PyTuple_Pack(1, - self->python_callbacks.vfo_arg + python_arguments = PyTuple_Pack(2, + PyLong_FromLong(vfo), + self->python_callbacks->vfo_arg ); - PyObject_CallObject(self->python_callbacks.vfo_event, python_arguments); + PyObject_CallObject(self->python_callbacks->vfo_event, python_arguments); Py_XDECREF(python_arguments); @@ -136,27 +140,31 @@ int *rig_ptt_cb_python(RIG *rig, vfo_t vfo, ptt_t ptt, rig_ptr_t arg) Rig *self = arg; PyObject *python_arguments; - python_arguments = PyTuple_Pack(1, - self->python_callbacks.ptt_arg + python_arguments = PyTuple_Pack(3, + PyLong_FromLong(vfo), + PyLong_FromLong(ptt), + self->python_callbacks->ptt_arg ); - PyObject_CallObject(self->python_callbacks.ptt_event, python_arguments); + PyObject_CallObject(self->python_callbacks->ptt_event, python_arguments); Py_XDECREF(python_arguments); return RIG_OK; } -int *rig_dcd_cb_python(RIG *rig, vfo_t vfo, dcd_t, rig_ptr_t arg) +int *rig_dcd_cb_python(RIG *rig, vfo_t vfo, dcd_t dcd, rig_ptr_t arg) { Rig *self = arg; PyObject *python_arguments; - python_arguments = PyTuple_Pack(1, - self->python_callbacks.dcd_arg + python_arguments = PyTuple_Pack(3, + PyLong_FromLong(vfo), + PyLong_FromLong(dcd), + self->python_callbacks->dcd_arg ); - PyObject_CallObject(self->python_callbacks.dcd_event, python_arguments); + PyObject_CallObject(self->python_callbacks->dcd_event, python_arguments); Py_XDECREF(python_arguments); @@ -169,10 +177,10 @@ int *rig_pltune_cb_python(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *rmode, pbw PyObject *python_arguments; python_arguments = PyTuple_Pack(1, - self->python_callbacks.pltune_arg + self->python_callbacks->pltune_arg ); - PyObject_CallObject(self->python_callbacks.pltune_event, python_arguments); + PyObject_CallObject(self->python_callbacks->pltune_event, python_arguments); Py_XDECREF(python_arguments); @@ -185,10 +193,10 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin PyObject *python_arguments; python_arguments = PyTuple_Pack(1, - self->python_callbacks.spectrum_arg + self->python_callbacks->spectrum_arg ); - PyObject_CallObject(self->python_callbacks.spectrum_event, python_arguments); + PyObject_CallObject(self->python_callbacks->spectrum_event, python_arguments); Py_XDECREF(python_arguments); @@ -468,6 +476,13 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin free(r); return NULL; } +#ifdef SWIGPYTHON + r->python_callbacks = calloc(1, sizeof(python_callbacks_t)); + if (!r->python_callbacks) { + free(r); + return NULL; + } +#endif /* install shortcuts */ r->caps = r->rig->caps; r->state = &r->rig->state; @@ -478,6 +493,9 @@ int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_lin } ~Rig () { rig_cleanup(self->rig); +#ifdef SWIGPYTHON + free(self->python_callbacks); +#endif free(self); } commit 3bc1cc8744e973e314882f1c43a58478c1346e4c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Aug 8 12:00:57 2025 +0200 Implement remaining event callbacks Implements: rig_set_dcd_callback(), rig_set_freq_callback(), rig_set_mode_callback(), rig_pltune_callback(), rig_set_ptt_callback(), rig_set_spectrum_callback(), rig_set_vfo_callback() diff --git a/bindings/python/test_Hamlib_Rig_class.py b/bindings/python/test_Hamlib_Rig_class.py index 3ebbc8c5b..3f60f0ce6 100755 --- a/bindings/python/test_Hamlib_Rig_class.py +++ b/bindings/python/test_Hamlib_Rig_class.py @@ -76,6 +76,7 @@ class TestClass: 'set_conf', 'set_ctcss_sql', 'set_ctcss_tone', +'set_dcd_callback', 'set_dcs_code', 'set_dcs_sql', 'set_ext_func', @@ -87,12 +88,16 @@ class TestClass: 'set_level', 'set_mem', 'set_mode', +'set_mode_callback', 'set_parm', +'set_pltune_callback', 'set_powerstat', 'set_ptt', +'set_ptt_callback', 'set_rit', 'set_rptr_offs', 'set_rptr_shift', +'set_spectrum_callback', 'set_split_freq', 'set_split_freq_mode', 'set_split_mode', @@ -100,6 +105,7 @@ class TestClass: 'set_trn', 'set_ts', 'set_vfo', +'set_vfo_callback', 'set_vfo_opt', 'set_xit', 'token_lookup', diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 2b5dd863e..e7966139b 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -137,6 +137,70 @@ class TestClass: assert rig.set_freq(Hamlib.RIG_VFO_CURR, 144210000) is None # TODO assert that freq_callback() is called once + # Mode event callback + def mode_callback(vfo, mode, pbwidth, arg): + assert (1, 32, 5000, 2345678901) == (vfo, mode, pbwidth, arg) + + # FIXME should use a Hamlib.RIG_PASSBAND_* constant but they aren't available in the bindings + RIG_PASSBAND_NOCHANGE = -1 + assert rig.set_mode_callback(mode_callback, 2345678901) is None + assert rig.set_mode(Hamlib.RIG_MODE_FM, 5000) is None + # TODO assert that mode_callback() is called once + assert rig.set_mode_callback(None) is None + assert rig.set_mode(Hamlib.RIG_MODE_FM, 15000) is None + # TODO assert that mode_callback() is called once + + # VFO event callback + def vfo_callback(vfo, arg): + assert (1, 3456789012) == (vfo, arg) + + assert rig.set_vfo(Hamlib.RIG_VFO_B) is None + assert rig.set_vfo_callback(vfo_callback, 3456789012) is None + assert rig.set_vfo(Hamlib.RIG_VFO_A) is None + # TODO assert that vfo_callback() is called once + assert rig.set_vfo_callback(None) is None + assert rig.set_vfo(Hamlib.RIG_VFO_CURR) is None + # TODO assert that vfo_callback() is called once + + # PTT event callback + def ptt_callback(vfo, ptt, arg): + print("ptt_callback", vfo, ptt, arg) + assert (1, 5000, 4567890123) == (vfo, arg) + + assert rig.set_ptt_callback(ptt_callback, 4567890123) is None + assert rig.set_ptt(Hamlib.RIG_VFO_CURR, Hamlib.RIG_PTT_ON) is None + # TODO assert that ptt_callback() is called once + assert rig.set_ptt_callback(None) is None + assert rig.set_ptt(Hamlib.RIG_VFO_CURR, Hamlib.RIG_PTT_OFF) is None + # TODO assert that ptt_callback() is called once + + # DCD event callback + def dcd_callback(vfo, ptt, arg): + print("dcd_callback", vfo, dcd, arg) + assert (1, 5000, 2345678901) == (vfo, arg) + + assert rig.set_dcd_callback(dcd_callback, 5678901234) is None + # TODO simulate dcd events in dummy.c + assert rig.set_dcd_callback(None) is None + + # PLtune event callback + def pltune_callback(vfo, ptt, arg): + print("pltune_callback", vfo, ptt, arg) + assert (1, 5000, 2345678901) == (vfo, arg) + + assert rig.set_pltune_callback(pltune_callback, 6789012345) is None + # TODO simulate pltune events in dummy.c + assert rig.set_pltune_callback(None) is None + + # spectrum event callback + def spectrum_callback(vfo, ptt, arg): + print("spectrum_callback", vfo, ptt, arg) + assert (1, 5000, 2345678901) == (vfo, arg) + + assert rig.set_spectrum_callback(spectrum_callback, 7890123456) is None + # TODO simulate spectrum events in dummy.c + assert rig.set_spectrum_callback(None) is None + @pytest.mark.skipif('config.getoption("model") != Hamlib.RIG_MODEL_DUMMY') def test_misc(self, model): diff --git a/bindings/rig.swg b/bindings/rig.swg index 76a393e18..2be00320a 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -65,7 +65,7 @@ typedef struct Rig { PyObject *ptt_arg; /*!< PTT change argument */ PyObject *dcd_event; /*!< DCD change event */ PyObject *dcd_arg; /*!< DCD change argument */ - PyObject *pltune; /*!< Pipeline tuning module freq/mode/width callback */ + PyObject *pltune_event; /*!< Pipeline tuning module freq/mode/width callback NOTE: the C struct doesn't have the _event suffix*/ PyObject *pltune_arg; /*!< Pipeline tuning argument */ PyObject *spectrum_event; /*!< Spectrum line reception event */ PyObject *spectrum_arg; /*!< Spectrum line reception argument */ @@ -95,6 +95,105 @@ int *rig_freq_cb_python(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) return RIG_OK; } + +int *rig_mode_cb_python(RIG *rig, vfo_t vfo, rmode_t rmode, pbwidth_t pbwidth, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(4, + PyLong_FromLong(vfo), + PyLong_FromLong(rmode), + PyLong_FromLong(pbwidth), + self->python_callbacks.mode_arg + ); + + PyObject_CallObject(self->python_callbacks.mode_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} + +int *rig_vfo_cb_python(RIG *rig, vfo_t vfo, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(1, + self->python_callbacks.vfo_arg + ); + + PyObject_CallObject(self->python_callbacks.vfo_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} + +int *rig_ptt_cb_python(RIG *rig, vfo_t vfo, ptt_t ptt, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(1, + self->python_callbacks.ptt_arg + ); + + PyObject_CallObject(self->python_callbacks.ptt_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} + +int *rig_dcd_cb_python(RIG *rig, vfo_t vfo, dcd_t, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(1, + self->python_callbacks.dcd_arg + ); + + PyObject_CallObject(self->python_callbacks.dcd_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} + +int *rig_pltune_cb_python(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *rmode, pbwidth_t *pbwidth, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(1, + self->python_callbacks.pltune_arg + ); + + PyObject_CallObject(self->python_callbacks.pltune_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} + +int *rig_spectrum_cb_python(RIG *rig, struct rig_spectrum_line *rig_spectrum_line, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(1, + self->python_callbacks.spectrum_arg + ); + + PyObject_CallObject(self->python_callbacks.spectrum_event, python_arguments); + + Py_XDECREF(python_arguments); + + return RIG_OK; +} #endif %} @@ -374,6 +473,7 @@ int *rig_freq_cb_python(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) r->state = &r->rig->state; r->do_exception = 0; /* default is disabled */ r->error_status = RIG_OK; + return r; } ~Rig () { @@ -525,6 +625,12 @@ int *rig_freq_cb_python(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) // Handling of event callbacks #ifdef SWIGPYTHON RIG_SET_CALLBACK(freq) + RIG_SET_CALLBACK(mode) + RIG_SET_CALLBACK(vfo) + RIG_SET_CALLBACK(ptt) + RIG_SET_CALLBACK(dcd) + RIG_SET_CALLBACK(pltune) + RIG_SET_CALLBACK(spectrum) #endif int mem_count(void) { diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 7c0a2cb64..3f54a655e 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -638,6 +638,12 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) case RIG_VFO_C: priv->vfo_c.width = width; break; } + if (rig->callbacks.mode_event) + { + rig_debug(RIG_DEBUG_TRACE, "%s callbacks.mode_event(%p, %p)\n", __func__, rig->callbacks.mode_event, rig->callbacks.mode_arg); + rig->callbacks.mode_event(rig, vfo, mode, width, rig->callbacks.mode_arg); + } + RETURNFUNC(RIG_OK); } @@ -737,6 +743,12 @@ static int dummy_set_vfo(RIG *rig, vfo_t vfo) RETURNFUNC(-RIG_EINVAL); } + if (rig->callbacks.vfo_event) + { + rig_debug(RIG_DEBUG_TRACE, "%s callbacks.vfo_event(%p, %p)\n", __func__, rig->callbacks.vfo_event, rig->callbacks.vfo_arg); + rig->callbacks.vfo_event(rig, vfo, rig->callbacks.vfo_arg); + } + priv->last_vfo = priv->curr_vfo; priv->curr_vfo = vfo; STATE(rig)->current_vfo = vfo; @@ -762,6 +774,12 @@ static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) struct dummy_priv_data *priv = (struct dummy_priv_data *)STATE(rig)->priv; ENTERFUNC; + if (rig->callbacks.ptt_event) + { + rig_debug(RIG_DEBUG_TRACE, "%s callbacks.ptt_event(%p, %p)\n", __func__, rig->callbacks.ptt_event, rig->callbacks.ptt_arg); + rig->callbacks.ptt_event(rig, vfo, ptt, rig->callbacks.ptt_arg); + } + priv->ptt = ptt; RETURNFUNC(RIG_OK); commit 8324c85487c416025f6907a920f3528e36c07b8e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Aug 8 08:45:45 2025 +0200 Implement the Python callback for freq_event Fixes #481. diff --git a/bindings/ignore.swg b/bindings/ignore.swg index d09b1a232..4114aabc4 100644 --- a/bindings/ignore.swg +++ b/bindings/ignore.swg @@ -68,6 +68,7 @@ %rename("%s", regexmatch$name="^RIG_VFO_") ""; %ignore RIG_EK; // an internal macro %ignore RIG_ELAD; // an internal macro +%rename("$ignore", regexmatch$name="python_callbacks$") ""; // internal structs and methods used by bindings // Rotators diff --git a/bindings/macros.swg b/bindings/macros.swg index 9f16b9f30..888991858 100644 --- a/bindings/macros.swg +++ b/bindings/macros.swg @@ -90,3 +90,61 @@ PyObject * ##function_name(hamlib_token_t token) %define ROT_GET_VALUE_T(function_name) GET_VALUE_T(rot_, get_ ##function_name, self->rot, ROT_) %enddef + +/* + * Macro SET_CALLBACK + * + * Creates a method that stores the Python arguments and sets the C callback. + * + * function_prefix: + * the first part of the function name (eg. one of: amp_ rig_ rot_) + * + * class_pointer: + * the pointer to the instance of the class (eg. one of self->amp self->rig self->rot) + * + * event_name: + * the name that creates a valid Hamlib function name when used together + * with the function_prefix and some predefined parts + * eg. SET_CALLBACK("rig_", "freq") creates rig_set_freq_callback() + */ +%define SET_CALLBACK(function_prefix, class_pointer, event_name) +void set_ ## event_name ## _callback(PyObject *cb, PyObject *arg=NULL) +{ + void *callback; + + if (cb == Py_None) { + callback = NULL; + } else if (!PyCallable_Check(cb)) { + SWIG_Python_RaiseOrModifyTypeError("The callback isn't a Python callable object"); + return; + } else { + callback = function_prefix ## event_name ## _cb_python; + }; + + Py_XINCREF(cb); + Py_XDECREF(self->python_callbacks. ## event_name ## _event); + + Py_XINCREF(arg); + Py_XDECREF(self->python_callbacks. ## event_name ## _arg); + + self->python_callbacks. ## event_name ## _event = cb; + self->python_callbacks. ## event_name ## _arg = arg; + self->error_status = function_prefix ## set_ ## event_name ## _callback(class_pointer, callback, self); + + return; +} +%enddef + +/* + * Macro RIG_SET_CALLBACK + * + * Creates a method that stores the Python arguments and sets the C callback. + * + * event_name: + * the name that creates a valid Hamlib function name when used together + * with the function_prefix and some predefined parts + * eg. RIG_SET_CALLBACK("freq") creates rig_set_freq_callback() + */ +%define RIG_SET_CALLBACK(event_name) + SET_CALLBACK(rig_, self->rig, event_name) +%enddef diff --git a/bindings/python/test_Hamlib_Rig_class.py b/bindings/python/test_Hamlib_Rig_class.py index f8f9898ce..3ebbc8c5b 100755 --- a/bindings/python/test_Hamlib_Rig_class.py +++ b/bindings/python/test_Hamlib_Rig_class.py @@ -82,6 +82,7 @@ class TestClass: 'set_ext_level', 'set_ext_parm', 'set_freq', +'set_freq_callback', 'set_func', 'set_level', 'set_mem', diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 111311978..2b5dd863e 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -116,12 +116,27 @@ class TestClass: assert rig.get_dcs_sql() == 134 assert rig.get_dcs_sql(Hamlib.RIG_VFO_CURR) == 134 + # Callbacks + self.do_test_callbacks(rig) + assert rig.close() is None assert rig.state.comm_state == 0 assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED info = rig.get_info() assert info is None + def do_test_callbacks(self, rig): + # Frequency event callback + def freq_callback(vfo, freq, arg): + assert (1, 144200000.5, 1234567890) == (vfo, freq, arg) + + assert rig.set_freq_callback(freq_callback, 1234567890) is None + assert rig.set_freq(Hamlib.RIG_VFO_CURR, 144200000.5) is None + # TODO assert that freq_callback() is called once + assert rig.set_freq_callback(None) is None + assert rig.set_freq(Hamlib.RIG_VFO_CURR, 144210000) is None + # TODO assert that freq_callback() is called once + @pytest.mark.skipif('config.getoption("model") != Hamlib.RIG_MODEL_DUMMY') def test_misc(self, model): diff --git a/bindings/rig.swg b/bindings/rig.swg index 2245d0155..76a393e18 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -22,6 +22,7 @@ #include <hamlib/rig.h> %} +%include macros.swg %immutable rig_caps::model_name; %immutable rig_caps::mfg_name; %immutable rig_caps::version; @@ -50,12 +51,51 @@ typedef struct Rig { struct rig_state *state; /* shortcut to RIG->state */ int error_status; int do_exception; + // Handling of event callbacks +#ifdef SWIGPYTHON + // This mirrors "struct rig_callbacks" from rig.h using Python types + struct { + PyObject *freq_event; /*!< Frequency change event */ + PyObject *freq_arg; /*!< Frequency change argument */ + PyObject *mode_event; /*!< Mode change event */ + PyObject *mode_arg; /*!< Mode change argument */ + PyObject *vfo_event; /*!< VFO change event */ + PyObject *vfo_arg; /*!< VFO change argument */ + PyObject *ptt_event; /*!< PTT change event */ + PyObject *ptt_arg; /*!< PTT change argument */ + PyObject *dcd_event; /*!< DCD change event */ + PyObject *dcd_arg; /*!< DCD change argument */ + PyObject *pltune; /*!< Pipeline tuning module freq/mode/width callback */ + PyObject *pltune_arg; /*!< Pipeline tuning argument */ + PyObject *spectrum_event; /*!< Spectrum line reception event */ + PyObject *spectrum_arg; /*!< Spectrum line reception argument */ + /* etc.. */ + } python_callbacks; +#endif } Rig; typedef char * char_string; typedef channel_t * channel_t_p; typedef channel_t * const_channel_t_p; +#ifdef SWIGPYTHON +int *rig_freq_cb_python(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) +{ + Rig *self = arg; + PyObject *python_arguments; + + python_arguments = PyTuple_Pack(3, + PyLong_FromLong(vfo), + PyFloat_FromDouble(freq), + self->python_callbacks.freq_arg + ); + + PyObject_CallObject(self->python_callbacks.freq_event, python_arguments); + Py_XDECREF(python_arguments); + + return RIG_OK; +} +#endif %} %extend channel { @@ -482,6 +522,11 @@ typedef channel_t * const_channel_t_p; METHOD1GET(get_trn, int) METHOD1VGET(get_dcd, dcd_t) + // Handling of event callbacks +#ifdef SWIGPYTHON + RIG_SET_CALLBACK(freq) +#endif + int mem_count(void) { return rig_mem_count(self->rig); } @@ -648,5 +693,4 @@ struct channel *Rig_get_chan_all(Rig *self) return chans; } - %} diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 020fdaeb2..7c0a2cb64 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -488,6 +488,12 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq) case RIG_VFO_C: priv->vfo_c.freq = freq; break; } + if (rig->callbacks.freq_event) + { + rig_debug(RIG_DEBUG_TRACE, "%s callbacks.freq_event(%p, %p)\n", __func__, rig->callbacks.freq_event, rig->callbacks.freq_arg); + rig->callbacks.freq_event(rig, vfo, freq, rig->callbacks.freq_arg); + } + if (!priv->split) { priv->curr->tx_freq = freq; ----------------------------------------------------------------------- Summary of changes: bindings/ignore.swg | 2 + bindings/macros.swg | 58 +++++++++++ bindings/python/test_Hamlib_Rig_class.py | 7 ++ bindings/python/test_rig.py | 136 +++++++++++++++++++++---- bindings/rig.swg | 170 ++++++++++++++++++++++++++++++- include/hamlib/rig.h | 3 +- rigs/dummy/dummy.c | 26 ++++- 7 files changed, 379 insertions(+), 23 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-08 19:17: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 2462ab0a135ca0274a069e27c319c90957d70ac1 (commit) from 93a24356e5ad79a12865967b32f4524080f044dd (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 2462ab0a135ca0274a069e27c319c90957d70ac1 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 4 20:51:19 2025 +0200 Improve Doxygen comments Adds missing cross-references. Fix tagging of comment blocks in "aor" even if the rigs aren't included in the generated documentation. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index a5a7901bb..a6f472bda 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2646,13 +2646,13 @@ typedef int (*spectrum_cb_t)(RIG *, * Events from the rig are received through async io, * so callback functions will be called from the SIGIO sighandler context. * - * Don't set these fields directly, use rig_set_freq_callback et. al. instead. + * Don't set these fields directly, use rig_set_freq_callback() et. al. instead. * * Callbacks suit event based programming very well, * really appropriate in a GUI. * - * \sa rig_set_freq_callback(), rig_set_mode_callback(), rig_set_vfo_callback(), - * rig_set_ptt_callback(), rig_set_dcd_callback() + * \sa rig_set_dcd_callback(), rig_set_freq_callback(), rig_set_mode_callback(), + * rig_set_ptt_callback(), rig_set_spectrum_callback(), rig_set_vfo_callback() */ // Do NOT add/remove from this structure -- it will break DLL backwards compatibility struct rig_callbacks { diff --git a/rigs/aor/ar7030p.c b/rigs/aor/ar7030p.c index 7ed486006..264a76342 100644 --- a/rigs/aor/ar7030p.c +++ b/rigs/aor/ar7030p.c @@ -467,7 +467,7 @@ static const char *ar7030p_get_info(RIG *rig) return (p); } -/* +/** * \brief Set receiver frequency * * \param rig Pointer to rig struct @@ -527,7 +527,7 @@ static int ar7030p_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return (rc); } -/* +/** * \brief Get receiver frequency * * \param rig Pointer to rig struct @@ -583,7 +583,7 @@ static int ar7030p_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return (rc); } -/* +/** * \brief Set receiver mode * * \param rig Pointer to rig struct @@ -649,7 +649,7 @@ static int ar7030p_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, return (rc); } -/* +/** * \brief Get receiver mode and bandwidth * * \param rig Pointer to rig struct @@ -693,7 +693,7 @@ static int ar7030p_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, return (rc); } -/* +/** * \brief Get memory channel parameters * * \param rig Pointer to rig struct @@ -817,7 +817,7 @@ static void ar7030p_get_memory(RIG *rig, const unsigned int chan, } #endif /* unused */ -/* +/** * \brief Set receiver levels * * \param rig Pointer to rig struct @@ -995,7 +995,7 @@ static int ar7030p_set_level(RIG *rig, vfo_t vfo, setting_t level, } -/* +/** * \brief Get receiver levels * * \param rig Pointer to rig struct @@ -1468,7 +1468,7 @@ static int ar7030p_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) return (rc); } -/* +/** * \brief Get receiver tuning step size * * \param rig Pointer to rig struct @@ -1505,7 +1505,7 @@ static int ar7030p_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) return (rc); } -/* +/** * \brief Set receiver power status * * \param rig Pointer to rig struct @@ -1541,7 +1541,7 @@ static int ar7030p_set_powerstat(RIG *rig, powerstat_t status) return (-RIG_ENIMPL); } -/* +/** * \brief Get receiver power status * * \param rig Pointer to rig struct @@ -1580,7 +1580,7 @@ static int ar7030p_get_powerstat(RIG *rig, powerstat_t *status) return (rc); } -/* +/** * \brief Reset receiver * * \param rig Pointer to rig struct diff --git a/rigs/aor/ar7030p_utils.c b/rigs/aor/ar7030p_utils.c index d63504ede..f5688fdf4 100644 --- a/rigs/aor/ar7030p_utils.c +++ b/rigs/aor/ar7030p_utils.c @@ -512,7 +512,7 @@ static int setAddr(RIG *rig, enum PAGE_e page, unsigned int addr) return (rc); } -/* +/** * \brief Write one byte to the receiver * * \param rig Pointer to rig struct @@ -553,8 +553,8 @@ int writeByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x) return (rc); } -/* - * \brief Write two bytes to the receiver +/** + * brief Write two bytes to the receiver * * \param rig Pointer to rig struct * \param page Memory page number (0-4, 15) @@ -580,7 +580,7 @@ int writeShort(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short x) return (rc); } -/* +/** * \brief Write three bytes to the receiver * * \param rig Pointer to rig struct @@ -615,7 +615,7 @@ int write3Bytes(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x) #ifdef XXREMOVEDXX // this function is not referenced anywhere -/* +/** * \brief Write unsigned int (4 bytes) to the receiver * * \param rig Pointer to rig struct @@ -655,7 +655,7 @@ int writeInt(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x) } #endif -/* +/** * \brief Read one byte from the receiver * * \param rig Pointer to rig struct @@ -696,7 +696,7 @@ int readByte(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x) return (rc); } -/* +/** * \brief Read an unsigned short (two bytes) from the receiver * * \param rig Pointer to rig struct @@ -733,7 +733,7 @@ int readShort(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short *x) return (rc); } -/* +/** * \brief Read an unsigned int (three bytes) from the receiver * * \param rig Pointer to rig struct @@ -778,7 +778,7 @@ int read3Bytes(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x) #ifdef XXREMOVEDXX // this function is not referenced anywhere -/* +/** * \brief Read an unsigned int (four bytes) from the receiver * * \param rig Pointer to rig struct @@ -826,7 +826,7 @@ int readInt(RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x) } #endif -/* +/** * \brief Read raw AGC value from the radio * * \param rig Pointer to rig struct @@ -857,7 +857,7 @@ int readSignal(RIG *rig, unsigned char *x) #ifdef XXREMOVEDXX // this function is not referenced anywhere -/* +/** * \brief Flush I/O with radio * * \param rig Pointer to rig struct @@ -879,7 +879,7 @@ int flushBuffer(RIG *rig) } #endif -/* +/** * \brief Lock receiver for remote operations * * \param rig Pointer to rig struct @@ -919,7 +919,7 @@ int lockRx(RIG *rig, enum LOCK_LVL_e level) return (rc); } -/* +/** * \brief Convert one byte BCD value to int * * \param bcd BCD value (0-99) @@ -949,7 +949,7 @@ int bcd2Int(const unsigned char bcd) return (rc); } -/* +/** * \brief Convert raw AGC value to calibrated level in dBm * * \param rig Pointer to rig struct @@ -1073,7 +1073,7 @@ int getCalLevel(RIG *rig, unsigned char rawAgc, int *dbm) return (rc); } -/* +/** * \brief Get bandwidth of given filter * * \param rig Pointer to rig struct @@ -1103,7 +1103,7 @@ int getFilterBW(RIG *rig, enum FILTER_e filter) return (rc); } -/* +/** * \brief Convert DDS steps to frequency in Hz * * \param steps DDS count @@ -1119,7 +1119,7 @@ freq_t ddsToHz(const unsigned int steps) return (rc); } -/* +/** * \brief Convert frequency in Hz to DDS steps * * \param freq Frequency in Hz @@ -1155,7 +1155,7 @@ unsigned int hzToDDS(const freq_t freq) return (rc); } -/* +/** * \brief Convert PBS/BFO steps to frequency in Hz * * \param steps PBS/BFO offset steps @@ -1186,8 +1186,8 @@ float pbsToHz(const unsigned char steps) #ifdef XXREMOVEDXX // this function is not referenced anywhere -/* - * \brief Convert PBS/BFO offset frequency in Hz to steps +/** + * brief Convert PBS/BFO offset frequency in Hz to steps * * \param freq Offset frequency in Hz * @@ -1228,8 +1228,8 @@ unsigned char hzToPBS(const float freq) } #endif -/* - * \brief Convert native Mode to Hamlib mode +/** + * brief Convert native Mode to Hamlib mode * * \param mode Native mode value * @@ -1279,8 +1279,8 @@ rmode_t modeToHamlib(const unsigned char mode) return (rc); } -/* - * \brief Convert Hamlib Mode to native mode +/** + * brief Convert Hamlib Mode to native mode * * \param mode Hamlib mode value * @@ -1330,8 +1330,8 @@ unsigned char modeToNative(const rmode_t mode) return (rc); } -/* - * \brief Convert native AGC speed to Hamlib AGC speed +/** + * brief Convert native AGC speed to Hamlib AGC speed * * \param agc Native AGC speed value * @@ -1369,8 +1369,8 @@ enum agc_level_e agcToHamlib(const unsigned char agc) return (rc); } -/* - * \brief Convert Hamlib AGC speed to native AGC speed +/** + * brief Convert Hamlib AGC speed to native AGC speed * * \param agc Hamlib AGC speed value * @@ -1412,8 +1412,8 @@ unsigned char agcToNative(const enum agc_level_e agc) return (rc); } -/* - * \brief Get page size +/** + * brief Get page size * * \param page Page to get size of * @@ -1439,8 +1439,8 @@ int pageSize(const enum PAGE_e page) return (rc); } -/* - * \brief Set and execute IR controller code +/** + * brief Set and execute IR controller code * * \param code IR code to execute * diff --git a/src/amplifier.c b/src/amplifier.c index 4863b8046..e6dceb5a5 100644 --- a/src/amplifier.c +++ b/src/amplifier.c @@ -962,7 +962,7 @@ int HAMLIB_API amp_get_powerstat(AMP *amp, powerstat_t *status) /** * \brief Get the address of amplifier data structure(s) * - * \sa rig_data_pointer + * \sa rig_data_pointer(), rot_data_pointer() * */ void *HAMLIB_API amp_data_pointer(AMP *amp, rig_ptrx_t idx) diff --git a/src/extamp.c b/src/extamp.c index c00ccec31..1510d140b 100644 --- a/src/extamp.c +++ b/src/extamp.c @@ -62,7 +62,7 @@ * not strictly positive. * * \returns A zero value which means a normal end of iteration, or a - * **negative value** which means an abnormal end, + * **negative value** which means an abnormal end. * * \retval RIG_OK All extension levels elements successfully processed. * \retval -RIG_EINVAL \a amp or \a cfunc is NULL or inconsistent. diff --git a/src/rig.c b/src/rig.c index 706ca4d91..8e0ca4e00 100644 --- a/src/rig.c +++ b/src/rig.c @@ -9056,7 +9056,7 @@ int morse_data_handler_set_keyspd(RIG *rig, int keyspd) } #endif -/* +/** * \brief Get the address of a Hamlib data structure * \param rig Pointer to main data anchor * \param idx enum for which pointer requested @@ -9069,7 +9069,7 @@ int morse_data_handler_set_keyspd(RIG *rig, int keyspd) * Note: This is meant for use by the HAMLIB_???PORT macros mostly. Only * compatibility with them is supported. * - * \sa amp_data_pointer, rot_data_pointer + * \sa amp_data_pointer(), rot_data_pointer() */ HAMLIB_EXPORT(void *) rig_data_pointer(RIG *rig, rig_ptrx_t idx) { diff --git a/src/rotator.c b/src/rotator.c index ecb7422bf..1b9b2b0de 100644 --- a/src/rotator.c +++ b/src/rotator.c @@ -1089,7 +1089,7 @@ int HAMLIB_API rot_get_status(ROT *rot, rot_status_t *status) /** * \brief Get the address of rotator data structure(s) * - * \sa rig_data_pointer + * \sa amp_data_pointer(), rig_data_pointer() * */ void *HAMLIB_API rot_data_pointer(ROT *rot, rig_ptrx_t idx) ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 6 ++--- rigs/aor/ar7030p.c | 22 ++++++++--------- rigs/aor/ar7030p_utils.c | 64 ++++++++++++++++++++++++------------------------ src/amplifier.c | 2 +- src/extamp.c | 2 +- src/rig.c | 4 +-- src/rotator.c | 2 +- 7 files changed, 51 insertions(+), 51 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-07 13:11:32
|
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 93a24356e5ad79a12865967b32f4524080f044dd (commit) via 891070941f30bf474dfeb9c913aa6387f48fe49c (commit) via 5b1517778e20f04f18ca0e9a89c32f0a01b78783 (commit) via 8887294cd85a1c53bd6fef428b735b7eaee6c6ae (commit) via 5b87b3870432b7492558c686f3a3e4c13321db0a (commit) via 4251c50b7fda0fe2710a4ba28776ec4c7fe579a8 (commit) via 49c78edb80a992d69940a31139a0b49a53f795ce (commit) via 59acdb791eaa594193ae17213aa23a8e1efdd02f (commit) via 032e78826e05ee09ab761ee1abdac26dc3ea4ca8 (commit) via d5c5eeff15df9c520ad71c1a8ebdeb04f3dae59e (commit) via af4c6ec8061dc876ccb3c4cb746db2f3b9f09546 (commit) via 9dd0009f9e14100adf10cc4abe058237f4eb1a6c (commit) via 816d6d9befa3c14f4859257ab60fd0292d1319a0 (commit) via 249a99363363fab3b37eac66c9f83323988427af (commit) via 8064da81214c66374cf864942c3b8692f50cc0cf (commit) via d9532a9c62a6b31948968838b870bdc7e2b0e396 (commit) via f691a68c069bbd32c938249f3dbd4a1d112e5c97 (commit) via 725fcee0048c6554d8c4c5393f52c350bb662e48 (commit) via 151549bb3b828596dc5b67d02bd446842655608a (commit) via 790820ab22cde0b8a251356d3513ad41f20f1f3c (commit) via b809937395457fadb9fa3ab98ad8a4ff52e9fa7d (commit) via 498b45f5b08f5b2b207b9f5f0d6b6da3f116f31b (commit) via a5467f403305f1ae925dc458e6a010caa4f7ac3c (commit) via 10f65048976741ae10dff7a148eb557a2836c37a (commit) via f8881f9bb9a3180f97a87f098dc8a76e74238f20 (commit) via 9e51419ab8a147573fa718896ac59d18eb257bc0 (commit) via c26f0333958e80d70c3f23535b895bb8075b394b (commit) via 99df93067c15dc02c59618d268a970c130adf4c2 (commit) via f89ebfd226c91cda8bd29de8ac6fddf00dad51e5 (commit) via df7fbbec9bff75398064e5c7fba4453d84fb5436 (commit) via 3b2a95053bd529883e76cc973b0f374f506ac98d (commit) via 1568a6c7fc1548ba2b590aa48fca70a550d61179 (commit) via 98a81a507400867065dd257524a9357cdb9b3397 (commit) via 7fc222dc8852eb88749202727278fe259b3a2463 (commit) via ecece62828fa0d9a5629fb0e5b0025c20e1f5b18 (commit) via 16a69722e26baa131bca2b176404d0748ea34419 (commit) via b5d136ff083ae5a07cda98ff1bf3218456da635b (commit) via f3e2ea9e3d0f0c9cd3a200a7a1fe60d5fff8b4f7 (commit) via 3009ec86b772a4d6ed2b0005466f61ff437f8b91 (commit) via 17b301a371e201019fe4decedece3be3bc74c351 (commit) via e8467032ad8e948aa3f03777c043b42b9a3d96b0 (commit) from 70d50d0efbbdd84157c9cd89043744f07d15bfd8 (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 93a24356e5ad79a12865967b32f4524080f044dd Merge: 70d50d0ef 891070941 Author: Nate Bargmann <n0...@n0...> Date: Thu Aug 7 07:26:47 2025 -0500 Merge GitHub PR #1831 commit 891070941f30bf474dfeb9c913aa6387f48fe49c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Thu Aug 7 14:14:58 2025 +0200 Fix compiler warnings Fixes: simic905.c:108:9: warning: label followed by a declaration is a C23 extension [-Wc23-extensions] simic910.c:112:9: warning: label followed by a declaration is a C23 extension [-Wc23-extensions] diff --git a/simulators/simic905.c b/simulators/simic905.c index 581d45f08..962d6fc97 100644 --- a/simulators/simic905.c +++ b/simulators/simic905.c @@ -84,6 +84,7 @@ frameGet(int fd, unsigned char *buf) void frameParse(int fd, unsigned char *frame, int len) { double freq; + int freq_len = 5; if (len == 0) { @@ -105,7 +106,6 @@ void frameParse(int fd, unsigned char *frame, int len) case 0x03: //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); - int freq_len = 5; if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { diff --git a/simulators/simic910.c b/simulators/simic910.c index ac3bb8759..2b6b3f255 100644 --- a/simulators/simic910.c +++ b/simulators/simic910.c @@ -85,6 +85,7 @@ frameGet(int fd, unsigned char *buf) void frameParse(int fd, unsigned char *frame, int len) { double freq; + int freq_len = 5; if (len == 0) { @@ -109,7 +110,6 @@ void frameParse(int fd, unsigned char *frame, int len) case 0x03: //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); - int freq_len = 5; if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { commit 5b1517778e20f04f18ca0e9a89c32f0a01b78783 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Thu Aug 7 11:38:12 2025 +0200 Replace "goto again" with "continue" (third case) When the software on the other side of the pty closes the device, the simulator would close and reopen its side but it is unneeded because it can continue to call read() without doing anything special. diff --git a/simulators/simatd578.c b/simulators/simatd578.c index ad897ebec..b6d5e43de 100644 --- a/simulators/simatd578.c +++ b/simulators/simatd578.c @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE], buf2[256]; -again: int fd = openPort(argv[1]); while (1) @@ -63,8 +62,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 8) diff --git a/simulators/simft1000.c b/simulators/simft1000.c index 14485a74d..30e2429e3 100644 --- a/simulators/simft1000.c +++ b/simulators/simft1000.c @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -30,8 +29,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simft736.c b/simulators/simft736.c index 28b7c77b4..c10614dfc 100644 --- a/simulators/simft736.c +++ b/simulators/simft736.c @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -30,8 +29,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simft747gx.c b/simulators/simft747gx.c index a52076cb5..5fca30362 100644 --- a/simulators/simft747gx.c +++ b/simulators/simft747gx.c @@ -23,7 +23,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -32,8 +31,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simft817.c b/simulators/simft817.c index 583c24f16..cd9ebeaa2 100644 --- a/simulators/simft817.c +++ b/simulators/simft817.c @@ -22,7 +22,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -31,8 +30,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simft847.c b/simulators/simft847.c index c3c6befd0..a8800012a 100644 --- a/simulators/simft847.c +++ b/simulators/simft847.c @@ -24,7 +24,6 @@ int main(int argc, char *argv[]) unsigned char buf[BUFSIZE]; int freq, i, n; -again: int fd = openPort(argv[1]); while (1) @@ -33,8 +32,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simft897.c b/simulators/simft897.c index 0e2d2210e..0af8f83c8 100644 --- a/simulators/simft897.c +++ b/simulators/simft897.c @@ -25,7 +25,6 @@ int main(int argc, char *argv[]) unsigned char buf[BUFSIZE]; int n; -again: int fd = openPort(argv[1]); while (1) @@ -34,8 +33,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simjupiter.c b/simulators/simjupiter.c index 706546cae..9c96078d0 100644 --- a/simulators/simjupiter.c +++ b/simulators/simjupiter.c @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -30,8 +29,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) diff --git a/simulators/simmicom.c b/simulators/simmicom.c index 4b03e03d5..3b25b6c0b 100644 --- a/simulators/simmicom.c +++ b/simulators/simmicom.c @@ -50,7 +50,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -59,8 +58,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } switch (buf[3]) diff --git a/simulators/simorion.c b/simulators/simorion.c index 36de57b65..642e40b1e 100644 --- a/simulators/simorion.c +++ b/simulators/simorion.c @@ -40,7 +40,6 @@ int main(int argc, char *argv[]) { char buf[BUFSIZE], reply[256]; -again: int fd = openPort(argv[1]); while (1) @@ -49,8 +48,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (strncmp(buf, "?V", 2) == 0) diff --git a/simulators/simpmr171.c b/simulators/simpmr171.c index 14cd5b488..adf726425 100644 --- a/simulators/simpmr171.c +++ b/simulators/simpmr171.c @@ -56,7 +56,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -65,8 +64,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } switch (buf[5]) diff --git a/simulators/simspid.c b/simulators/simspid.c index 706546cae..9c96078d0 100644 --- a/simulators/simspid.c +++ b/simulators/simspid.c @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; -again: int fd = openPort(argv[1]); while (1) @@ -30,8 +29,7 @@ again: if (bytes == 0) { - close(fd); - goto again; + continue; } if (bytes != 5) commit 8887294cd85a1c53bd6fef428b735b7eaee6c6ae Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Thu Aug 7 11:22:44 2025 +0200 Replace "goto again" with "continue" (second case) Does the same thing with more structured control flow. It also silences compiler warnings. diff --git a/simulators/simeasycomm.c b/simulators/simeasycomm.c index a774e5fcc..da5647650 100644 --- a/simulators/simeasycomm.c +++ b/simulators/simeasycomm.c @@ -111,7 +111,6 @@ static void *rotorez_thread(void *arg) int fd = *(int *)arg; float az = 123; float el = 45; -again: while (1) { @@ -120,10 +119,8 @@ again: if (bytes == 0) { - //close(fd); hl_usleep(100 * 1000); - //printf("again\n"); - goto again; + continue; } printf("line[%d]=%s\n", fd, buf); diff --git a/simulators/simrotorez.c b/simulators/simrotorez.c index 48b0042ba..7b4ba21d5 100644 --- a/simulators/simrotorez.c +++ b/simulators/simrotorez.c @@ -111,7 +111,6 @@ static void *rotorez_thread(void *arg) int fd = *(int *)arg; float az = 123; float el = 45; -again: while (1) { @@ -120,10 +119,8 @@ again: if (bytes == 0) { - //close(fd); hl_usleep(100 * 1000); - //printf("again\n"); - goto again; + continue; } printf("line[%d]=%s\n", fd, buf); commit 5b87b3870432b7492558c686f3a3e4c13321db0a Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Thu Aug 7 11:10:31 2025 +0200 Replace "goto again" with "continue" (first case) Does the same thing with more structured control flow. It also silences compiler warnings. diff --git a/simulators/simic2730.c b/simulators/simic2730.c index 441fa311a..a509ba01f 100644 --- a/simulators/simic2730.c +++ b/simulators/simic2730.c @@ -47,8 +47,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -79,7 +77,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic275.c b/simulators/simic275.c index 9b5abe810..8d8b1e7ff 100644 --- a/simulators/simic275.c +++ b/simulators/simic275.c @@ -47,8 +47,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -79,7 +77,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7000.c b/simulators/simic7000.c index cb4ff005a..fb3a76572 100644 --- a/simulators/simic7000.c +++ b/simulators/simic7000.c @@ -46,8 +46,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -77,7 +75,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic705.c b/simulators/simic705.c index 277af171e..1ab2cd567 100644 --- a/simulators/simic705.c +++ b/simulators/simic705.c @@ -54,8 +54,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -79,7 +77,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7100.c b/simulators/simic7100.c index 368fc0dc5..2dc1c3ddf 100644 --- a/simulators/simic7100.c +++ b/simulators/simic7100.c @@ -46,8 +46,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -78,7 +76,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7200.c b/simulators/simic7200.c index c717cb9d2..90ab1e47a 100644 --- a/simulators/simic7200.c +++ b/simulators/simic7200.c @@ -57,8 +57,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -91,7 +89,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7300.c b/simulators/simic7300.c index 89c4d4238..2f9d6152f 100644 --- a/simulators/simic7300.c +++ b/simulators/simic7300.c @@ -47,8 +47,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -78,7 +76,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7600.c b/simulators/simic7600.c index f72390d80..610c4524b 100644 --- a/simulators/simic7600.c +++ b/simulators/simic7600.c @@ -45,8 +45,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -70,7 +68,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7610.c b/simulators/simic7610.c index 65d294bae..9bc14af39 100644 --- a/simulators/simic7610.c +++ b/simulators/simic7610.c @@ -48,8 +48,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -73,7 +71,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7700.c b/simulators/simic7700.c index 88faef544..4f7b671c0 100644 --- a/simulators/simic7700.c +++ b/simulators/simic7700.c @@ -48,8 +48,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -73,7 +71,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic7851.c b/simulators/simic7851.c index 04202ccc5..07074c256 100644 --- a/simulators/simic7851.c +++ b/simulators/simic7851.c @@ -51,8 +51,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c = 0xff; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -77,7 +75,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic905.c b/simulators/simic905.c index c39a67e00..581d45f08 100644 --- a/simulators/simic905.c +++ b/simulators/simic905.c @@ -49,8 +49,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -74,7 +72,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic910.c b/simulators/simic910.c index 3d04e3091..ac3bb8759 100644 --- a/simulators/simic910.c +++ b/simulators/simic910.c @@ -50,8 +50,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -75,7 +73,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic9100.c b/simulators/simic9100.c index 0329fe1b5..82c9efd6d 100644 --- a/simulators/simic9100.c +++ b/simulators/simic9100.c @@ -44,8 +44,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -69,7 +67,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simic9700.c b/simulators/simic9700.c index 5f6c3165e..61d26aba2 100644 --- a/simulators/simic9700.c +++ b/simulators/simic9700.c @@ -46,8 +46,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -71,7 +69,7 @@ again: } i = 0; - goto again; + continue; } } diff --git a/simulators/simid5100.c b/simulators/simid5100.c index 262ecc362..b6d4b47d6 100644 --- a/simulators/simid5100.c +++ b/simulators/simid5100.c @@ -42,8 +42,6 @@ frameGet(int fd, unsigned char *buf) memset(buf, 0, BUFSIZE); unsigned char c; -again: - while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -67,7 +65,7 @@ again: } i = 0; - goto again; + continue; } } commit 4251c50b7fda0fe2710a4ba28776ec4c7fe579a8 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 6 22:48:20 2025 +0200 Fix reading line when the client (eg. rigctl) closes Fixes an infinite stream of debug output because it erroneously appeared to have read 1 byte instead of 0: n=1 00 Not 8 bytes? bytes=1 Unknown cmd=00 Tested with: tests/rigctl -m 37001 -r /dev/pts/6 f (however it doesn't read the frequency because it looks like the protocol is different or incomplete, rigs/anytone/d578.c is still in beta) diff --git a/simulators/simatd578.c b/simulators/simatd578.c index 661338c6c..ad897ebec 100644 --- a/simulators/simatd578.c +++ b/simulators/simatd578.c @@ -5,6 +5,8 @@ #include <string.h> #include <unistd.h> +#include "sim.h" + #define BUFSIZE 256 float freqA = 14074000; @@ -36,20 +38,15 @@ _getmyline(int fd, unsigned char *buf) { buf[i++] = c; } - - n++; } while (c != 0x0a); - printf("n=%d \n", n); - - for (i = 0; i < n; ++i) { printf("%02x ", buf[i]); } - + printf("n=%d", i); + for (n = 0; n < i; ++n) { printf(" %02x", buf[n]); } printf("\n"); - return n; -} -#include "sim.h" + return i; +} int main(int argc, char *argv[]) commit 49c78edb80a992d69940a31139a0b49a53f795ce Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 6 21:49:17 2025 +0200 Make code more uniform diff --git a/simulators/simft847.c b/simulators/simft847.c index d05f4c721..c3c6befd0 100644 --- a/simulators/simft847.c +++ b/simulators/simft847.c @@ -24,7 +24,6 @@ int main(int argc, char *argv[]) unsigned char buf[BUFSIZE]; int freq, i, n; - again: int fd = openPort(argv[1]); diff --git a/simulators/simft897.c b/simulators/simft897.c index 336e1951d..0e2d2210e 100644 --- a/simulators/simft897.c +++ b/simulators/simft897.c @@ -25,7 +25,6 @@ int main(int argc, char *argv[]) unsigned char buf[BUFSIZE]; int n; - again: int fd = openPort(argv[1]); diff --git a/simulators/simmicom.c b/simulators/simmicom.c index dfc80ea99..4b03e03d5 100644 --- a/simulators/simmicom.c +++ b/simulators/simmicom.c @@ -50,7 +50,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; - again: int fd = openPort(argv[1]); diff --git a/simulators/simspid.c b/simulators/simspid.c index 1218d13f2..706546cae 100644 --- a/simulators/simspid.c +++ b/simulators/simspid.c @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; - again: int fd = openPort(argv[1]); commit 59acdb791eaa594193ae17213aa23a8e1efdd02f Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Wed Aug 6 09:34:04 2025 +0200 Fix compiler warning Move both initialization outside of the conditional. Fixes: simyaesu.c:364:12: warning: ‘pbuf’ may be used uninitialized [-Wmaybe-uninitialized] diff --git a/simulators/simyaesu.c b/simulators/simyaesu.c index 40b179c6e..fd610c6b5 100644 --- a/simulators/simyaesu.c +++ b/simulators/simyaesu.c @@ -42,8 +42,6 @@ int main(int argc, char *argv[]) if (getmyline(fd, buf)) { printf("Cmd:%s\n", buf); - resp[0] = 0; - pbuf = NULL; } //else { return 0; } @@ -55,6 +53,9 @@ int main(int argc, char *argv[]) if (power == 0 && strcmp(buf, "PS1;") != 0) { continue; } + resp[0] = 0; + pbuf = NULL; + if (strcmp(buf, "PS;") == 0) { sprintf(resp, "PS%d;", power); commit 032e78826e05ee09ab761ee1abdac26dc3ea4ca8 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 23:42:06 2025 +0200 Fix BC and FO commands The following command work from rigctl: get_freq get_ctcss_tone get_rig_info. Uses the information from the manual linked at the top of rig/kenwood/tmd710.c. Fixes: simtmd710.c:64:44: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘double’ [-Wformat=] simtmd710.c:68:44: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘double’ [-Wformat=] diff --git a/simulators/simtmd710.c b/simulators/simtmd710.c index 3cc216b17..3e5a8b9e7 100644 --- a/simulators/simtmd710.c +++ b/simulators/simtmd710.c @@ -52,21 +52,26 @@ int main(int argc, char *argv[]) if (strncmp(buf, "BC", 2) == 0) { - SNPRINTF(buf, sizeof(buf), "BC %d %d%c", vfo, vfo_tx, 0x0d); + SNPRINTF(buf, sizeof(buf), "BC %d,%d%c", vfo, vfo_tx, 0x0d); printf("R:%s\n", buf); write(fd, buf, strlen(buf)); continue; } else if (strncmp(buf, "FO", 2) == 0) { - if (buf[3] == '0') - { - SNPRINTF(buf, sizeof(buf), "FO 0 %d%c", freqA, 0x0d); - } - else - { - SNPRINTF(buf, sizeof(buf), "FO 1 %d%c", freqB, 0x0d); + char vfo = buf[3]; + int frequency; + char tone_frequency[] = "10"; // 94.8 + char ctcss_frequency[] = "05"; // 79,7 + char dcs_frequency[] = "016"; // 114 + + if (vfo == '0') { + frequency = (int)freqA; + } else { + frequency = (int)freqB; } + SNPRINTF(buf, sizeof(buf), "FO %c,%.10d,0,0,0,0,0,0,%.2s,%.2s,%.3s,00000000,0%c", + vfo, frequency, tone_frequency, ctcss_frequency, dcs_frequency, 0x0d); printf("R:%s\n", buf); write(fd, buf, strlen(buf)); commit d5c5eeff15df9c520ad71c1a8ebdeb04f3dae59e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 22:18:54 2025 +0200 No need to use strlen() because the i variable counted the chars read diff --git a/simulators/sim.h b/simulators/sim.h index e1cc194cc..206f45686 100644 --- a/simulators/sim.h +++ b/simulators/sim.h @@ -102,17 +102,17 @@ getmyline(int fd, char *buf) char c; int i = 0; memset(buf, 0, BUFSIZE); - + while (read(fd, &c, 1) > 0) { buf[i++] = c; - - if (c == ';') { return strlen(buf); } + + if (c == ';') { return i; } } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); + + if (i == 0) { hl_usleep(10 * 1000); } + + return i; } int commit af4c6ec8061dc876ccb3c4cb746db2f3b9f09546 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 22:16:48 2025 +0200 Make the output of simft990 more friendly diff --git a/simulators/simft990.c b/simulators/simft990.c index 6f3a91256..0e22bea25 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -7,6 +7,7 @@ #include <string.h> #include <unistd.h> +#include "sim.h" float freqA = 14074000; float freqB = 14074500; @@ -44,14 +45,11 @@ static void load_dat(const char *filename, unsigned char buf[ALL_DATA_SIZE]) } fclose(fp); - printf("%d bytes read\n", n); + printf("%d bytes read from file %s\n", n, filename); } static unsigned char alldata[ALL_DATA_SIZE]; -#include "sim.h" - - int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE]; @@ -68,8 +66,11 @@ int main(int argc, char *argv[]) if (bytes != 5) { printf("Not 5 bytes? bytes=%d\n", bytes); + continue; } + // Protocol of rigs/yaesu/ft990v12.c + if (buf[4] == 0x10) { write(fd, alldata, ALL_DATA_SIZE); commit 9dd0009f9e14100adf10cc4abe058237f4eb1a6c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 21:56:26 2025 +0200 Remove unused define diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index a7740ac11..acc931d09 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -10,7 +10,6 @@ #include "sim.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simelecraftk4.c b/simulators/simelecraftk4.c index 2b5e67e09..edd31061b 100644 --- a/simulators/simelecraftk4.c +++ b/simulators/simelecraftk4.c @@ -9,7 +9,6 @@ #include "sim.h" #include "misc.h" -#define BUFSIZE 256 int freqA = 14074000; int freqB = 14074500; diff --git a/simulators/simft450.c b/simulators/simft450.c index 50b73f823..f97c6631f 100644 --- a/simulators/simft450.c +++ b/simulators/simft450.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simft710.c b/simulators/simft710.c index d3f01e6f4..525f49bbb 100644 --- a/simulators/simft710.c +++ b/simulators/simft710.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simft818.c b/simulators/simft818.c index e9843b2c8..79813b509 100644 --- a/simulators/simft818.c +++ b/simulators/simft818.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simft990.c b/simulators/simft990.c index 9d1b1ab67..6f3a91256 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -7,7 +7,6 @@ #include <string.h> #include <unistd.h> -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simft991.c b/simulators/simft991.c index 603007d85..fb1d9e829 100644 --- a/simulators/simft991.c +++ b/simulators/simft991.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simftdx101.c b/simulators/simftdx101.c index 1304f7f40..eb240a300 100644 --- a/simulators/simftdx101.c +++ b/simulators/simftdx101.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simftdx1200.c b/simulators/simftdx1200.c index a53c8e0c7..f6b56820f 100644 --- a/simulators/simftdx1200.c +++ b/simulators/simftdx1200.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simftdx3000.c b/simulators/simftdx3000.c index 8e7917062..d4cd4f851 100644 --- a/simulators/simftdx3000.c +++ b/simulators/simftdx3000.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simftdx5000.c b/simulators/simftdx5000.c index 034e528d1..121542f4c 100644 --- a/simulators/simftdx5000.c +++ b/simulators/simftdx5000.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simic2730.c b/simulators/simic2730.c index fa044eefe..441fa311a 100644 --- a/simulators/simic2730.c +++ b/simulators/simic2730.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic275.c b/simulators/simic275.c index 11023c0a9..9b5abe810 100644 --- a/simulators/simic275.c +++ b/simulators/simic275.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7000.c b/simulators/simic7000.c index d02aa2142..cb4ff005a 100644 --- a/simulators/simic7000.c +++ b/simulators/simic7000.c @@ -13,7 +13,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic705.c b/simulators/simic705.c index 47abe673f..277af171e 100644 --- a/simulators/simic705.c +++ b/simulators/simic705.c @@ -19,7 +19,6 @@ */ #include "../rigs/icom/icom_defs.h" -#define BUFSIZE 256 #define X25 #undef SATMODE diff --git a/simulators/simic7100.c b/simulators/simic7100.c index e2502f52e..368fc0dc5 100644 --- a/simulators/simic7100.c +++ b/simulators/simic7100.c @@ -15,7 +15,6 @@ #undef ECHO -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7200.c b/simulators/simic7200.c index e33c22543..c717cb9d2 100644 --- a/simulators/simic7200.c +++ b/simulators/simic7200.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7300.c b/simulators/simic7300.c index f6f0b8687..89c4d4238 100644 --- a/simulators/simic7300.c +++ b/simulators/simic7300.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7600.c b/simulators/simic7600.c index eb9232e00..f72390d80 100644 --- a/simulators/simic7600.c +++ b/simulators/simic7600.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 //#define X25 int civ_731_mode = 0; diff --git a/simulators/simic7610.c b/simulators/simic7610.c index f38f36cf3..65d294bae 100644 --- a/simulators/simic7610.c +++ b/simulators/simic7610.c @@ -12,7 +12,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7700.c b/simulators/simic7700.c index bf69128af..88faef544 100644 --- a/simulators/simic7700.c +++ b/simulators/simic7700.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic7851.c b/simulators/simic7851.c index 031febe46..04202ccc5 100644 --- a/simulators/simic7851.c +++ b/simulators/simic7851.c @@ -13,7 +13,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic905.c b/simulators/simic905.c index d439b2419..c39a67e00 100644 --- a/simulators/simic905.c +++ b/simulators/simic905.c @@ -14,7 +14,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simic910.c b/simulators/simic910.c index 38fec3e08..3d04e3091 100644 --- a/simulators/simic910.c +++ b/simulators/simic910.c @@ -15,7 +15,6 @@ #include "sim.h" -#define BUFSIZE 256 //#define X25 int civ_731_mode = 0; diff --git a/simulators/simic9100.c b/simulators/simic9100.c index 1fbb23b1d..0329fe1b5 100644 --- a/simulators/simic9100.c +++ b/simulators/simic9100.c @@ -13,7 +13,6 @@ #include "sim.h" #include "misc.h" -#define BUFSIZE 256 //#define X25 int civ_731_mode = 0; diff --git a/simulators/simic9700.c b/simulators/simic9700.c index 88113a902..5f6c3165e 100644 --- a/simulators/simic9700.c +++ b/simulators/simic9700.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simicgeneric.c b/simulators/simicgeneric.c index 91e584796..98996f6ea 100644 --- a/simulators/simicgeneric.c +++ b/simulators/simicgeneric.c @@ -13,7 +13,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 //#define X25 int civ_731_mode = 0; diff --git a/simulators/simicr8600.c b/simulators/simicr8600.c index d2b6a8e32..5ab35dbe1 100644 --- a/simulators/simicr8600.c +++ b/simulators/simicr8600.c @@ -13,7 +13,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 //#define X25 int civ_731_mode = 0; diff --git a/simulators/simid5100.c b/simulators/simid5100.c index a3aaf7da1..262ecc362 100644 --- a/simulators/simid5100.c +++ b/simulators/simid5100.c @@ -14,7 +14,6 @@ #include "sim.h" -#define BUFSIZE 256 int civ_731_mode = 0; vfo_t current_vfo = RIG_VFO_A; diff --git a/simulators/simkenwood.c b/simulators/simkenwood.c index bdf1b780f..fd9e6d4ba 100644 --- a/simulators/simkenwood.c +++ b/simulators/simkenwood.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simpowersdr.c b/simulators/simpowersdr.c index d38276929..8c7d8ca38 100644 --- a/simulators/simpowersdr.c +++ b/simulators/simpowersdr.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; diff --git a/simulators/simqrplabs.c b/simulators/simqrplabs.c index be177e2e3..f9f44e5a4 100644 --- a/simulators/simqrplabs.c +++ b/simulators/simqrplabs.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simtrusdx.c b/simulators/simtrusdx.c index ac51c0bbf..58241c19a 100644 --- a/simulators/simtrusdx.c +++ b/simulators/simtrusdx.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simts450.c b/simulators/simts450.c index 6d159eafc..be89a2398 100644 --- a/simulators/simts450.c +++ b/simulators/simts450.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simts590.c b/simulators/simts590.c index 316eb0c27..5a51e309b 100644 --- a/simulators/simts590.c +++ b/simulators/simts590.c @@ -10,7 +10,6 @@ #include "sim.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simts890.c b/simulators/simts890.c index a022cd357..d7e6a81a2 100644 --- a/simulators/simts890.c +++ b/simulators/simts890.c @@ -44,8 +44,6 @@ * app is only using the latest-and-greatest, comment out the next define. */ #define LEGACY -// Size of command buffer -#define BUFSIZE 256 // Number of selectable bands #define NBANDS 11 /* Type we're emulating - K=The Americas(default), E=Europe */ diff --git a/simulators/simts950.c b/simulators/simts950.c index 50cc626af..70ace6062 100644 --- a/simulators/simts950.c +++ b/simulators/simts950.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simts990.c b/simulators/simts990.c index a65aea203..d2b96b5af 100644 --- a/simulators/simts990.c +++ b/simulators/simts990.c @@ -9,7 +9,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 int mysleep = 20; diff --git a/simulators/simxiegug90.c b/simulators/simxiegug90.c index 7530b46c6..755ff2ebf 100644 --- a/simulators/simxiegug90.c +++ b/simulators/simxiegug90.c @@ -12,7 +12,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simxiegux108g.c b/simulators/simxiegux108g.c index d9aff1763..501e56b46 100644 --- a/simulators/simxiegux108g.c +++ b/simulators/simxiegux108g.c @@ -12,7 +12,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simxiegux6100.c b/simulators/simxiegux6100.c index c4c01a492..9d0726d89 100644 --- a/simulators/simxiegux6100.c +++ b/simulators/simxiegux6100.c @@ -12,7 +12,6 @@ #include "misc.h" #include "sim.h" -#define BUFSIZE 256 #define X25 int civ_731_mode = 0; diff --git a/simulators/simyaesu.c b/simulators/simyaesu.c index 9a79ee759..40b179c6e 100644 --- a/simulators/simyaesu.c +++ b/simulators/simyaesu.c @@ -8,7 +8,6 @@ #include "hamlib/rig.h" #include "misc.h" -#define BUFSIZE 256 float freqA = 14074000; float freqB = 14074500; commit 816d6d9befa3c14f4859257ab60fd0292d1319a0 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 21:41:32 2025 +0200 Replace magic number with a defined constant diff --git a/simulators/simft990.c b/simulators/simft990.c index cfdcb18c2..9d1b1ab67 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -18,8 +18,9 @@ char modeB = '1'; int width_main = 500; int width_sub = 700; +#define ALL_DATA_SIZE 1492 -static void load_dat(const char *filename, unsigned char buf[1492]) +static void load_dat(const char *filename, unsigned char buf[ALL_DATA_SIZE]) { FILE *fp = fopen(filename, "r"); char line[4096]; @@ -47,7 +48,7 @@ static void load_dat(const char *filename, unsigned char buf[1492]) printf("%d bytes read\n", n); } -static unsigned char alldata[1492]; +static unsigned char alldata[ALL_DATA_SIZE]; #include "sim.h" @@ -72,7 +73,7 @@ int main(int argc, char *argv[]) if (buf[4] == 0x10) { - write(fd, alldata, 1492); + write(fd, alldata, ALL_DATA_SIZE); } } commit 249a99363363fab3b37eac66c9f83323988427af Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 22:19:46 2025 +0200 Avoid spamming the terminal with 0's diff --git a/simulators/sim.h b/simulators/sim.h index d09108016..e1cc194cc 100644 --- a/simulators/sim.h +++ b/simulators/sim.h @@ -120,21 +120,21 @@ getmyline5(int fd, unsigned char *buf) { unsigned char c; int i = 0; - int n = 0; memset(buf, 0, BUFSIZE); while (i < 5 && read(fd, &c, 1) > 0) { buf[i++] = c; - n++; } - printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3], - buf[4]); + if (i > 0) { + printf("n=%d %02x %02x %02x %02x %02x\n", i, + buf[0], buf[1], buf[2], buf[3], buf[4]); + } if (i == 0) { hl_usleep(10 * 1000); } - return n; + return i; } commit 8064da81214c66374cf864942c3b8692f50cc0cf Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 21:16:33 2025 +0200 Avoid burning 100% CPU Adds hl_usleep() like in the other version of getmyline(). diff --git a/simulators/sim.h b/simulators/sim.h index 6d0122ec3..d09108016 100644 --- a/simulators/sim.h +++ b/simulators/sim.h @@ -131,5 +131,10 @@ getmyline5(int fd, unsigned char *buf) printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3], buf[4]); + + if (i == 0) { + hl_usleep(10 * 1000); + } + return n; } commit d9532a9c62a6b31948968838b870bdc7e2b0e396 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 20:49:41 2025 +0200 Fix compiler warning Fixes: simft990.c:64:36: warning: pointer targets in passing argument 2 of ‘getmyline5’ differ in signedness [-Wpointer-sign] diff --git a/simulators/simft990.c b/simulators/simft990.c index 0ad0c0d8f..cfdcb18c2 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -54,7 +54,7 @@ static unsigned char alldata[1492]; int main(int argc, char *argv[]) { - char buf[BUFSIZE]; + unsigned char buf[BUFSIZE]; int fd = openPort(argv[1]); load_dat("simft990.dat", alldata); commit f691a68c069bbd32c938249f3dbd4a1d112e5c97 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 20:38:57 2025 +0200 Fix compiler warning Fixes: simft990.c:39:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses] diff --git a/simulators/simft990.c b/simulators/simft990.c index f10cf27fb..0ad0c0d8f 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -36,7 +36,7 @@ static void load_dat(const char *filename, unsigned char buf[1492]) sscanf(p, "%x", &val); buf[n++] = val; } - while (p = strtok(NULL, " \r\n")); + while ((p = strtok(NULL, " \r\n"))); strtok(s, "\r\n"); //printf("n=%d, %s\n",n,s); commit 725fcee0048c6554d8c4c5393f52c350bb662e48 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Aug 5 20:22:41 2025 +0200 Fix compiler warning Fixes: simatd578.c:143:9: warning: ‘n’ may be used uninitialized [-Wmaybe-uninitialized] diff --git a/simulators/simatd578.c b/simulators/simatd578.c index 06de3e511..661338c6c 100644 --- a/simulators/simatd578.c +++ b/simulators/simatd578.c @@ -55,7 +55,6 @@ _getmyline(int fd, unsigned char *buf) int main(int argc, char *argv[]) { unsigned char buf[BUFSIZE], buf2[256]; - int n; again: int fd = openPort(argv[1]); @@ -63,6 +62,7 @@ again: while (1) { int bytes = _getmyline(fd, buf); + int n = 0; if (bytes == 0) { commit 151549bb3b828596dc5b67d02bd446842655608a Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 4 10:49:58 2025 +0200 Remove disabled code None of these simulators does multicast networking. diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 38164ecb0..a7740ac11 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -1,13 +1,6 @@ // can run this using rigctl/rigctld and socat pty devices #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/simulators/simelecraftk4.c b/simulators/simelecraftk4.c index bfb8d482e..2b5e67e09 100644 --- a/simulators/simelecraftk4.c +++ b/simulators/simelecraftk4.c @@ -1,13 +1,6 @@ // can run this using rigctl/rigctld and socat pty devices #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/simulators/simtmd700.c b/simulators/simtmd700.c index 44918b897..2abf667cd 100644 --- a/simulators/simtmd700.c +++ b/simulators/simtmd700.c @@ -1,13 +1,6 @@ // can run this using rigctl/rigctld and socat pty devices #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/simulators/simts890.c b/simulators/simts890.c index 4d78c3a83..a022cd357 100644 --- a/simulators/simts890.c +++ b/simulators/simts890.c @@ -27,13 +27,6 @@ // can run this using rigctl/rigctld and socat pty devices #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/simulators/simts990.c b/simulators/simts990.c index 5285dbcda..a65aea203 100644 --- a/simulators/simts990.c +++ b/simulators/simts990.c @@ -1,13 +1,6 @@ // can run this using rigctl/rigctld and socat pty devices #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/simulators/simxiegug90.c b/simulators/simxiegug90.c index 2664511de..7530b46c6 100644 --- a/simulators/simxiegug90.c +++ b/simulators/simxiegug90.c @@ -3,13 +3,6 @@ // Needs a lot of improvement to work on all Icoms #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/simulators/simxiegux108g.c b/simulators/simxiegux108g.c index 35f34d9ee..d9aff1763 100644 --- a/simulators/simxiegux108g.c +++ b/simulators/simxiegux108g.c @@ -3,13 +3,6 @@ // Needs a lot of improvement to work on all Icoms #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/simulators/simxiegux6100.c b/simulators/simxiegux6100.c index 27b686765..c4c01a492 100644 --- a/simulators/simxiegux6100.c +++ b/simulators/simxiegux6100.c @@ -3,13 +3,6 @@ // Needs a lot of improvement to work on all Icoms #define _XOPEN_SOURCE 700 // since we are POSIX here we need this -#if 0 -struct ip_mreq -{ - int dummy; -}; -#endif - #include <stdio.h> #include <string.h> #include <unistd.h> commit 790820ab22cde0b8a251356d3513ad41f20f1f3c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 4 10:47:02 2025 +0200 Refactor to remove code duplication of one version of getmyline() diff --git a/simulators/sim.h b/simulators/sim.h index afb889042..6d0122ec3 100644 --- a/simulators/sim.h +++ b/simulators/sim.h @@ -96,6 +96,25 @@ int openPort(char *comport) // doesn't matter for using pts devices // Size of command buffer #define BUFSIZE 256 +int +getmyline(int fd, char *buf) +{ + char c; + int i = 0; + memset(buf, 0, BUFSIZE); + + while (read(fd, &c, 1) > 0) + { + buf[i++] = c; + + if (c == ';') { return strlen(buf); } + } + + if (strlen(buf) == 0) { hl_usleep(10 * 1000); } + + return strlen(buf); +} + int getmyline5(int fd, unsigned char *buf) { diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 500c5e1e2..38164ecb0 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -39,24 +39,6 @@ int modea = 2; int modeb = 2; int ptt = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} diff --git a/simulators/simelecraftk4.c b/simulators/simelecraftk4.c index 2b63b0e78..bfb8d482e 100644 --- a/simulators/simelecraftk4.c +++ b/simulators/simelecraftk4.c @@ -39,24 +39,6 @@ int modeB = 2; int ptt = 0; // int freqa = 14074000, freqb = 14073500; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} diff --git a/simulators/simft450.c b/simulators/simft450.c index 8456e13dd..50b73f823 100644 --- a/simulators/simft450.c +++ b/simulators/simft450.c @@ -45,24 +45,6 @@ int gt = 0; int ex016 = 0; int ex020 = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simft710.c b/simulators/simft710.c index 83471fdfb..d3f01e6f4 100644 --- a/simulators/simft710.c +++ b/simulators/simft710.c @@ -46,24 +46,6 @@ int ex016 = 0; int ex020 = 0; int st = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simft818.c b/simulators/simft818.c index f14e7e002..e9843b2c8 100644 --- a/simulators/simft818.c +++ b/simulators/simft818.c @@ -21,24 +21,6 @@ char modeB = '1'; int width = 0; int ptt; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simft991.c b/simulators/simft991.c index b9e4b9448..603007d85 100644 --- a/simulators/simft991.c +++ b/simulators/simft991.c @@ -24,24 +24,6 @@ int vd = 0; int sm0 = 0; int sm1 = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simftdx101.c b/simulators/simftdx101.c index 6bbde4374..1304f7f40 100644 --- a/simulators/simftdx101.c +++ b/simulators/simftdx101.c @@ -32,24 +32,6 @@ int rport_gain_psk = 50; int syncvfo = 0; int ant = 1; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simftdx1200.c b/simulators/simftdx1200.c index d91db1c79..a53c8e0c7 100644 --- a/simulators/simftdx1200.c +++ b/simulators/simftdx1200.c @@ -23,24 +23,6 @@ int na = 0; int ex039 = 0; int keyspd = 20; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simftdx3000.c b/simulators/simftdx3000.c index dbfa63d51..8e7917062 100644 --- a/simulators/simftdx3000.c +++ b/simulators/simftdx3000.c @@ -22,24 +22,6 @@ int sh = 25; int na = 0; int ex039 = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simftdx5000.c b/simulators/simftdx5000.c index a60d39380..034e528d1 100644 --- a/simulators/simftdx5000.c +++ b/simulators/simftdx5000.c @@ -24,24 +24,6 @@ int na = 0; int ex039 = 0; int ex103 = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simkenwood.c b/simulators/simkenwood.c index 0ec10f0c7..bdf1b780f 100644 --- a/simulators/simkenwood.c +++ b/simulators/simkenwood.c @@ -18,24 +18,6 @@ int filternum = 7; int datamode = 0; int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simpowersdr.c b/simulators/simpowersdr.c index 5049702f5..d38276929 100644 --- a/simulators/simpowersdr.c +++ b/simulators/simpowersdr.c @@ -19,24 +19,6 @@ int keyspd = 20; double alc = 0; int tx; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simqrplabs.c b/simulators/simqrplabs.c index 4492e28f1..be177e2e3 100644 --- a/simulators/simqrplabs.c +++ b/simulators/simqrplabs.c @@ -20,24 +20,6 @@ int datamode = 0; int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; int tomode = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simtrusdx.c b/simulators/simtrusdx.c index c666f012f..ac51c0bbf 100644 --- a/simulators/simtrusdx.c +++ b/simulators/simtrusdx.c @@ -21,24 +21,6 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; int tomode = 0; int keyspd = 25; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simts450.c b/simulators/simts450.c index 7e5b87bd1..6d159eafc 100644 --- a/simulators/simts450.c +++ b/simulators/simts450.c @@ -21,24 +21,6 @@ int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; int tomode = 0; int keyspd = 25; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simts890.c b/simulators/simts890.c index 25d6f357a..4d78c3a83 100644 --- a/simulators/simts890.c +++ b/simulators/simts890.c @@ -212,24 +212,6 @@ int hl_usleep(unsigned long usec); // Until it's replaced #include "sim.h" -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} int main(int argc, char *argv[]) { diff --git a/simulators/simts950.c b/simulators/simts950.c index 5baaabdc2..50cc626af 100644 --- a/simulators/simts950.c +++ b/simulators/simts950.c @@ -20,24 +20,6 @@ int filternum2 = 8; int datamode = 0; int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" diff --git a/simulators/simts990.c b/simulators/simts990.c index c321f9ccb..5285dbcda 100644 --- a/simulators/simts990.c +++ b/simulators/simts990.c @@ -62,24 +62,6 @@ int pc = 50; #include "sim.h" -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} diff --git a/simulators/simyaesu.c b/simulators/simyaesu.c index ea126f8fd..9a79ee759 100644 --- a/simulators/simyaesu.c +++ b/simulators/simyaesu.c @@ -26,24 +26,6 @@ int width_sub = 0; int ex039 = 0; int lk = 0; -int -getmyline(int fd, char *buf) -{ - char c; - int i = 0; - memset(buf, 0, BUFSIZE); - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - - if (c == ';') { return strlen(buf); } - } - - if (strlen(buf) == 0) { hl_usleep(10 * 1000); } - - return strlen(buf); -} #include "sim.h" commit b809937395457fadb9fa3ab98ad8a4ff52e9fa7d Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Aug 4 10:46:23 2025 +0200 Rename in preparation of conflicting changes diff --git a/simulators/simatd578.c b/simulators/simatd578.c index 8f5a4dd5c..06de3e511 100644 --- a/simulators/simatd578.c +++ b/simulators/simatd578.c @@ -20,7 +20,7 @@ int curr_vfo = 0; int -getmyline(int fd, unsigned char *buf) +_getmyline(int fd, unsigned char *buf) { unsigned char c; int i = 0; @@ -62,7 +62,7 @@ again: while (1) { - int bytes = getmyline(fd, buf); + int bytes = _getmyline(fd, buf); if (bytes == 0) { diff --git a/simulators/simeasycomm.c b/simulators/simeasycomm.c index 8089277bb..a774e5fcc 100644 --- a/simulators/simeasycomm.c +++ b/simulators/simeasycomm.c @@ -14,7 +14,7 @@ static void *rotorez_thread(void *arg); int -getmyline(int fd, char *buf) +_getmyline(int fd, char *buf) { unsigned char c = 0; int i = 0; @@ -61,8 +61,8 @@ int main(int argc, char *argv[]) while (1) { int bytes; - if (!flag) bytes = getmyline(fd, buf); - else bytes = getmyline(fd2, buf); + if (!flag) bytes = _getmyline(fd, buf); + else bytes = _getmyline(fd2, buf); flag = !flag; if (bytes == 0) @@ -116,7 +116,7 @@ again: while (1) { int bytes; - bytes = getmyline(fd, buf); + bytes = _getmyline(fd, buf); if (bytes == 0) { diff --git a/simul... [truncated message content] |
From: n0nb <n0...@us...> - 2025-08-06 18:53:39
|
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, Hamlib-4.6.3 has been updated via 2d63d05da7d80132392b25a8405844fceea4480f (commit) via 201f69bf3cbf46859920b920ed4df194c0d803eb (commit) via 566d56bb29eaaaa5737411524fbc8ebee77ff7c3 (commit) from 59e3d1b307504440837c3a5c24a15d7038e59f69 (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 2d63d05da7d80132392b25a8405844fceea4480f Author: Nate Bargmann <n0...@n0...> Date: Wed Aug 6 13:51:11 2025 -0500 Advance to 4.6.5 No proposed release date as of yet. diff --git a/NEWS b/NEWS index c52a25d13..1b9c5c1e1 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,11 @@ Version 5.x -- future Version 4.7.0 * 2025-12-01 (target) +Version 4.6.5 + * 2025-??-?? + * Update Kenwood CW buffer max message size, fix one byte buffer + overrun in icom.c. (TNX George Baltz). + Version 4.6.4 * 2025-07-18--Hamlib's 25th birthday!!! * Fix handling of unprintable characters in kenwood.c that broke radios diff --git a/configure.ac b/configure.ac index 3b17e222c..4facb20b9 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ dnl Please do not use '-' in the version number, as package managers will fail, dnl however, the use of '~' should be fine as apt (others?) will treat dnl it as an earlier version than the actual release. TNX KA6MAL dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars! -AC_INIT([Hamlib],[4.6.4],[ham...@li...],[hamlib],[http://www.hamlib.org]) +AC_INIT([Hamlib],[4.6.5~rc],[ham...@li...],[hamlib],[http://www.hamlib.org]) #AC_INIT([PRODUCT_NAME], [Hamlib]) #AC_DEFINE([Hamlib], [PRODUCT_VERSION_RESOURCE]) @@ -76,7 +76,7 @@ dnl See README.release on setting these values # Set them here to keep c++/Makefile and src/Makefile in sync. ABI_VERSION=4 ABI_REVISION=6 -ABI_PATCH=4 +ABI_PATCH=5 ABI_AGE=0 AC_DEFINE_UNQUOTED([ABI_VERSION], [$ABI_VERSION], [Frontend ABI version]) commit 201f69bf3cbf46859920b920ed4df194c0d803eb Author: George Baltz N3GB <Geo...@gm...> Date: Wed Aug 6 04:59:50 2025 -0400 Fix one byte buffer overrun All the pictures in manuals show message as 4 bytes, but they don't include the major command (0x26). Found by `gcc -fanalyzer` diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 9f753ebf1..cdbc37e50 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2372,7 +2372,7 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode, int ack_len = sizeof(ackbuf); int buf_len = 3; int mode_len; - unsigned char mode_buf[4]; + unsigned char mode_buf[5]; if (priv->x26cmdfails > 0 && !priv_caps->x25x26_always) { commit 566d56bb29eaaaa5737411524fbc8ebee77ff7c3 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Jul 30 12:51:50 2025 -0400 Update Kenwood max CW message size. diff --git a/rigs/kenwood/ts590.c b/rigs/kenwood/ts590.c index 4ed0c94af..49557657d 100644 --- a/rigs/kenwood/ts590.c +++ b/rigs/kenwood/ts590.c @@ -1922,6 +1922,7 @@ struct rig_caps ts590_caps = .get_mem = kenwood_get_mem, .vfo_ops = TS590_VFO_OPS, .vfo_op = kenwood_vfo_op, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -2352,5 +2353,6 @@ struct rig_caps ts590sg_caps = .get_mem = kenwood_get_mem, .vfo_ops = TS590_VFO_OPS, .vfo_op = kenwood_vfo_op, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; diff --git a/rigs/kenwood/ts890s.c b/rigs/kenwood/ts890s.c index 32d8c4533..db03f4368 100644 --- a/rigs/kenwood/ts890s.c +++ b/rigs/kenwood/ts890s.c @@ -720,5 +720,6 @@ struct rig_caps ts890s_caps = .get_func = ts890_get_func, .get_clock = kenwood_get_clock, .set_clock = kenwood_set_clock, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; diff --git a/rigs/kenwood/ts990s.c b/rigs/kenwood/ts990s.c index 0deda6bed..1ffcafd73 100644 --- a/rigs/kenwood/ts990s.c +++ b/rigs/kenwood/ts990s.c @@ -382,6 +382,7 @@ struct rig_caps ts990s_caps = .reset = kenwood_reset, .get_clock = kenwood_get_clock, .set_clock = kenwood_set_clock, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; ----------------------------------------------------------------------- Summary of changes: NEWS | 5 +++++ configure.ac | 4 ++-- rigs/icom/icom.c | 2 +- rigs/kenwood/ts590.c | 2 ++ rigs/kenwood/ts890s.c | 1 + rigs/kenwood/ts990s.c | 1 + 6 files changed, 12 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-06 18:07:20
|
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 70d50d0efbbdd84157c9cd89043744f07d15bfd8 (commit) via 1e5adb9fde600354dbac2dfbae1775fc28725c49 (commit) via 96bc67d993647208060e443dd9953cff3255cfa4 (commit) via c26113c5cc6e9e2027111bb019ce36d635bbf602 (commit) via c1132a77b5883207147e3ebbf56152389467bb8e (commit) via c1e6dcf0105b2b1affe7aa1d794af7f09f017002 (commit) via 8ce51d13aa7e70a4b563b1218160fbb8b5d2cd25 (commit) from 1e310b7958bcb0c3246837e3cf8e2a497bcc6e48 (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 70d50d0efbbdd84157c9cd89043744f07d15bfd8 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Aug 6 04:59:50 2025 -0400 Fix one byte buffer overrun All the pictures in manuals show message as 4 bytes, but they don't include the major command (0x26). Found by `gcc -fanalyzer` diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 995a25a0c..e22cadfe7 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2373,7 +2373,7 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode, int ack_len = sizeof(ackbuf); int buf_len = 3; int mode_len; - unsigned char mode_buf[4]; + unsigned char mode_buf[5]; if (priv->x26cmdfails > 0 && !priv_caps->x25x26_always) { commit 1e5adb9fde600354dbac2dfbae1775fc28725c49 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Aug 6 04:56:02 2025 -0400 Fix errors in error cases Leak FDs in error exits, seg faults if RIG missing. Found by `gcc -fanalyzer` diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index 911ec8b7c..de3bcea2a 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -971,8 +971,7 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; - int split = CACHE(rig)->split; - int ptt = CACHE(rig)->ptt; + int split, ptt; FT100_METER_INFO ft100_meter; @@ -980,6 +979,9 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (!val) { return -RIG_EINVAL; } + split = CACHE(rig)->split; + ptt = CACHE(rig)->ptt; + rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, rig_strlevel(level)); // if in split have to switch to VFOB to read power and back to VFOA diff --git a/rotators/gs232a/gs232.c b/rotators/gs232a/gs232.c index 26b6c125e..34d66bd8b 100644 --- a/rotators/gs232a/gs232.c +++ b/rotators/gs232a/gs232.c @@ -198,7 +198,7 @@ gs232_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) static int gs232_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { - char posbuf[32]; + char posbuf[BUFSZ]; // these really shouldn't be static but it's fixing faulty firmware -- see below static int expected = 12; static int expected_flag = 0; diff --git a/src/network.c b/src/network.c index 4c6242712..848a45eae 100644 --- a/src/network.c +++ b/src/network.c @@ -1348,7 +1348,7 @@ int is_wireless() static void *multicast_receiver(void *arg) { char data[4096]; - char ip4[INET6_ADDRSTRLEN]; + char ip4[INET6_ADDRSTRLEN] = ""; struct multicast_receiver_args_s *args = (struct multicast_receiver_args_s *) arg; diff --git a/src/settings.c b/src/settings.c index 9573bc9dd..500708c83 100644 --- a/src/settings.c +++ b/src/settings.c @@ -1266,6 +1266,8 @@ HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file) } } + fclose(fp); + return RIG_OK; } commit 96bc67d993647208060e443dd9953cff3255cfa4 Author: George Baltz N3GB <Geo...@gm...> Date: Tue Aug 5 11:29:01 2025 -0400 Fix FD leak in AESStringCrypt.c Found by `gcc -fanalyzer`, which then spent the next 20+ minutes trying to analyze md5.c, at which point I gave up. diff --git a/security/AESStringCrypt.c b/security/AESStringCrypt.c index 908b1ab41..819eb4817 100644 --- a/security/AESStringCrypt.c +++ b/security/AESStringCrypt.c @@ -222,6 +222,7 @@ unsigned long long AESStringCrypt(unsigned char *password, { if (fread(buffer, 1, 32, randfp) != 32) { + fclose(randfp); return AESSTRINGCRYPT_ERROR; } commit c26113c5cc6e9e2027111bb019ce36d635bbf602 Author: George Baltz N3GB <Geo...@gm...> Date: Mon Aug 4 18:43:39 2025 -0400 Fix more cppcheck messages Suppress non-errors in rx331.c and rx340.c Mark runflag(s) as volatile diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index f2bf347d1..a5a7901bb 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2580,7 +2580,7 @@ struct multicast_s int multicast_running; int sock; int seqnumber; - int runflag; // = 0; + volatile int runflag; // = 0; pthread_t threadid; // this mutex is needed to control serial access // as of 2023-05-13 we have main thread and multicast thread needing it diff --git a/rigs/anytone/anytone.h b/rigs/anytone/anytone.h index d8ca681dc..18f64e38a 100644 --- a/rigs/anytone/anytone.h +++ b/rigs/anytone/anytone.h @@ -24,7 +24,7 @@ typedef struct _anytone_priv_data { ptt_t ptt; vfo_t vfo_curr; - int runflag; // thread control + volatile int runflag; // thread control char buf[64]; pthread_mutex_t mutex; } anytone_priv_data_t, diff --git a/rigs/tentec/omnivii.c b/rigs/tentec/omnivii.c index cd2f23654..5a0e4abe7 100644 --- a/rigs/tentec/omnivii.c +++ b/rigs/tentec/omnivii.c @@ -274,7 +274,7 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, if (retval == RIG_OK) { // All responses except from "XX" terminate with EOM (i.e. \r) so that is our stop char - char *term = EOM; + const char *term = EOM; if (cmd[0] == 'X') // we'll let the timeout take care of this as it shouldn't happen anyways diff --git a/rigs/tentec/paragon.c b/rigs/tentec/paragon.c index 220540b72..2b0ededa2 100644 --- a/rigs/tentec/paragon.c +++ b/rigs/tentec/paragon.c @@ -326,7 +326,7 @@ int tt585_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct tt585_priv_data *priv = (struct tt585_priv_data *)STATE(rig)->priv; int ret; - unsigned char *p; + const unsigned char *p; ret = tt585_get_status_data(rig); diff --git a/rigs/tentec/rx331.c b/rigs/tentec/rx331.c index af252d861..e0eac210a 100644 --- a/rigs/tentec/rx331.c +++ b/rigs/tentec/rx331.c @@ -69,6 +69,7 @@ static int rx331_init(RIG *rig); static int rx331_cleanup(RIG *rig); static int rx331_set_conf(RIG *rig, hamlib_token_t token, const char *val); static int rx331_get_conf(RIG *rig, hamlib_token_t token, char *val); +static int rx331_get_conf2(RIG *rig, hamlib_token_t token, char *val, int len); static int rx331_open(RIG *rig); static int rx331_close(RIG *rig); static int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq); @@ -178,6 +179,7 @@ struct rig_caps rx331_caps = .rig_close = rx331_close, .set_conf = rx331_set_conf, .get_conf = rx331_get_conf, + .get_conf2 = rx331_get_conf2, .set_freq = rx331_set_freq, .get_freq = rx331_get_freq, .set_mode = rx331_set_mode, @@ -428,6 +430,8 @@ int rx331_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return -RIG_EPROTO; } + // cppcheck doesn't grok num_sscanf() + // cppcheck-suppress uninitvar *freq = f * 1e6; return RIG_OK; @@ -547,6 +551,7 @@ int rx331_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return -RIG_EPROTO; } + // cppcheck-suppress uninitvar *width = f * 1e3; return RIG_OK; diff --git a/rigs/tentec/rx340.c b/rigs/tentec/rx340.c index 0d97cda26..dab9cab35 100644 --- a/rigs/tentec/rx340.c +++ b/rigs/tentec/rx340.c @@ -325,6 +325,7 @@ int rx340_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return -RIG_EPROTO; } + // cppcheck-suppress uninitvar *freq = f * 1e6; return RIG_OK; @@ -443,6 +444,7 @@ int rx340_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return -RIG_EPROTO; } + // cppcheck-suppress uninitvar *width = f * 1e3; return RIG_OK; commit c1132a77b5883207147e3ebbf56152389467bb8e Author: George Baltz N3GB <Geo...@gm...> Date: Mon Aug 4 10:20:46 2025 -0400 Mark cache structure in rig_state as deprecated. It is no longer being initialized or updated, so anyone referencing it is being misled. diff --git a/include/hamlib/rig_state.h b/include/hamlib/rig_state.h index 15d7cff05..bd1c727c1 100644 --- a/include/hamlib/rig_state.h +++ b/include/hamlib/rig_state.h @@ -126,6 +126,7 @@ struct rig_state { int twiddle_timeout; /*!< timeout to resume from twiddling */ // uplink allows gpredict to behave better by no reading the uplink VFO int uplink; /*!< uplink=1 will not read Sub, uplink=2 will not read Main */ + HL_DEPRECATED struct rig_cache_deprecated cache; /*!< \deprecated Only here for backward compatibility */ int vfo_opt; /*!< Is -o switch turned on? */ int auto_power_on; /*!< Allow Hamlib to power on rig commit c1e6dcf0105b2b1affe7aa1d794af7f09f017002 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Jul 30 15:11:53 2025 -0400 More cppcheck stuff in amplifiers/ and rotators/ diff --git a/amplifiers/elecraft/kpa.c b/amplifiers/elecraft/kpa.c index f0b0eab55..4b9a6a79b 100644 --- a/amplifiers/elecraft/kpa.c +++ b/amplifiers/elecraft/kpa.c @@ -566,7 +566,7 @@ int kpa_get_powerstat(AMP *amp, powerstat_t *status) int kpa_set_powerstat(AMP *amp, powerstat_t status) { int retval; - char *cmd = NULL; + const char *cmd = NULL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/amplifiers/gemini/gemini.c b/amplifiers/gemini/gemini.c index b95b77200..58da33581 100644 --- a/amplifiers/gemini/gemini.c +++ b/amplifiers/gemini/gemini.c @@ -134,7 +134,7 @@ const char *gemini_get_info(AMP *amp) return rc->model_name; } -int gemini_status_parse(AMP *amp) +static int gemini_status_parse(AMP *amp) { int retval, n = 0; char *p; @@ -204,7 +204,7 @@ int gemini_get_freq(AMP *amp, freq_t *freq) int gemini_set_freq(AMP *amp, freq_t freq) { int retval; - char *cmd; + const char *cmd; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -268,7 +268,7 @@ int gemini_get_level(AMP *amp, setting_t level, value_t *val) int gemini_set_level(AMP *amp, setting_t level, value_t val) { - char *cmd = "?"; + const char *cmd = "?"; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -340,7 +340,7 @@ int gemini_get_powerstat(AMP *amp, powerstat_t *status) int gemini_set_powerstat(AMP *amp, powerstat_t status) { int retval; - char *cmd = NULL; + const char *cmd = NULL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/rotators/apex/apex.c b/rotators/apex/apex.c index e85d62012..aa9fe89ca 100644 --- a/rotators/apex/apex.c +++ b/rotators/apex/apex.c @@ -43,12 +43,12 @@ static int apex_get_string(ROT *rot, char *s, int maxlen) static void *apex_read(void *arg) { ROT *rot = arg; - int retval = 0; char data[64]; int expected_return_length = 63; while (1) { + int retval; retval = apex_get_string(rot, data, expected_return_length); if (strstr(data, "<VER>")) diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index 4f7113e12..70d1b5f65 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -50,9 +50,9 @@ static int easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len) { - hamlib_port_t *rotp = ROTPORT(rot); + hamlib_port_t *rotp; int retval; - int retry = rot->caps->retry; + int retry; rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __func__, cmdstr); @@ -61,6 +61,9 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len) return -RIG_EINVAL; } + rotp = ROTPORT(rot); + retry = rot->caps->retry; + do { rig_flush(rotp); diff --git a/rotators/gs232a/gs232.c b/rotators/gs232a/gs232.c index bc95989c5..26b6c125e 100644 --- a/rotators/gs232a/gs232.c +++ b/rotators/gs232a/gs232.c @@ -225,7 +225,6 @@ gs232_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { rig_debug(RIG_DEBUG_WARN, "%s: rotor didn't send CR...assuming it won't in the future\n", __func__); - retval = RIG_OK; expected = 11; // we won't expect the CR ROTPORT(rot)->retry = 3; } diff --git a/rotators/gs232a/gs232a.c b/rotators/gs232a/gs232a.c index 068ed3052..7b73fa84d 100644 --- a/rotators/gs232a/gs232a.c +++ b/rotators/gs232a/gs232a.c @@ -276,7 +276,7 @@ static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val) } /* between 1 (slowest) and 4 (fastest) */ - SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed); + SNPRINTF(cmdstr, sizeof(cmdstr), "X%d" EOM, speed); retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1); if (retval != RIG_OK) diff --git a/rotators/gs232a/gs232b.c b/rotators/gs232a/gs232b.c index 8275a9ca8..030205816 100644 --- a/rotators/gs232a/gs232b.c +++ b/rotators/gs232a/gs232b.c @@ -294,10 +294,10 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val) switch (level) { - int retval; case ROT_LEVEL_SPEED: { + int retval; int speed = val.i; if (speed < 1) @@ -310,7 +310,7 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val) } /* between 1 (slowest) and 4 (fastest) */ - SNPRINTF(cmdstr, sizeof(cmdstr), "X%u" EOM, speed); + SNPRINTF(cmdstr, sizeof(cmdstr), "X%d" EOM, speed); retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1); if (retval != RIG_OK) commit 8ce51d13aa7e70a4b563b1218160fbb8b5d2cd25 Author: George Baltz N3GB <Geo...@gm...> Date: Wed Jul 30 12:51:50 2025 -0400 Update Kenwood max CW message size. diff --git a/rigs/kenwood/ts590.c b/rigs/kenwood/ts590.c index 9f2e3c464..168f100a4 100644 --- a/rigs/kenwood/ts590.c +++ b/rigs/kenwood/ts590.c @@ -1923,6 +1923,7 @@ struct rig_caps ts590_caps = .get_mem = kenwood_get_mem, .vfo_ops = TS590_VFO_OPS, .vfo_op = kenwood_vfo_op, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -2353,5 +2354,6 @@ struct rig_caps ts590sg_caps = .get_mem = kenwood_get_mem, .vfo_ops = TS590_VFO_OPS, .vfo_op = kenwood_vfo_op, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; diff --git a/rigs/kenwood/ts890s.c b/rigs/kenwood/ts890s.c index b6316523e..033aa4de9 100644 --- a/rigs/kenwood/ts890s.c +++ b/rigs/kenwood/ts890s.c @@ -721,5 +721,6 @@ struct rig_caps ts890s_caps = .get_func = ts890_get_func, .get_clock = kenwood_get_clock, .set_clock = kenwood_set_clock, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; diff --git a/rigs/kenwood/ts990s.c b/rigs/kenwood/ts990s.c index e9da3e54a..3e667711d 100644 --- a/rigs/kenwood/ts990s.c +++ b/rigs/kenwood/ts990s.c @@ -381,6 +381,7 @@ struct rig_caps ts990s_caps = .reset = kenwood_reset, .get_clock = kenwood_get_clock, .set_clock = kenwood_set_clock, + .morse_qsize = 24, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; ----------------------------------------------------------------------- Summary of changes: amplifiers/elecraft/kpa.c | 2 +- amplifiers/gemini/gemini.c | 8 ++++---- include/hamlib/rig.h | 2 +- include/hamlib/rig_state.h | 1 + rigs/anytone/anytone.h | 2 +- rigs/icom/icom.c | 2 +- rigs/kenwood/ts590.c | 2 ++ rigs/kenwood/ts890s.c | 1 + rigs/kenwood/ts990s.c | 1 + rigs/tentec/omnivii.c | 2 +- rigs/tentec/paragon.c | 2 +- rigs/tentec/rx331.c | 5 +++++ rigs/tentec/rx340.c | 2 ++ rigs/yaesu/ft100.c | 6 ++++-- rotators/apex/apex.c | 2 +- rotators/easycomm/easycomm.c | 7 +++++-- rotators/gs232a/gs232.c | 3 +-- rotators/gs232a/gs232a.c | 2 +- rotators/gs232a/gs232b.c | 4 ++-- security/AESStringCrypt.c | 1 + src/network.c | 2 +- src/settings.c | 2 ++ 22 files changed, 40 insertions(+), 21 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-04 13:41:27
|
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 1e310b7958bcb0c3246837e3cf8e2a497bcc6e48 (commit) via c881bc713231d3505a5021338d1406edfedd470f (commit) via fbe9803777f7b41fca075d8a371a33e5b3ad9607 (commit) via 8d8d0328bfb9fe7fae5c2d273f4adc04e44ae1ca (commit) from 8ccc197b7c01efdb0b22774d0b2210b6bec28e92 (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 1e310b7958bcb0c3246837e3cf8e2a497bcc6e48 Merge: c881bc713 fbe980377 Author: Nate Bargmann <n0...@n0...> Date: Mon Aug 4 08:04:15 2025 -0500 Merge GitHub PR #1828 commit c881bc713231d3505a5021338d1406edfedd470f Merge: 8ccc197b7 8d8d0328b Author: Nate Bargmann <n0...@n0...> Date: Mon Aug 4 07:49:28 2025 -0500 Merge GitHub PR #1827 commit fbe9803777f7b41fca075d8a371a33e5b3ad9607 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Aug 3 13:18:09 2025 +0200 Fix initialization of comm_status The function rig_init() doesn't touch the hardware, it's rig_open() that initiates the connection and in fact the first use of comm_status in rig_open() is when it gets the value RIG_COMM_STATUS_CONNECTING and rig_close() sets it to RIG_COMM_STATUS_DISCONNECTED. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 65ddc82a3..111311978 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -47,10 +47,12 @@ class TestClass: assert rig is not None assert rig.state.comm_state == 0 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED assert rig.set_conf("rig_pathname", rig_file) is None assert rig.set_conf("serial_speed", str(serial_speed)) is None assert rig.open() is None assert rig.state.comm_state == 1 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_OK info = rig.get_info() assert isinstance(info, str) @@ -116,6 +118,7 @@ class TestClass: assert rig.close() is None assert rig.state.comm_state == 0 + assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED info = rig.get_info() assert info is None diff --git a/src/rig.c b/src/rig.c index 63019fdf8..706ca4d91 100644 --- a/src/rig.c +++ b/src/rig.c @@ -669,7 +669,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) rs->async_data_enabled = 0; // rs->depth = 1; rs->comm_state = 0; - rs->comm_status = RIG_COMM_STATUS_CONNECTING; + rs->comm_status = RIG_COMM_STATUS_DISCONNECTED; rs->tuner_control_pathname = DEFAULT_TUNER_CONTROL_PATHNAME; strncpy(rs->client_version, "Hamlib", sizeof(rs->client_version)); commit 8d8d0328bfb9fe7fae5c2d273f4adc04e44ae1ca Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Aug 2 16:10:20 2025 +0200 Fix typos diff --git a/amplifiers/elecraft/kpa.c b/amplifiers/elecraft/kpa.c index 431eb7735..f0b0eab55 100644 --- a/amplifiers/elecraft/kpa.c +++ b/amplifiers/elecraft/kpa.c @@ -365,7 +365,7 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val) return -RIG_EPROTO; } - rig_debug(RIG_DEBUG_VERBOSE, "%s freq range=%dKHz,%dKHz\n", __func__, + rig_debug(RIG_DEBUG_VERBOSE, "%s freq range=%dkHz,%dkHz\n", __func__, int_value, int_value2); // diff --git a/amplifiers/expert/expert.c b/amplifiers/expert/expert.c index 73f706eaa..6d0a6c94e 100644 --- a/amplifiers/expert/expert.c +++ b/amplifiers/expert/expert.c @@ -398,7 +398,7 @@ int expert_get_level(AMP *amp, setting_t level, value_t *val) return -RIG_EPROTO; } - rig_debug(RIG_DEBUG_VERBOSE, "%s freq range=%dKHz,%dKHz\n", __func__, + rig_debug(RIG_DEBUG_VERBOSE, "%s freq range=%dkHz,%dkHz\n", __func__, int_value, int_value2); // diff --git a/extra/kylix/hamlib_rigapi.pas b/extra/kylix/hamlib_rigapi.pas index b9cec3ee3..a2eba70e8 100644 --- a/extra/kylix/hamlib_rigapi.pas +++ b/extra/kylix/hamlib_rigapi.pas @@ -56,7 +56,7 @@ const HAMLIB_RIGVERSIZ = 8; HAMLIB_FILPATHLEN = 512; HAMLIB_FRQRANGESIZ = 30; - HAMLIB_MAXCHANDESC = 30; {* describe channel eg: "WWV 5Mhz" *} + HAMLIB_MAXCHANDESC = 30; {* describe channel eg: "WWV 5 MHz" *} HAMLIB_TSLSTSIZ = 20; {* max tuning step list size, zero ended *} HAMLIB_FLTLSTSIZ = 16; {* max mode/filter list size, zero ended *} HAMLIB_MAXDBLSTSIZ = 8; {* max preamp/att levels supported, zero ended *} diff --git a/include/hamlib/amplist.h b/include/hamlib/amplist.h index a123f8841..363cba450 100644 --- a/include/hamlib/amplist.h +++ b/include/hamlib/amplist.h @@ -126,7 +126,7 @@ /** * \brief A macro that returns the model number of `DX1200`. * - * The Gemini DX1200 covers 160 trhough 4 meters. + * The Gemini DX1200 covers 160 through 4 meters. */ #define AMP_MODEL_GEMINI_DX1200 AMP_MAKE_MODEL(AMP_GEMINI, 1) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 7c79443a7..f2bf347d1 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -303,7 +303,7 @@ typedef struct s_rig RIG; #define HAMLIB_RIGVERSIZ 8 #define HAMLIB_FILPATHLEN 512 #define HAMLIB_FRQRANGESIZ 30 -#define HAMLIB_MAXCHANDESC 30 /* describe channel eg: "WWV 5Mhz" */ +#define HAMLIB_MAXCHANDESC 30 /* describe channel eg: "WWV 5 MHz" */ #define HAMLIB_TSLSTSIZ 20 /* max tuning step list size, zero ended */ #define HAMLIB_FLTLSTSIZ 60 /* max mode/filter list size, zero ended */ #define HAMLIB_MAXDBLSTSIZ 8 /* max preamp/att levels supported, zero ended */ diff --git a/rigs/aor/aor.c b/rigs/aor/aor.c index 9c70437d9..1ea435dbe 100644 --- a/rigs/aor/aor.c +++ b/rigs/aor/aor.c @@ -152,7 +152,7 @@ static int format_freq(char *buf, int buf_len, freq_t freq) /* * actually, frequency must be like nnnnnnnnm0, - * where m must be 0 or 5 (for 50Hz). + * where m must be 0 or 5 (for 50 Hz). */ lowhz = f % 100; f /= 100; @@ -595,7 +595,7 @@ int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) /* * actually, tuning step must be like nnnnm0, - * where m must be 0 or 5 (for 50Hz). + * where m must be 0 or 5 (for 50 Hz). */ SNPRINTF(tsbuf, sizeof(tsbuf), "ST%06ld" EOM, ts); diff --git a/rigs/aor/ar3000.c b/rigs/aor/ar3000.c index cd067642b..1a6fe26f5 100644 --- a/rigs/aor/ar3000.c +++ b/rigs/aor/ar3000.c @@ -232,7 +232,7 @@ int ar3k_set_freq(RIG *rig, vfo_t vfo, freq_t freq) /* * actually, frequency must be like nnnn.nnnnm, - * where m must be 0 or 5 (for 50Hz). + * where m must be 0 or 5 (for 50 Hz). */ lowhz = ((unsigned)freq) % 100; freq /= 100; @@ -400,7 +400,7 @@ int ar3k_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) /* * actually, frequency must be like nnn.nm, - * where m must be 0 or 5 (for 50Hz). + * where m must be 0 or 5 (for 50 Hz). */ lowhz = ts % 100; ts /= 100; diff --git a/rigs/aor/ar5000.c b/rigs/aor/ar5000.c index ccee0e476..cc4fd6839 100644 --- a/rigs/aor/ar5000.c +++ b/rigs/aor/ar5000.c @@ -41,7 +41,7 @@ #define AR5000_VFO (RIG_VFO_A | RIG_VFO_B | RIG_VFO_C | RIG_VFO_N(3) | RIG_VFO_N(4)) /* As reported with rigctl 'l RAWSTR' for AR5000A S/n: 171218 - on 7040kHz / CW / 3kHz Bw. + on 7040 kHz / CW / 3 kHz Bw. The data available on http://www.aoruk.com did not match very well on HF */ #define AR5000_STR_CAL { 16, { \ diff --git a/rigs/aor/ar7030.c b/rigs/aor/ar7030.c index e5a4fafed..1536158fe 100644 --- a/rigs/aor/ar7030.c +++ b/rigs/aor/ar7030.c @@ -540,7 +540,7 @@ static int ar7030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) case RIG_LEVEL_CWPITCH : // bfoval Mem_Page=0 Address=36 - // BFO offset in Hz (x33.19Hz)(values -4248.320 to 4215.130kHz). + // BFO offset in Hz (x33.19 Hz)(values -4248.320 to 4215.130 kHz). val.i = val.i * 100 / 3319; if (val.i < -128) {val.i = -128;} @@ -619,7 +619,7 @@ static int ar7030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_CWPITCH : // bfoval Mem_Page=0 Address=36 - // BFO offset in Hz (x33.19Hz)(values -4248.320 to 4215.130kHz). + // BFO offset in Hz (x33.19 Hz)(values -4248.320 to 4215.130 kHz). setMemPtr(rig, 0, 0x36); val->i = ((char)rxr_readByte(rig) * 3319) / 100; return RIG_OK; diff --git a/rigs/aor/ar7030p.h b/rigs/aor/ar7030p.h index 33e38d167..0e604f053 100644 --- a/rigs/aor/ar7030p.h +++ b/rigs/aor/ar7030p.h @@ -685,7 +685,7 @@ processor. - Keep out (by order). byte 2 bit 4 rx_aux Aux relay enable byte 2 bit 5 rx_fs5 Filter select : FS5 byte 2 bit 6 rx_fs6 Filter select : FS6 - byte 2 bit 7 rx_ibw IF b/w : 0 = 4kHz / 1 = 10kHz + byte 2 bit 7 rx_ibw IF b/w : 0 = 4 kHz / 1 = 10 kHz byte 3 bit 0 rx_chg Fast charge enable byte 3 bit 1 rx_pwr PSU enable byte 3 bit 2 rx_svi Sync VCO inhibit diff --git a/rigs/aor/ar8000.c b/rigs/aor/ar8000.c index e1e483022..fa8334747 100644 --- a/rigs/aor/ar8000.c +++ b/rigs/aor/ar8000.c @@ -145,7 +145,7 @@ struct rig_caps ar8000_caps = /* mode/filter list, .remember = order matters! */ {RIG_MODE_SSB | RIG_MODE_CW, kHz(2)}, {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, - {RIG_MODE_WFM, kHz(180)}, /* 50kHz at -3dB, 380kHz at -20dB */ + {RIG_MODE_WFM, kHz(180)}, /* 50 kHz at -3dB, 380 kHz at -20dB */ RIG_FLT_END, }, diff --git a/rigs/aor/ar8200.c b/rigs/aor/ar8200.c index 18e4cda19..5c7c65c32 100644 --- a/rigs/aor/ar8200.c +++ b/rigs/aor/ar8200.c @@ -170,7 +170,7 @@ struct rig_caps ar8200_caps = {RIG_MODE_AM, kHz(3)}, {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, {RIG_MODE_FM, kHz(9)}, - {RIG_MODE_WFM, kHz(230)}, /* 50kHz at -3dB, 380kHz at -20dB */ + {RIG_MODE_WFM, kHz(230)}, /* 50 kHz at -3dB, 380 kHz at -20dB */ RIG_FLT_END, }, diff --git a/rigs/aor/ar8600.c b/rigs/aor/ar8600.c index 1c05bbc05..dd68fd605 100644 --- a/rigs/aor/ar8600.c +++ b/rigs/aor/ar8600.c @@ -171,7 +171,7 @@ struct rig_caps ar8600_caps = {RIG_MODE_SSB | RIG_MODE_CW | RIG_MODE_AM, kHz(3)}, {RIG_MODE_FM | RIG_MODE_AM, kHz(12)}, {RIG_MODE_FM, kHz(9)}, - {RIG_MODE_WFM, kHz(230)}, /* 150kHz at -3dB, 380kHz at -20dB */ + {RIG_MODE_WFM, kHz(230)}, /* 150 kHz at -3dB, 380 kHz at -20dB */ RIG_FLT_END, }, diff --git a/rigs/barrett/950.c b/rigs/barrett/950.c index 73525fe78..121b8713f 100644 --- a/rigs/barrett/950.c +++ b/rigs/barrett/950.c @@ -164,7 +164,7 @@ int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq) for (i = 0; i < 10; ++i) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: Mhz=%lg, lo=%lg, hi=%lg\n", __func__, + rig_debug(RIG_DEBUG_VERBOSE, "%s: MHz=%lg, lo=%lg, hi=%lg\n", __func__, freq_MHz, chan_map[i].lo, chan_map[i].hi); if (freq_MHz >= chan_map[i].lo && freq_MHz <= chan_map[i].hi) diff --git a/rigs/commradio/commradio.c b/rigs/commradio/commradio.c index 560419438..b9a7d9acf 100644 --- a/rigs/commradio/commradio.c +++ b/rigs/commradio/commradio.c @@ -178,7 +178,7 @@ int commradio_set_freq(RIG *rig, vfo_t vfo, freq_t freq) } } // CTX-10 returns 11 02 30 00 00 00 01 if we try to go out of its - // general-coverage frequency range 150kHz - 30MHz. I'm not sure why Hamlib + // general-coverage frequency range 150 kHz - 30 MHz. I'm not sure why Hamlib // even tries to do this, since its defined in the caps... else { diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index 0fe7d5f66..028128eeb 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -102,7 +102,7 @@ void drake_fix_string(char* inStr) * sentLen - the length of sentSt * recdStr - the radio's response string * recdLen - the length of recdStr - * res - The transaction reposnse + * res - The transaction response */ void drake_trans_rept(char* hdrStr, char* sentStr, int sentLen, char* recdStr, int recdLen, int res) { @@ -112,7 +112,7 @@ void drake_trans_rept(char* hdrStr, char* sentStr, int sentLen, char* recdStr, i int i; //in most cases each string is a buffer, so we need to ensure both command and response - //are not NULL and null-terminated before duplicastion and conversion. + //are not NULL and null-terminated before duplication and conversion. if ((sentStr != NULL) && (sentLen > 0)) { @@ -253,7 +253,7 @@ int drake_report_signal(RIG *rig, char* owner) * Common routine to decode the frequency block * * inputs: rig - pointer to RIG structure - * freqbuf - buffer containung radio's response string + * freqbuf - buffer containing radio's response string * offset - offset to beginning of string due to differences in R8 vs. R8A/B * Note: strings are virtually identical. offset is provided as a failsafe. * @@ -331,7 +331,7 @@ int drake_report_frequency(RIG *rig, char* owner) * Common routine to break out the 5-character mode string * * inputs: rig - pointer to RIG structure - * mdbuf - buffer containung radio's response string + * mdbuf - buffer containing radio's response string * offset - offset to beginning of string due to differences in R8 vs. R8A/B * * Assumes rig!=NULL @@ -510,7 +510,7 @@ int drake_report_mode(RIG *rig, char* owner) * Common routine to break out the 3 or 4-character mem string * * inputs: rig - pointer to RIG structure - * mdbuf - buffer containung radio's response string + * mdbuf - buffer containing radio's response string * offset - offset to beginning of string due to differences in R8 vs. R8A/B * Note: except for channel number size, strings are virtually identical. offset is provided as a failsafe. * @@ -716,7 +716,7 @@ int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq) int ack_len; int retval; - // 10Hz resolution - TODO: round nearest? + // 10 Hz resolution - TODO: round nearest? SNPRINTF((char *) freqbuf, sizeof(freqbuf), "F%07u" EOM, (unsigned int)freq / 10); retval = drake_transaction(rig, freqbuf, strlen(freqbuf), ackbuf, &ack_len); diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index e25d0bbf3..020fdaeb2 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -463,7 +463,7 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // if needed for testing enable this to emulate a rig with 100hz resolution #if 0 - // we emulate a rig with 100Hz set freq interval limits -- truncation + // we emulate a rig with 100 Hz set freq interval limits -- truncation freq = freq - fmod(freq, 100); #endif usleep(CMDSLEEP); diff --git a/rigs/elad/elad.c b/rigs/elad/elad.c index 87e8f71b6..5938baa2c 100644 --- a/rigs/elad/elad.c +++ b/rigs/elad/elad.c @@ -425,7 +425,7 @@ transaction_quit: * * Parameters: * cmd Same as elad_transaction() cmdstr - * buf Same as kenwwod_transaction() data + * buf Same as kenwood_transaction() data * buf_size Same as elad_transaction() datasize * expected Value of expected string length * diff --git a/rigs/icom/ic7000.c b/rigs/icom/ic7000.c index f052881b3..713463c20 100644 --- a/rigs/icom/ic7000.c +++ b/rigs/icom/ic7000.c @@ -156,10 +156,10 @@ static int ic7000_r2i_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, return err; } - // CAT section of manual says: nn = 0 -40 > bw = 50Hz > 3600Hz + // CAT section of manual says: nn = 0 -40 > bw = 50 Hz > 3600 Hz // Tested by Ian G3VPX 20201029 - // 0 - 9 > bw 50Hz to 500Hz in 50Hz steps - // 10 - 40 > bw 600Hz to 3600Hz in 100Hz steps + // 0 - 9 > bw 50 Hz to 500 Hz in 50 Hz steps + // 10 - 40 > bw 600 Hz to 3600 Hz in 100 Hz steps if (width != RIG_PASSBAND_NOCHANGE) { if (width <= 500) { *pd = width / 50 - 1; } @@ -277,7 +277,7 @@ struct rig_caps ic7000_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), IC7000_ALL_RX_MODES, -1, -1, IC7000_VFOS}, {MHz(400), MHz(470), IC7000_ALL_RX_MODES, -1, -1, IC7000_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, IC7000_OTHER_TX_MODES, W(2), W(100), IC7000_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, IC7000_OTHER_TX_MODES, W(2), W(100), IC7000_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, IC7000_OTHER_TX_MODES, W(2), W(50), IC7000_VFOS, RIG_ANT_2), diff --git a/rigs/icom/ic7200.c b/rigs/icom/ic7200.c index 9124f35ed..48b7b998f 100644 --- a/rigs/icom/ic7200.c +++ b/rigs/icom/ic7200.c @@ -204,7 +204,7 @@ struct rig_caps ic7200_caps = }, .rx_range_list2 = { {kHz(30), MHz(60), IC7200_ALL_RX_MODES, -1, -1, IC7200_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, IC7200_OTHER_TX_MODES, W(2), W(100), IC7200_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, IC7200_OTHER_TX_MODES, W(2), W(100), IC7200_VFOS, RIG_ANT_1), FRQ_RNG_HF(2, IC7200_AM_TX_MODES, W(1), W(40), IC7200_VFOS, RIG_ANT_1), /* AM class */ diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index 53adfc32f..610a1b684 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -348,19 +348,19 @@ struct rig_caps ic746_caps = #define S_MEM_BEEP 0x506 /* Button confirmation */ #define S_MEM_SQL_CTL 0x508 /* RF/SQL ctl set 0=auto; 1 = sql; 2 = RF+SQL */ #define S_MEM_QSPLT 0x511 /* enable quick split mode */ -/* values -9.999 MHz to + 9.999 Mhz */ +/* values -9.999 MHz to + 9.999 MHz */ #define S_MEM_SPLT_OFST 0x512 /* default split offset 4 bytes little endian last byte sign*/ #define S_MEM_SPLT_LOCK 0x513 /* split lock set */ -/* values 0.000 MHz to + 9.999 Mhz */ +/* values 0.000 MHz to + 9.999 MHz */ #define S_MEM_HF_DUP_OFST 0x514 /* default HF band duplex offset 3 byte little endian */ -#define S_MEM_6M_DUP_OFST 0x515 /* default 50 mHz duplex offset 3 byte little endian */ +#define S_MEM_6M_DUP_OFST 0x515 /* default 50 MHz duplex offset 3 byte little endian */ #define S_MEM_2M_DUP_OFST 0x516 /* default 144 MHz duplex offset 3 byte little endian */ #define S_MEM_AUTO_RPTR 0x518 /* auto repeater set 0=OFF; 1=ON-1; 2=ON-2 */ #define S_MEM_LANG 0x523 /* 0=English 1=Japanese for voice announcer */ #define S_MEM_TRCV 0x536 /* CI-V transceive mode */ #define S_MEM_CMP_LVL 0x538 /* speech compressor level 0-10 */ #define S_MEM_SBASS 0x539 /* SSB TX tone bass level */ -#define S_MEM_RTTY_FL_PB 0x562 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 KHz */ +#define S_MEM_RTTY_FL_PB 0x562 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 kHz */ #define S_MEM_RTTY_TWNPK 0x563 /* rtty twin peak filter off/on */ #define S_MEM_SCN_SPD 0x570 /* 0 = low; 1 = high */ #define S_MEM_NB_LVL 0x572 /* NB level 0-255 */ diff --git a/rigs/icom/ic756.c b/rigs/icom/ic756.c index bbf870866..5a13c6cb5 100644 --- a/rigs/icom/ic756.c +++ b/rigs/icom/ic756.c @@ -528,7 +528,7 @@ static const struct confparams ic756pro2_ext_parms[] = #define S_MEM_TRCV 0x532 /* CI-V transceive mode */ #define S_MEM_LANG 0x536 /* 0=English 1=Japanese for voice announcer */ #define S_MEM_SCN_SPD 0x556 /* 0 = low; 1 = high */ -#define S_MEM_RTTY_FL_PB 0x561 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 KHz */ +#define S_MEM_RTTY_FL_PB 0x561 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 kHz */ #define S_MEM_RTTY_TWNPK 0x562 /* rtty twin peak filter off/on */ diff --git a/rigs/icom/ic820h.c b/rigs/icom/ic820h.c index 24bc2bec7..e4674d008 100644 --- a/rigs/icom/ic820h.c +++ b/rigs/icom/ic820h.c @@ -84,7 +84,7 @@ struct rig_caps ic820h_caps = .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, /* Attenuator 15dB for each band. manual button */ - .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ + .max_rit = Hz(0), /* SSB,CW: +-1.0 kHz FM: +-5.0 kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ .targetable_vfo = 0, diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index 62cdfee2e..bed53514c 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -121,7 +121,7 @@ struct rig_caps ic821h_caps = .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, /* Attenuator 15dB for each band. manual button */ - .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ + .max_rit = Hz(0), /* SSB,CW: +-1.0 kHz FM: +-5.0 kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ .targetable_vfo = 0, diff --git a/rigs/icom/ic910.c b/rigs/icom/ic910.c index a1738bdad..5ca4f46b8 100644 --- a/rigs/icom/ic910.c +++ b/rigs/icom/ic910.c @@ -236,7 +236,7 @@ struct rig_caps ic910_caps = .dcs_list = NULL, .preamp = { 20, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, - .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ + .max_rit = Hz(0), /* SSB,CW: +-1.0 kHz FM: +-5.0 kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ // .targetable_vfo = RIG_TARGETABLE_FREQ, diff --git a/rigs/icom/ic970.c b/rigs/icom/ic970.c index 57ed988b4..26a47cd51 100644 --- a/rigs/icom/ic970.c +++ b/rigs/icom/ic970.c @@ -99,7 +99,7 @@ struct rig_caps ic970_caps = .rx_range_list1 = { {MHz(144), MHz(146), IC970_MODES, -1, -1, IC970_VFO_ALL}, {MHz(430), MHz(440), IC970_MODES, -1, -1, IC970_VFO_ALL}, - /* 1200MHz band module is optional */ + /* 1200 MHz band module is optional */ // {MHz(1240),MHz(1300),IC970_MODES,-1,-1,IC970_VFO_ALL}, RIG_FRNG_END, }, @@ -113,7 +113,7 @@ struct rig_caps ic970_caps = .rx_range_list2 = { {MHz(144), MHz(150), IC970_MODES, -1, -1, IC970_VFO_ALL}, {MHz(430), MHz(450), IC970_MODES, -1, -1, IC970_VFO_ALL}, - /* 1200MHz band module is optional */ + /* 1200 MHz band module is optional */ // {MHz(1240),MHz(1300),IC970_MODES,-1,-1,IC970_VFO_ALL}, RIG_FRNG_END, }, diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index e1a00ea67..995a25a0c 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1920,7 +1920,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) *freq = from_bcd(freqbuf + freqbuf_offset, freq_len * 2); - // 3-byte freq for ID5100 is in 10000Hz units so convert to Hz + // 3-byte freq for ID5100 is in 10000 Hz units so convert to Hz if (freq_len == 3) { *freq *= 10000; } if (vfo == RIG_VFO_MEM && civ_731_mode_save) { priv->civ_731_mode = 1; } @@ -5665,7 +5665,7 @@ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) offs_len = (priv_caps->offs_len) ? priv_caps->offs_len : OFFS_LEN; /* - * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF + * Icoms are using a 100 Hz unit (at least on 706MKIIg) -- SF */ to_bcd(offsbuf, rptr_offs / 100, offs_len * 2); @@ -5721,7 +5721,7 @@ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) } /* - * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF + * Icoms are using a 100 Hz unit (at least on 706MKIIg) -- SF */ *rptr_offs = from_bcd(offsbuf + 1, buf_len * 2) * 100; diff --git a/rigs/icom/icom_defs.h b/rigs/icom/icom_defs.h index 6313ec2de..129637439 100644 --- a/rigs/icom/icom_defs.h +++ b/rigs/icom/icom_defs.h @@ -134,7 +134,7 @@ #define S_NXDNVN 0x19 /* Set to NXDN_VN */ #define S_NXDN_N 0x20 /* Set to NXDN-N */ #define S_DCR 0x21 /* Set to DCR */ -#define S_DD 0x22 /* Set to DD 1200Mhz only? */ +#define S_DD 0x22 /* Set to DD 1200 MHz only? */ #define S_R7000_SSB 0x05 /* Set to SSB on R-7000 */ diff --git a/rigs/icom/xiegu.c b/rigs/icom/xiegu.c index b31920bbd..31beb8d57 100644 --- a/rigs/icom/xiegu.c +++ b/rigs/icom/xiegu.c @@ -267,7 +267,7 @@ struct rig_caps x108g_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, {MHz(400), MHz(470), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, X108G_OTHER_TX_MODES, W(2), W(50), X108G_VFOS, RIG_ANT_2), @@ -458,7 +458,7 @@ struct rig_caps x6100_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, {MHz(400), MHz(470), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, X108G_OTHER_TX_MODES, W(2), W(50), X108G_VFOS, RIG_ANT_2), @@ -634,7 +634,7 @@ struct rig_caps x6200_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, {MHz(400), MHz(470), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, X108G_OTHER_TX_MODES, W(2), W(50), X108G_VFOS, RIG_ANT_2), @@ -825,7 +825,7 @@ struct rig_caps g90_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, {MHz(400), MHz(470), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, X108G_OTHER_TX_MODES, W(2), W(50), X108G_VFOS, RIG_ANT_2), @@ -1000,7 +1000,7 @@ struct rig_caps x5105_caps = .rx_range_list2 = { {kHz(30), MHz(199.999999), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, {MHz(400), MHz(470), X108G_ALL_RX_MODES, -1, -1, X108G_VFOS}, RIG_FRNG_END, }, - .tx_range_list2 = { /* needs the 5 mhz channels added */ + .tx_range_list2 = { /* needs the 5 MHz channels added */ FRQ_RNG_HF(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_6m(2, X108G_OTHER_TX_MODES, W(2), W(100), X108G_VFOS, RIG_ANT_1), FRQ_RNG_2m(2, X108G_OTHER_TX_MODES, W(2), W(50), X108G_VFOS, RIG_ANT_2), diff --git a/rigs/kachina/kachina.c b/rigs/kachina/kachina.c index 01eac0384..b7abd2b6f 100644 --- a/rigs/kachina/kachina.c +++ b/rigs/kachina/kachina.c @@ -126,7 +126,7 @@ static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data, } /* - * convert a frequency in Hz in the range of 30kHz to 30MHz + * convert a frequency in Hz in the range of 30 kHz to 30 MHz * to DDS value, as expected by the Kachina. */ static void freq2dds(freq_t freq, int ant_port, unsigned char fbuf[4]) diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index f2d117e54..fcb587196 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -547,7 +547,7 @@ static int powersdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) case RIG_VFO_A: if ((mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB) && width > 3000) { - // 150Hz on the low end should be enough + // 150 Hz on the low end should be enough // Set high to the width requested SNPRINTF(buf, sizeof(buf), "ZZFL00150;ZZFH%05d;", (int)width); } diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index 9ef8f03b4..780ff36e3 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -1245,7 +1245,7 @@ static int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) break; case RIG_MODE_PSK: - mode = RIG_MODE_PSK; // in "DT3" subband RIG_MODE_PSK = USB # kenwood.c mode but may need kenwwod.c mode table review. + mode = RIG_MODE_PSK; // in "DT3" subband RIG_MODE_PSK = USB # kenwood.c mode but may need kenwood.c mode table review. SNPRINTF(cmd_m, sizeof(cmd_m), "%s3", dtcmd); /* PSK D Mode - direct PSK keying, USB is "normal", VFO dial is MARK */ break; @@ -1333,7 +1333,7 @@ static int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) } #endif - width += 9; // rounds to 10Hz + width += 9; // rounds to 10 Hz if (width > 99999) { width = 99999; } diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 3d67090a7..03cbe0d12 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -726,7 +726,7 @@ transaction_quit: * * Parameters: * cmd Same as kenwood_transaction() cmdstr - * buf Same as kenwwod_transaction() data + * buf Same as kenwood_transaction() data * buf_size Same as kenwood_transaction() datasize * expected Value of expected string length * @@ -1918,7 +1918,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (RIG_OK != err) { RETURNFUNC2(err); } } - // Malchite is so slow we don't do the get_freq + // Malachite is so slow we don't do the get_freq // And when we have detected Doppler operations we just set the freq all the time // This should provide stable timing for set_ptt operation so relay delays are consistent if (!RIG_IS_MALACHITE && STATE(rig)->doppler == 0) @@ -2265,7 +2265,7 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { SNPRINTF(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D'); diff = labs(((curr_rit - rit) + (curr_rit - rit) >= 0 ? 5 : -5) / - 10); // round to nearest 10Hz + 10); // round to nearest 10 Hz rig_debug(RIG_DEBUG_TRACE, "%s: rit=%ld, curr_rit=%ld, diff=%d\n", __func__, rit, curr_rit, diff); rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff); diff --git a/rigs/kenwood/th.c b/rigs/kenwood/th.c index f4fea37dd..91d53b521 100644 --- a/rigs/kenwood/th.c +++ b/rigs/kenwood/th.c @@ -233,7 +233,7 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq) freq_sent = freq625; } - /* Step needs to be at least 10kHz on higher band, otherwise 5 kHz */ + /* Step needs to be at least 10 kHz on higher band, otherwise 5 kHz */ step = freq_sent >= MHz(470) ? 4 : step; freq_sent = freq_sent >= MHz(470) ? (round(freq_sent / 10000) * 10000) : freq_sent; diff --git a/rigs/kenwood/thd72.c b/rigs/kenwood/thd72.c index fb164decf..1abaf28e7 100644 --- a/rigs/kenwood/thd72.c +++ b/rigs/kenwood/thd72.c @@ -63,8 +63,8 @@ static rmode_t thd72_mode_table[3] = static pbwidth_t thd72_width_table[3] = { - [0] = 10000, // +-5KHz - [1] = 5000, // +-2.5KHz + [0] = 10000, // +-5 kHz + [1] = 5000, // +-2.5 kHz [2] = 10000, // what should this be? }; diff --git a/rigs/kenwood/thd74.c b/rigs/kenwood/thd74.c index 5ae158f9f..ab1040a6a 100644 --- a/rigs/kenwood/thd74.c +++ b/rigs/kenwood/thd74.c @@ -64,8 +64,8 @@ static rmode_t thd74_mode_table[10] = static pbwidth_t thd74_width_table[10] = { - [0] = 10000, // +-5KHz - [1] = 5000, // +-2.5KHz + [0] = 10000, // +-5 kHz + [1] = 5000, // +-2.5 kHz [2] = 10000, // FIXME: what should this be? [3] = 10000, // FIXME: what should this be? [4] = 10000, // FIXME: what should this be? diff --git a/rigs/kenwood/thf6a.c b/rigs/kenwood/thf6a.c index c9aa67d45..e299b4505 100644 --- a/rigs/kenwood/thf6a.c +++ b/rigs/kenwood/thf6a.c @@ -209,7 +209,7 @@ struct rig_caps thf6a_caps = .tuning_steps = { /* This table is ordered according to protocol, from '0' to 'b' */ - /* The steps are not available on every band/frequency limit 470MHz */ + /* The steps are not available on every band/frequency limit 470 MHz */ {THF6_ALL_MODES, kHz(5)}, {THF6_ALL_MODES, kHz(6.25)}, {THF6_ALL_MODES, kHz(8.33)}, diff --git a/rigs/kenwood/thf7.c b/rigs/kenwood/thf7.c index 2440e50a5..252bcc159 100644 --- a/rigs/kenwood/thf7.c +++ b/rigs/kenwood/thf7.c @@ -203,7 +203,7 @@ struct rig_caps thf7e_caps = .tuning_steps = { /* This table is ordered according to protocol, from '0' to 'b' */ - /* The steps are not available on every band/frequency limit 470MHz */ + /* The steps are not available on every band/frequency limit 470 MHz */ {THF7_ALL_MODES, kHz(5)}, {THF7_ALL_MODES, kHz(6.25)}, {THF7_ALL_MODES, kHz(8.33)}, diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index ab77a24fc..baadeb82c 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -1221,7 +1221,7 @@ int tmd710_do_set_freq(RIG *rig, vfo_t vfo, freq_t freq) freq_sent = freq625; } - /* Step needs to be at least 10kHz on higher band, otherwise 5 kHz */ + /* Step needs to be at least 10 kHz on higher band, otherwise 5 kHz */ fo_struct.step = freq_sent >= MHz(470) ? 4 : step; fo_struct.freq = freq_sent >= MHz(470) ? (round(freq_sent / 10000) * 10000) : freq_sent; @@ -1858,7 +1858,7 @@ int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t freq) freq_sent = freq625; } - /* Step needs to be at least 10kHz on higher band, otherwise 5 kHz */ + /* Step needs to be at least 10 kHz on higher band, otherwise 5 kHz */ fo_struct.offset = freq_sent >= MHz(470) ? (round(freq_sent / 10000) * 10000) : freq_sent; diff --git a/rigs/kenwood/ts480.c b/rigs/kenwood/ts480.c index e8e37ad1e..a96a4ab22 100644 --- a/rigs/kenwood/ts480.c +++ b/rigs/kenwood/ts480.c @@ -2368,7 +2368,7 @@ static int malachite_init(RIG *rig) priv = STATE(rig)->priv; - priv->no_id = 1; // the Malchite doesn't like the ID; verify cmd + priv->no_id = 1; // the Malachite doesn't like the ID; verify cmd if (retval != RIG_OK) { RETURNFUNC(retval); } @@ -2447,7 +2447,7 @@ struct rig_caps malachite_caps = .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, - // Malchite needs 125ms unless going from low to high band -- see malachite_set_freq + // Malachite needs 125ms unless going from low to high band -- see malachite_set_freq // Do not change this without checking the 300ms delay in malachite_set_freq .post_write_delay = 250, .timeout = 3000, diff --git a/rigs/kit/elektor507.c b/rigs/kit/elektor507.c index 650326644..fa26b0680 100644 --- a/rigs/kit/elektor507.c +++ b/rigs/kit/elektor507.c @@ -836,7 +836,7 @@ static void find_P_Q_DIV1N(struct elektor507_priv_data *priv, freq_t freq) * P:8..2055, best 16..1023 (because of Pump) For stable operation: - + REF/Qtotal must not fall below 250kHz ( + + REF/Qtotal must not fall below 250 kHz ( + P*(REF/Qtotal) must not be above 400 MHz or below 100 MHz */ #if 1 @@ -885,7 +885,7 @@ static void find_P_Q_DIV1N(struct elektor507_priv_data *priv, freq_t freq) * P:8..2055, best 16..1023 (because of Pump) For stable operation: - + REF/Qtotal must not fall below 250kHz ( + + REF/Qtotal must not fall below 250 kHz ( + P*(REF/Qtotal) must not be above 400 MHz or below 100 MHz */ #if 1 @@ -977,7 +977,7 @@ static void find_P_Q_DIV1N( double newdelta, delta = fabs((priv->P * (Ref / priv->Q) / priv->Div1N) - freq4); - /* For stable operation: Ref/Qtotal must not fall below 250kHz */ + /* For stable operation: Ref/Qtotal must not fall below 250 kHz */ /* Qmax = (int) ( Ref / 250000); */ for (Qtotal = 2; Qtotal <= Qmax; Qtotal++) { diff --git a/rigs/pcr/pcr.c b/rigs/pcr/pcr.c index f0c73f673..656b34cc7 100644 --- a/rigs/pcr/pcr.c +++ b/rigs/pcr/pcr.c @@ -55,7 +55,7 @@ #define MD_P25 '8' /* PCR-2500 Only */ -/* define 2.8kHz, 6kHz, 15kHz, 50kHz, and 230kHz */ +/* define 2.8 kHz, 6 kHz, 15 kHz, 50 kHz, and 230 kHz */ #define FLT_2_8kHz '0' #define FLT_6kHz '1' #define FLT_15kHz '2' @@ -726,7 +726,7 @@ pcr_get_vfo(RIG *rig, vfo_t *vfo) * Assumes rig!=NULL * * K0GMMMKKKHHHmmff00 - * GMMMKKKHHH is frequency GHz.MHz.KHz.Hz + * GMMMKKKHHH is frequency GHz.MHz.kHz.Hz * mm is the mode setting * 00 = LSB * 01 = USB @@ -736,11 +736,11 @@ pcr_get_vfo(RIG *rig, vfo_t *vfo) * 05 = NFM * 06 = WFM * ff is the filter setting - * 00 = 2.8 Khz (CW USB LSB AM) - * 01 = 6.0 Khz (CW USB LSB AM NFM) - * 02 = 15 Khz (AM NFM) - * 03 = 50 Khz (AM NFM WFM) - * 04 = 230 Khz (WFM) + * 00 = 2.8 kHz (CW USB LSB AM) + * 01 = 6.0 kHz (CW USB LSB AM NFM) + * 02 = 15 kHz (AM NFM) + * 03 = 50 kHz (AM NFM WFM) + * 04 = 230 kHz (WFM) * */ diff --git a/rigs/tentec/orion.c b/rigs/tentec/orion.c index d81a00666..c2c30d31f 100644 --- a/rigs/tentec/orion.c +++ b/rigs/tentec/orion.c @@ -312,8 +312,7 @@ static void start_thread(RIG *rig) * \param rig * \brief tt565_open routine * - * Open the rig - check f * This backend supports the Ten-Tec Orion (565) and Orion II (566) transceivers. -irmware version issues + * Open the rig - check firmware version issues */ int tt565_open(RIG *rig) { diff --git a/rigs/tentec/orion.h b/rigs/tentec/orion.h index 3adeea11b..76772a4c2 100644 --- a/rigs/tentec/orion.h +++ b/rigs/tentec/orion.h @@ -335,8 +335,8 @@ RIG_MODEL(RIG_MODEL_TT565), }, /* mode/filter list, remember: order matters! */ .filters = { - /* 9MHz IF filters: 15kHz, 6kHz, 2.4kHz, 1.0kHz */ - /* opt: 1.8kHz, 500Hz, 250Hz */ + /* 9 MHz IF filters: 15 kHz, 6 kHz, 2.4 kHz, 1.0 kHz */ + /* opt: 1.8 kHz, 500 Hz, 250 Hz */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, 100}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, kHz(6)}, @@ -525,8 +525,8 @@ RIG_MODEL(RIG_MODEL_TT599), }, /* mode/filter list, remember: order matters! */ .filters = { - /* 15kHz, 6kHz, 2.4kHz, 1.0kHz */ - /* 9MHz IF filters: 2.4K standard */ + /* 15 kHz, 6 kHz, 2.4 kHz, 1.0 kHz */ + /* 9 MHz IF filters: 2.4K standard */ /* optional = 300, 600, 1.8k, 6k, 15k */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, 600}, diff --git a/rigs/tentec/tt550.c b/rigs/tentec/tt550.c index 69a002fc4..4857e189b 100644 --- a/rigs/tentec/tt550.c +++ b/rigs/tentec/tt550.c @@ -379,7 +379,7 @@ tt550_init(RIG *rig) priv->tx_cwbfo = priv->cwbfo = kHz(0.7); priv->agc = 2; /* medium */ priv->lineout = priv->spkvol = 0.0; /* mute */ - priv->stepsize = 100; /* default to 100Hz tuning step */ + priv->stepsize = 100; /* default to 100 Hz tuning step */ return RIG_OK; } @@ -1744,7 +1744,7 @@ tt550_decode_event(RIG *rig) { case KEY_F1_DOWN: - /* F1 changes the Step size from 1hz to 1mhz */ + /* F1 changes the Step size from 1 Hz to 1 MHz */ if (priv->stepsize < 10000) { /* In powers of ten */ diff --git a/rigs/winradio/winradio.c b/rigs/winradio/winradio.c index 9e7c273a1..3c47b77e3 100644 --- a/rigs/winradio/winradio.c +++ b/rigs/winradio/winradio.c @@ -132,9 +132,9 @@ int wr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) case RMD_FMN: *mode = RIG_MODE_FM; break; /* 15kHz or 17kHz on WR-3100 */ - case RMD_FM6: *mode = RIG_MODE_FM; break; /* 6kHz */ + case RMD_FM6: *mode = RIG_MODE_FM; break; /* 6 kHz */ - case RMD_FMM: *mode = RIG_MODE_FM; break; /* 50kHz */ + case RMD_FMM: *mode = RIG_MODE_FM; break; /* 50 kHz */ case RMD_FMW: *mode = RIG_MODE_WFM; break; diff --git a/rigs/wj/wj.c b/rigs/wj/wj.c index 51ee82520..ace3a5be4 100644 --- a/rigs/wj/wj.c +++ b/rigs/wj/wj.c @@ -159,7 +159,7 @@ static int wj_transaction(RIG *rig, int monitor) buf[5] |= wj_mode & 0x7; /* BFO frequency, not sure though */ - wj_bfo = (priv->ifshift.i / 10) + 0x400; /* LSBit is 10Hz, +455kHz */ + wj_bfo = (priv->ifshift.i / 10) + 0x400; /* LSBit is 10 Hz, +455 kHz */ buf[6] |= (wj_bfo >> 5) & 0x3f; buf[7] |= (wj_bfo & 0x1f) << 2; diff --git a/rigs/yaesu/frg8800.c b/rigs/yaesu/frg8800.c index 4cba501b7..73cde2e48 100644 --- a/rigs/yaesu/frg8800.c +++ b/rigs/yaesu/frg8800.c @@ -185,7 +185,7 @@ int frg8800_set_freq(RIG *rig, vfo_t vfo, freq_t freq) /* store bcd format in cmd (LSB) */ to_bcd(cmd, freq / 10, 8); - /* Byte1: 100Hz's and 25Hz step code */ + /* Byte1: 100 Hz's and 25 Hz step code */ cmd[0] = (cmd[0] & 0xf0) | (1 << ((((long long)freq) % 100) / 25)); /* Frequency set */ diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index e42aa5605..911ec8b7c 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -603,7 +603,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) memcpy(p_cmd, &ncmd[cmd_index].nseq, YAESU_CMD_LENGTH); - /* fixed 10Hz bug by OH2MMY */ + /* fixed 10 Hz bug by OH2MMY */ freq = (int) freq / 10; to_bcd(p_cmd, freq, 8); /* store bcd format in in p_cmd */ @@ -645,7 +645,7 @@ int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) priv->status.freq[3]); d1 = strtol(freq_str, NULL, 16); - d2 = (d1 * 1.25); /* fixed 10Hz bug by OH2MMY */ + d2 = (d1 * 1.25); /* fixed 10 Hz bug by OH2MMY */ rig_debug(RIG_DEBUG_VERBOSE, "ft100: d1=%"PRIfreq" d2=%"PRIfreq"\n", d1, d2); diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index 3e0b7b072..2677fe98d 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -184,10 +184,10 @@ static const yaesu_cmd_set_t ncmd[] = { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* Select VFO (A) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* Select VFO (B) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* Copy Memory Data to VFO A */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* OP Freq Up 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* OP Freq Up 1MHz */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* OP Freq Down 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* OP Freq Down 1MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* OP Freq Up 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* OP Freq Up 1 MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* OP Freq Down 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* OP Freq Down 1 MHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* RX Clarifier (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* RX Clarifier (ON) */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, /* TX Clarifier (OFF) */ @@ -197,10 +197,10 @@ static const yaesu_cmd_set_t ncmd[] = { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* Set Op Freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* OP Mode Set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* OP Mode Set USB */ - { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW 2.4KHz */ - { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW 500Hz */ - { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM 6KHz */ - { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* OP Mode Set AM 2.4KHz */ + { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW 2.4 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW 500 Hz */ + { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM 6 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* OP Mode Set AM 2.4 kHz */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* OP Mode Set FM */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* OP Mode Set RTTY LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* OP Mode Set RTTY USB */ @@ -208,10 +208,10 @@ static const yaesu_cmd_set_t ncmd[] = { 1, { 0x00, 0x00, 0x00, 0x0b, 0x0c } }, /* OP Mode Set PKT FM */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x0c } }, /* Sub VFOB OP Mode Set LSB Added December 2016 */ { 1, { 0x00, 0x00, 0x00, 0x81, 0x0c } }, /* Sub VFOB OP Mode Set USB Added December 2016 */ - { 1, { 0x00, 0x00, 0x00, 0x82, 0x0c } }, /* Sub VFOB OP Mode Set CW 2.4KHz Added December 2016 */ - { 1, { 0x00, 0x00, 0x00, 0x83, 0x0c } }, /* Sub VFOB OP Mode Set CW 500Hz Added December 2016 */ - { 1, { 0x00, 0x00, 0x00, 0x84, 0x0c } }, /* Sub VFOB OP Mode Set AM 6KHz Added December 2016 */ - { 1, { 0x00, 0x00, 0x00, 0x85, 0x0c } }, /* Sub VFOB OP Mode Set AM 2.4KHz Added December 2016 */ + { 1, { 0x00, 0x00, 0x00, 0x82, 0x0c } }, /* Sub VFOB OP Mode Set CW 2.4 kHz Added December 2016 */ + { 1, { 0x00, 0x00, 0x00, 0x83, 0x0c } }, /* Sub VFOB OP Mode Set CW 500 Hz Added December 2016 */ + { 1, { 0x00, 0x00, 0x00, 0x84, 0x0c } }, /* Sub VFOB OP Mode Set AM 6 kHz Added December 2016 */ + { 1, { 0x00, 0x00, 0x00, 0x85, 0x0c } }, /* Sub VFOB OP Mode Set AM 2.4 kHz Added December 2016 */ { 1, { 0x00, 0x00, 0x00, 0x86, 0x0c } }, /* Sub VFOB OP Mode Set FM Added December 2016*/ { 1, { 0x00, 0x00, 0x00, 0x88, 0x0c } }, /* Sub VFOB OP Mode Set RTTY LSB Added December 2016 */ { 1, { 0x00, 0x00, 0x00, 0x89, 0x0c } }, /* Sub VFOB OP Mode Set RTTY USB Added December 2016 */ @@ -2365,7 +2365,7 @@ static int ft1000d_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, rig_strrmode(*mode)); // The FT1000D firmware appears to have a bug since the - // AM bandwidth for 2400Hz and 6000Hz are interchanged. + // AM bandwidth for 2400 Hz and 6000 Hz are interchanged. switch (*fl & (~FT1000D_BW_FMPKTRTTY)) { case FT1000D_BW_F2400: @@ -3130,7 +3130,7 @@ static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, * Get RX bandwidth selection * * The FT1000D firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT1000D_BW_FMPKTRTTY)) { @@ -3305,7 +3305,7 @@ static int ft1000d_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, * Get RX bandwidth selection * * The FT1000D firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT1000D_BW_FMPKTRTTY)) { diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index 5f19b55a7..e34d15666 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -850,7 +850,7 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) vfo = STATE(rig)->current_vfo; } - // round freq to 10Hz intervals due to rig restriction + // round freq to 10 Hz intervals due to rig restriction freq = round(freq / 10.0) * 10.0; switch (vfo) @@ -1487,7 +1487,7 @@ static int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit) priv->p_cmd[0] = rit_freq[0]; // 10 hz to_bcd_be(rit_freq, rit / 1000, 2); - priv->p_cmd[1] = rit_freq[0]; // Khz + priv->p_cmd[1] = rit_freq[0]; // kHz priv->p_cmd[2] = direction; diff --git a/rigs/yaesu/ft747.c b/rigs/yaesu/ft747.c index fdb6526f7..e36328c3a 100644 --- a/rigs/yaesu/ft747.c +++ b/rigs/yaesu/ft747.c @@ -205,8 +205,8 @@ static const yaesu_cmd_set_t ft747_ncmd[] = { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* memory to vfo*/ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* up 500 khz */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* down 500 khz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* up 500 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* down 500 kHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarify off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* clarify on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */ diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 0ca3a6bd8..4520a9c6c 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -1324,7 +1324,7 @@ static int ft818_817_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, eeprom_ant[0] &= 1 << 1; break; - case 0xB: /* FM BCB 76Mhz - 108Mhz, bit 2 */ + case 0xB: /* FM BCB 76 MHz - 108 MHz, bit 2 */ eeprom_ant[0] &= 1 << 2; break; diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index a166070d3..ed57a0682 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -37,7 +37,7 @@ * Notes on limitations in RIG control capabilities. These are * related to the Yaesu's FT847 design, not my program :-) * - * 1. Rig opcodes allow only 10Hz resolution. + * 1. Rig opcodes allow only 10 Hz resolution. * 2. Cannot select VFO B * 3. Using CAT and Tuner controls simultaneously can * cause problems. @@ -1285,7 +1285,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, return n < 0 ? n : -RIG_EPROTO; } - /* Remember, this is 10Hz resolution */ + /* Remember, this is 10 Hz resolution */ *freq = 10 * from_bcd_be(data, 8); *width = RIG_PASSBAND_NORMAL; diff --git a/rigs/yaesu/ft891.c b/rigs/yaesu/ft891.c index 63449314c..9597f667a 100644 --- a/rigs/yaesu/ft891.c +++ b/rigs/yaesu/ft891.c @@ -455,7 +455,7 @@ static int ft891_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, } // Get split mode status - *split = priv->ret_data[2] != '0'; // 1=split, 2=split + 5khz + *split = priv->ret_data[2] != '0'; // 1=split, 2=split + 5kHz rig_debug(RIG_DEBUG_TRACE, "%s: get split = 0x%02x\n", __func__, *split); *tx_vfo = RIG_VFO_A; diff --git a/rigs/yaesu/ft950.c b/rigs/yaesu/ft950.c index ec7cf7bf4..dce1410ce 100644 --- a/rigs/yaesu/ft950.c +++ b/rigs/yaesu/ft950.c @@ -147,7 +147,7 @@ struct rig_caps ft950_caps = { 100, 117, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ { 125, 128, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* 60M Channels U51-U54 or US1-US4, if available */ { 130, 130, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* 60M Channel U55 or US5, if available */ - { 131, 131, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* EU5, 5167.5 KHz Alaska Emergency Freq, if available */ + { 131, 131, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* EU5, 5167.5 kHz Alaska Emergency Freq, if available */ { 1, 5, RIG_MTYPE_MORSE }, RIG_CHAN_END, }, diff --git a/rigs/yaesu/ft990.c b/rigs/yaesu/ft990.c index 0d5ff078b..5de58d7d9 100755 --- a/rigs/yaesu/ft990.c +++ b/rigs/yaesu/ft990.c @@ -160,10 +160,10 @@ static const yaesu_cmd_set_t ncmd[] = { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* Select VFO (A) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* Select VFO (B) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* Copy Memory Data to VFO A */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* OP Freq Up 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* OP Freq Up 1MHz */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* OP Freq Down 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* OP Freq Down 1MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* OP Freq Up 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* OP Freq Up 1 MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* OP Freq Down 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* OP Freq Down 1 MHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* RX Clarifier (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* RX Clarifier (ON) */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, /* TX Clarifier (OFF) */ @@ -173,10 +173,10 @@ static const yaesu_cmd_set_t ncmd[] = { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* Set Op Freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* OP Mode Set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* OP Mode Set USB */ - { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW 2.4KHz */ - { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW 500Hz */ - { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM 6KHz */ - { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* OP Mode Set AM 2.4KHz */ + { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW 2.4 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW 500 Hz */ + { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM 6 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* OP Mode Set AM 2.4 kHz */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* OP Mode Set FM */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* OP Mode Set RTTY LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* OP Mode Set RTTY USB */ @@ -2155,7 +2155,7 @@ int ft990_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) rig_strrmode(*mode)); // The FT990 firmware appears to have a bug since the - // AM bandwidth for 2400Hz and 6000Hz are interchanged. + // AM bandwidth for 2400 Hz and 6000 Hz are interchanged. switch (*fl & (~FT990_BW_FMPKTRTTY)) { case FT990_BW_F2400: @@ -2909,7 +2909,7 @@ int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT990_BW_FMPKTRTTY)) { @@ -3084,7 +3084,7 @@ int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT990_BW_FMPKTRTTY)) { diff --git a/rigs/yaesu/ft990v12.c b/rigs/yaesu/ft990v12.c index 8e7a50552..3208cc7bd 100644 --- a/rigs/yaesu/ft990v12.c +++ b/rigs/yaesu/ft990v12.c @@ -175,10 +175,10 @@ static const yaesu_cmd_set_t ncmd[] = { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* 06 06 Select VFO (A) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* 07 07 Select VFO (B) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* 08 08 Copy Memory Data to VFO A */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* 09 09 OP Freq Up 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* 10 0a OP Freq Up 1MHz */ - { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* 11 0b OP Freq Down 0.1MHz */ - { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* 12 0c OP Freq Down 1MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* 09 09 OP Freq Up 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* 10 0a OP Freq Up 1 MHz */ + { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* 11 0b OP Freq Down 0.1 MHz */ + { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* 12 0c OP Freq Down 1 MHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* 13 0d RX Clarifier (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* 14 0e RX Clarifier (ON) */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, /* 15 0f TX Clarifier (OFF) */ @@ -188,10 +188,10 @@ static const yaesu_cmd_set_t ncmd[] = { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* 19 13 Set Op Freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* 20 14 OP Mode Set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* 21 15 OP Mode Set USB */ - { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* 22 16 OP Mode Set CW 2.4KHz */ - { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* 23 17 OP Mode Set CW 500Hz */ - { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* 24 18 OP Mode Set AM 6KHz */ - { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* 25 19 OP Mode Set AM 2.4KHz */ + { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* 22 16 OP Mode Set CW 2.4 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* 23 17 OP Mode Set CW 500 Hz */ + { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* 24 18 OP Mode Set AM 6 kHz */ + { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* 25 19 OP Mode Set AM 2.4 kHz */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* 26 1a OP Mode Set FM */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* 27 1b OP Mode Set RTTY LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* 28 1c OP Mode Set RTTY USB */ @@ -2188,7 +2188,7 @@ int ft990v12_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) rig_strrmode(*mode)); // The FT990 firmware appears to have a bug since the - // AM bandwidth for 2400Hz and 6000Hz are interchanged. + // AM bandwidth for 2400 Hz and 6000 Hz are interchanged. switch (*fl & (~FT990_BW_FMPKTRTTY)) { case FT990_BW_F2400: @@ -2942,7 +2942,7 @@ int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT990_BW_FMPKTRTTY)) { @@ -3118,7 +3118,7 @@ int ft990v12_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the - * AM bandwidth for 2400Hz and 6000Hz are interchanged. + * AM bandwidth for 2400 Hz and 6000 Hz are interchanged. */ switch (p->filter & (~FT990_BW_FMPKTRTTY)) { diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index 6417d523e..e87c933bf 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -6,7 +6,7 @@ * (C) Terry Embry 2008-2009 * (C) Michael Black W9MDB 2015 -- taken from ft950.c * - * The FT991 is very much like the FT950 except freq max increases for 440MHz + * The FT991 is very much like the FT950 except freq max increases for 440 MHz * So most of this code is a duplicate of the FT950 * * This shared library provides an API for communicating @@ -241,7 +241,7 @@ struct rig_caps ft991_caps = .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // P1L-P9U PMS channels - { 118, 127, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // 5xx 5MHz band + { 118, 127, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // 5xx 5 MHz band { 1, 5, RIG_MTYPE_VOICE }, { 1, 5, RIG_MTYPE_MORSE }, RIG_CHAN_END, diff --git a/rigs/yaesu/ftdx101.c b/rigs/yaesu/ftdx101.c index 1ae7918c6..81f00b89a 100644 --- a/rigs/yaesu/ftdx101.c +++ b/rigs/yaesu/ftdx101.c @@ -244,7 +244,7 @@ struct rig_caps ftdx101d_caps = .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // P1L-P9U PMS channels - { 501, 510, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // 5xx 5MHz band + { 501, 510, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, // 5xx 5 MHz band { 1, 5, RIG_MTYPE_MORSE }, RIG_CHAN_END, }, diff --git a/rigs/yaesu/ftdx101mp.c b/rigs/yaesu/ftdx101mp.c index 4ceafd0d9..d0fd514af 100644 --- a/rigs/yaesu/ftdx101... [truncated message content] |
From: n0nb <n0...@us...> - 2025-08-04 12:36:56
|
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 8ccc197b7c01efdb0b22774d0b2210b6bec28e92 (commit) via 182597ebc46c1d99eefe08ba3682c8538a18d133 (commit) via 0d079d2338c53d4b48bd8db5592749f28d9069c6 (commit) via 971ab5e1264aef5dd0a900ab02639ffcdb66a7f5 (commit) via bb070edfa3e68eb08a928266fc85a90673057b5f (commit) from 989623ec511e6f428aa8998e88df3f69f9e11d79 (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 8ccc197b7c01efdb0b22774d0b2210b6bec28e92 Author: jeremybox <gi...@je...> Date: Sun Aug 3 20:52:29 2025 -0400 ftx1: implement tuning step functionality and cleanup - Add ftx1_get_ts() and ftx1_set_ts() functions using EX0306 commands - Support mode-specific tuning step values: * SSB/CW & RTTY/PSK: 5Hz, 10Hz, 20Hz * FM: 5kHz, 6.25kHz, 10kHz, 12.5kHz, 20kHz, 25kHz, Auto - Remove unused functions: ftx1_handle_cat_error, ftx1_get_split, ftx1_set_split - Remove unused variable in ftx1_set_freq - Update header file to remove unused function declarations - Fix format specifiers (%d -> %ld) for shortfreq_t type Tested with real FTX-1 hardware using rigctl commands. Tuning step functionality verified in LSB mode with 20Hz step. diff --git a/rigs/yaesu/ftx1.c b/rigs/yaesu/ftx1.c index 39636b83b..8486dc17f 100644 --- a/rigs/yaesu/ftx1.c +++ b/rigs/yaesu/ftx1.c @@ -631,7 +631,7 @@ static void debug_ftx1info_data(const ftx1info *rdata) * VFO B mode directly so we'll just set A and swap A * into B but we must preserve the VFO A mode and VFO B * frequency. - * + * [TODO] This is inaccurate and based on copying the FT991A code to build this. Remove the above and implement it correctly. */ static int ftx1_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, @@ -1364,17 +1364,171 @@ static int ftx1_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) /* Tuning step functions */ static int ftx1_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { - // FTX-1 doesn't have a direct tuning step query command - // Return a default value - *ts = 100; + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int err; + char response[32]; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (!rig || !ts) + { + return -RIG_EINVAL; + } + + // Get current mode to determine which tuning step setting to query + rmode_t mode; + pbwidth_t width; + if (RIG_OK != (err = rig_get_mode(rig, vfo, &mode, &width))) + { + return err; + } + + // Determine which tuning step setting to query based on mode + int setting_num; + if (mode == RIG_MODE_FM || mode == RIG_MODE_FMN) + { + setting_num = 3; // FM DIAL STEP + } + else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR || + mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB) + { + setting_num = 2; // RTTY/PSK DIAL STEP + } + else + { + setting_num = 1; // SSB/CW DIAL STEP + } + + // Send EX0306[setting_num]; to query current tuning step + // The radio returns the current value in the response + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0306%02d;", setting_num); + + if (RIG_OK != (err = newcat_get_cmd(rig))) + { + return err; + } + + // Parse response like "EX0306012;" or "EX0306021;" or "EX0306033;" + strncpy(response, priv->ret_data, sizeof(response) - 1); + response[sizeof(response) - 1] = '\0'; + + if (strlen(response) >= 9 && strncmp(response, "EX0306", 6) == 0) + { + // Extract the step value from the response (last digit before semicolon) + char step_str[2]; + int len = strlen(response); + if (len >= 9) { + step_str[0] = response[len - 2]; // Get the digit before semicolon + step_str[1] = '\0'; + } else { + step_str[0] = '1'; // Default to 1 (10Hz) + step_str[1] = '\0'; + } + + int step_value = atoi(step_str); + + // Convert step value to frequency based on mode + if (mode == RIG_MODE_FM || mode == RIG_MODE_FMN) + { + // FM DIAL STEP values: 0:5kHz, 1:6.25kHz, 2:10kHz, 3:12.5kHz, 4:20kHz, 5:25kHz, 6:Auto + switch (step_value) { + case 0: *ts = 5000; break; + case 1: *ts = 6250; break; + case 2: *ts = 10000; break; + case 3: *ts = 12500; break; + case 4: *ts = 20000; break; + case 5: *ts = 25000; break; + case 6: *ts = 0; break; // Auto - return 0 to indicate auto mode + default: *ts = 10000; break; + } + } + else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR || + mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB) + { + // RTTY/PSK DIAL STEP values: 0:5Hz, 1:10Hz, 2:20Hz + switch (step_value) { + case 0: *ts = 5; break; + case 1: *ts = 10; break; + case 2: *ts = 20; break; + default: *ts = 10; break; + } + } + else + { + // SSB/CW DIAL STEP values: 0:5Hz, 1:10Hz, 2:20Hz + switch (step_value) { + case 0: *ts = 5; break; + case 1: *ts = 10; break; + case 2: *ts = 20; break; + default: *ts = 10; break; + } + } + + rig_debug(RIG_DEBUG_TRACE, "%s: response=%s, setting=%d, step_value=%d, ts=%ld\n", + __func__, response, setting_num, step_value, *ts); + + return RIG_OK; + } + + // If parsing failed, return default + *ts = 10; return RIG_OK; } static int ftx1_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { - // FTX-1 doesn't have a direct tuning step set command - // This would need to be implemented via mode-specific commands - return -RIG_ENIMPL; + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int step_value, setting_num; + rmode_t mode; + pbwidth_t width; + int err; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called with ts=%ld\n", __func__, ts); + + // Get current mode to determine which tuning step setting to modify + if (RIG_OK != (err = rig_get_mode(rig, vfo, &mode, &width))) + { + return err; + } + + // Determine which tuning step setting to modify based on mode + if (mode == RIG_MODE_FM || mode == RIG_MODE_FMN) + { + setting_num = 3; // FM DIAL STEP + // Convert frequency to FM step value: 0:5kHz, 1:6.25kHz, 2:10kHz, 3:12.5kHz, 4:20kHz, 5:25kHz, 6:Auto + if (ts == 0) step_value = 6; // Auto mode + else if (ts <= 5000) step_value = 0; + else if (ts <= 6250) step_value = 1; + else if (ts <= 10000) step_value = 2; + else if (ts <= 12500) step_value = 3; + else if (ts <= 20000) step_value = 4; + else step_value = 5; + } + else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR || + mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB) + { + setting_num = 2; // RTTY/PSK DIAL STEP + // Convert frequency to RTTY step value: 0:5Hz, 1:10Hz, 2:20Hz + if (ts <= 5) step_value = 0; + else if (ts <= 10) step_value = 1; + else step_value = 2; + } + else + { + setting_num = 1; // SSB/CW DIAL STEP + // Convert frequency to SSB/CW step value: 0:5Hz, 1:10Hz, 2:20Hz + if (ts <= 5) step_value = 0; + else if (ts <= 10) step_value = 1; + else step_value = 2; + } + + // Format: EX0306[setting_num][step_value]; + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0306%02d%d;", setting_num, step_value); + + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s (setting=%d, step_value=%d)\n", + __func__, priv->cmd_str, setting_num, step_value); + + return newcat_set_cmd(rig); } /* diff --git a/rigs/yaesu/ftx1.h b/rigs/yaesu/ftx1.h index d6f96ef43..63251bd74 100644 --- a/rigs/yaesu/ftx1.h +++ b/rigs/yaesu/ftx1.h @@ -164,12 +164,12 @@ /* Delay between bytes sent to FTX-1 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ -#define FTX1_WRITE_DELAY 0 +#define FTX1_WRITE_DELAY 5 /* Delay sequential fast writes */ -#define FTX1_POST_WRITE_DELAY 2 +#define FTX1_POST_WRITE_DELAY 5 typedef struct { diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 31ce67d01..2a0ae172e 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -249,7 +249,7 @@ static ncboolean is_ftdx9000Old; static const yaesu_newcat_commands_t valid_commands[] = { /* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D FTDX10 FTDX101MP FT710 FTX1 FT9000Old*/ - {"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE }, + {"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -324,8 +324,8 @@ static const yaesu_newcat_commands_t valid_commands[] = {"PL", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"PR", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"PS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"QI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, - {"QR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"QI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"QR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"QS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"RA", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"RC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, diff --git a/rigs/yaesu/yaesu.c b/rigs/yaesu/yaesu.c index db9916d2b..d01b95c3c 100644 --- a/rigs/yaesu/yaesu.c +++ b/rigs/yaesu/yaesu.c @@ -2,7 +2,7 @@ * hamlib - (C) Frank Singleton 2000 (vk...@ix...) * * yaesu.c - (C) Stephane Fillod 2001-2010 - * (C) Jeremy Miller KO4SSD 2025 (ko4ssd at ko4ssd.com) + * (C) Jeremy Miller KO4SSD 2025 (ko4ssd at ko4ssd.com) * * This shared library provides an API for communicating * via serial interface to a Yaesu rig commit 182597ebc46c1d99eefe08ba3682c8538a18d133 Author: jeremybox <gi...@je...> Date: Sun Aug 3 18:20:06 2025 -0400 Clean up unused functions in FTX-1 driver - Remove unused ftx1_handle_cat_error function - Remove unused ftx1_get_split and ftx1_set_split functions - Remove unused variable 'err' in ftx1_set_freq - Remove corresponding function declarations from ftx1.h - Eliminates all compiler warnings for clean build diff --git a/rigs/yaesu/ftx1.c b/rigs/yaesu/ftx1.c index f65e27a9b..39636b83b 100644 --- a/rigs/yaesu/ftx1.c +++ b/rigs/yaesu/ftx1.c @@ -1218,17 +1218,7 @@ static int ftx1_get_vfo(RIG *rig, vfo_t *vfo) RETURNFUNC2(RIG_OK); } -/* Error handling function */ -static int ftx1_handle_cat_error(RIG *rig, const char *response) -{ - if (strstr(response, "?;")) { - return -RIG_EPROTO; // Protocol error - } - if (strstr(response, "N;")) { - return -RIG_ERJCTED; // Command rejected - } - return RIG_OK; -} + @@ -1369,46 +1359,7 @@ static int ftx1_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) return RIG_OK; } -/* Split functions */ -static int ftx1_get_split(RIG *rig, vfo_t vfo, split_t *split) -{ - int err; - split_t is_split; - - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - if (!rig || !split) - { - return -RIG_EINVAL; - } - - err = ftx1_get_tx_split(rig, &is_split); - if (err != RIG_OK) - { - return err; - } - - *split = is_split; - return RIG_OK; -} - -static int ftx1_set_split(RIG *rig, vfo_t vfo, split_t split) -{ - int err; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - if (split == RIG_SPLIT_ON) - { - err = newcat_set_tx_vfo(rig, RIG_VFO_B); - } - else - { - err = newcat_set_tx_vfo(rig, RIG_VFO_A); - } - - return err; -} /* Tuning step functions */ static int ftx1_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) @@ -1533,7 +1484,6 @@ int ftx1_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; char c; - int err; ENTERFUNC; diff --git a/rigs/yaesu/ftx1.h b/rigs/yaesu/ftx1.h index efbfa37dd..d6f96ef43 100644 --- a/rigs/yaesu/ftx1.h +++ b/rigs/yaesu/ftx1.h @@ -197,11 +197,8 @@ static int ftx1_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static int ftx1_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ftx1_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); static int ftx1_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); -static int ftx1_get_split(RIG *rig, vfo_t vfo, split_t *split); -static int ftx1_set_split(RIG *rig, vfo_t vfo, split_t split); static int ftx1_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); static int ftx1_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); -static int ftx1_handle_cat_error(RIG *rig, const char *response); /* FTX-1 specific power control function */ int ftx1_set_power_control(RIG *rig, vfo_t vfo, setting_t level, value_t val); commit 0d079d2338c53d4b48bd8db5592749f28d9069c6 Author: jeremybox <gi...@je...> Date: Sat Aug 2 22:18:36 2025 -0400 Restore tests/Makefile.am to match master branch exactly diff --git a/tests/Makefile.am b/tests/Makefile.am index 44117eb1c..c120165ff 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,8 +39,6 @@ if HAVE_LIBUSB rigtestlibusb_SOURCES = rigtestlibusb.c endif - - # include generated include files ahead of any in sources rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) -I$(top_builddir)/security $(AM_CPPFLAGS) commit 971ab5e1264aef5dd0a900ab02639ffcdb66a7f5 Author: jeremybox <gi...@je...> Date: Sat Aug 2 22:12:46 2025 -0400 Remove test_ftx1 from Makefile to fix build issues - Removed test_ftx1 from check_PROGRAMS list - Removed test_ftx1_SOURCES definition - This prevents build failures on systems without the test file diff --git a/tests/Makefile.am b/tests/Makefile.am index 141c2cab4..44117eb1c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,7 +17,7 @@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum bin_PROGRAMS = rigctl rigctld rigmem rigsmtr rigswr rotctl rotctld rigctlcom rigctltcp rigctlsync ampctl ampctld rigtestmcast rigtestmcastrx $(TESTLIBUSB) rigfreqwalk #check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid testsecurity -check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power test2038 test_ftx1 +check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power test2038 RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c dumpstate.c uthash.h rig_tests.c rig_tests.h dumpcaps.h ROTCOMMONSRC = rotctl_parse.c rotctl_parse.h dumpcaps_rot.c uthash.h dumpcaps_rot.h @@ -39,7 +39,7 @@ if HAVE_LIBUSB rigtestlibusb_SOURCES = rigtestlibusb.c endif -test_ftx1_SOURCES = test_ftx1.c + # include generated include files ahead of any in sources rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) -I$(top_builddir)/security $(AM_CPPFLAGS) commit bb070edfa3e68eb08a928266fc85a90673057b5f Author: jeremybox <gi...@je...> Date: Sat Aug 2 22:02:05 2025 -0400 Enhanced FTX-1 support with comprehensive improvements diff --git a/rigs/yaesu/ftx1.c b/rigs/yaesu/ftx1.c index db87a3989..f65e27a9b 100644 --- a/rigs/yaesu/ftx1.c +++ b/rigs/yaesu/ftx1.c @@ -35,6 +35,8 @@ #include "yaesu.h" #include "ftx1.h" +static const char cat_term = ';'; /* Yaesu command terminator */ + /* Prototypes */ static int ftx1_init(RIG *rig); static int ftx1_set_vfo(RIG *rig, vfo_t vfo); @@ -55,6 +57,11 @@ static int ftx1_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); static int ftx1_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code); static int ftx1_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); +/* Configuration parameters */ +const struct confparams ftx1_cfg_params[] = { + { RIG_CONF_END, NULL, } +}; + const struct confparams ftx1_ext_levels[] = { { @@ -154,6 +161,7 @@ const struct confparams ftx1_ext_levels[] = RIG_CONF_NUMERIC, { .n = { .min = 5, .max = 50, .step = 1 } }, }, + { RIG_CONF_END, NULL, } }; @@ -278,70 +286,71 @@ struct rig_caps ftx1_caps = /* mode/filter list, .remember = order matters! */ .filters = { - {FTX1_RTTY_DATA_RX_MODES, Hz(500)}, /* Normal RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(300)}, /* Narrow RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(3000)}, /* Wide RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(2400)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(2000)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(1700)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(1400)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(1200)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(800)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(450)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(400)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(350)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(250)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(200)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(150)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(100)}, /* RTTY, DATA */ - {FTX1_RTTY_DATA_RX_MODES, Hz(50)}, /* RTTY, DATA */ - {FTX1_CW_RX_MODES, Hz(2400)}, /* Normal CW */ - {FTX1_CW_RX_MODES, Hz(500)}, /* Narrow CW */ - {FTX1_CW_RX_MODES, Hz(3000)}, /* Wide CW */ - {FTX1_CW_RX_MODES, Hz(2000)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(1700)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(1400)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(1200)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(800)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(450)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(400)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(350)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(300)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(250)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(200)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(150)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(100)}, /* CW */ - {FTX1_CW_RX_MODES, Hz(50)}, /* CW */ - {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ - {RIG_MODE_SSB, Hz(1500)}, /* Narrow SSB */ - {RIG_MODE_SSB, Hz(3200)}, /* Wide SSB */ - {RIG_MODE_SSB, Hz(3000)}, /* SSB */ - {RIG_MODE_SSB, Hz(2900)}, /* SSB */ - {RIG_MODE_SSB, Hz(2800)}, /* SSB */ - {RIG_MODE_SSB, Hz(2700)}, /* SSB */ - {RIG_MODE_SSB, Hz(2600)}, /* SSB */ - {RIG_MODE_SSB, Hz(2500)}, /* SSB */ - {RIG_MODE_SSB, Hz(2300)}, /* SSB */ - {RIG_MODE_SSB, Hz(2200)}, /* SSB */ - {RIG_MODE_SSB, Hz(2100)}, /* SSB */ - {RIG_MODE_SSB, Hz(1950)}, /* SSB */ - {RIG_MODE_SSB, Hz(1650)}, /* SSB */ - {RIG_MODE_SSB, Hz(1350)}, /* SSB */ - {RIG_MODE_SSB, Hz(1100)}, /* SSB */ - {RIG_MODE_SSB, Hz(850)}, /* SSB */ - {RIG_MODE_SSB, Hz(600)}, /* SSB */ - {RIG_MODE_SSB, Hz(400)}, /* SSB */ - {RIG_MODE_SSB, Hz(200)}, /* SSB */ - {RIG_MODE_AM, Hz(9000)}, /* Normal AM */ - {RIG_MODE_AMN, Hz(6000)}, /* Narrow AM */ - {FTX1_FM_WIDE_RX_MODES, Hz(16000)}, /* Normal FM, PKTFM, C4FM */ - {RIG_MODE_FMN, Hz(9000)}, /* Narrow FM */ + {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ + {RIG_MODE_SSB, Hz(1500)}, /* Narrow SSB */ + {RIG_MODE_SSB, Hz(3200)}, /* Wide SSB */ + {RIG_MODE_CW, Hz(500)}, /* Normal CW */ + {RIG_MODE_CW, Hz(300)}, /* Narrow CW */ + {RIG_MODE_CW, Hz(2400)}, /* Wide CW */ + {RIG_MODE_FM, Hz(16000)}, /* Normal FM */ + {RIG_MODE_FMN, Hz(9000)}, /* Narrow FM */ + {RIG_MODE_AM, Hz(9000)}, /* Normal AM */ + {RIG_MODE_AMN, Hz(6000)}, /* Narrow AM */ + {FTX1_RTTY_DATA_RX_MODES, Hz(500)}, /* Normal RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(300)}, /* Narrow RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(3000)}, /* Wide RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(2400)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(2000)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(1700)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(1400)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(1200)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(800)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(450)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(400)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(350)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(250)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(200)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(150)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(100)}, /* RTTY, DATA */ + {FTX1_RTTY_DATA_RX_MODES, Hz(50)}, /* RTTY, DATA */ + {FTX1_CW_RX_MODES, Hz(2000)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(1700)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(1400)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(1200)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(800)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(450)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(400)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(350)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(300)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(250)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(200)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(150)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(100)}, /* CW */ + {FTX1_CW_RX_MODES, Hz(50)}, /* CW */ + {RIG_MODE_SSB, Hz(3000)}, /* SSB */ + {RIG_MODE_SSB, Hz(2900)}, /* SSB */ + {RIG_MODE_SSB, Hz(2800)}, /* SSB */ + {RIG_MODE_SSB, Hz(2700)}, /* SSB */ + {RIG_MODE_SSB, Hz(2600)}, /* SSB */ + {RIG_MODE_SSB, Hz(2500)}, /* SSB */ + {RIG_MODE_SSB, Hz(2300)}, /* SSB */ + {RIG_MODE_SSB, Hz(2200)}, /* SSB */ + {RIG_MODE_SSB, Hz(2100)}, /* SSB */ + {RIG_MODE_SSB, Hz(1950)}, /* SSB */ + {RIG_MODE_SSB, Hz(1650)}, /* SSB */ + {RIG_MODE_SSB, Hz(1350)}, /* SSB */ + {RIG_MODE_SSB, Hz(1100)}, /* SSB */ + {RIG_MODE_SSB, Hz(850)}, /* SSB */ + {RIG_MODE_SSB, Hz(600)}, /* SSB */ + {RIG_MODE_SSB, Hz(400)}, /* SSB */ + {RIG_MODE_SSB, Hz(200)}, /* SSB */ RIG_FLT_END, }, .ext_tokens = ftx1_ext_tokens, .extlevels = ftx1_ext_levels, + .cfgparams = ftx1_cfg_params, .priv = NULL, /* private data FIXME: */ @@ -350,7 +359,7 @@ struct rig_caps ftx1_caps = .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ - .set_freq = newcat_set_freq, + .set_freq = ftx1_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, @@ -364,16 +373,16 @@ struct rig_caps ftx1_caps = .get_split_freq = ftx1_get_split_freq, .get_split_mode = ftx1_get_split_mode, .set_split_mode = ftx1_set_split_mode, - .set_rit = newcat_set_rit, - .get_rit = newcat_get_rit, - .set_xit = newcat_set_xit, - .get_xit = newcat_get_xit, + .set_rit = ftx1_set_rit, + .get_rit = ftx1_get_rit, + .set_xit = ftx1_set_xit, + .get_xit = ftx1_get_xit, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_parm = newcat_get_parm, .set_parm = newcat_set_parm, - .get_level = newcat_get_level, - .set_level = newcat_set_level, + .get_level = ftx1_get_power_control, + .set_level = ftx1_set_power_control, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, @@ -394,8 +403,8 @@ struct rig_caps ftx1_caps = .get_dcs_sql = ftx1_get_dcs_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, - .set_ts = newcat_set_ts, - .get_ts = newcat_get_ts, + .set_ts = ftx1_set_ts, + .get_ts = ftx1_get_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, @@ -1207,4 +1216,351 @@ static int ftx1_get_vfo(RIG *rig, vfo_t *vfo) { *vfo = STATE(rig)->current_vfo; RETURNFUNC2(RIG_OK); +} + +/* Error handling function */ +static int ftx1_handle_cat_error(RIG *rig, const char *response) +{ + if (strstr(response, "?;")) { + return -RIG_EPROTO; // Protocol error + } + if (strstr(response, "N;")) { + return -RIG_ERJCTED; // Command rejected + } + return RIG_OK; +} + + + +/* RIT/XIT functions */ +static int ftx1_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int err; + ftx1info *rdata; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (!rig || !rit) + { + return -RIG_EINVAL; + } + + rdata = (ftx1info *)priv->ret_data; + + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "IF;"); + + if (RIG_OK != (err = newcat_get_cmd(rig))) + { + return err; + } + + debug_ftx1info_data(rdata); + + if (rdata->rx_clarifier == '1') + { + *rit = atoi(rdata->clarifier); + if (rdata->clarifier[0] == '-') + { + *rit = -*rit; + } + } + else + { + *rit = 0; + } + + return RIG_OK; +} + +static int ftx1_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int err; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (rit == 0) + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RC0;"); + } + else if (rit > 0) + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RC+%04ld;", rit); + } + else + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RC%05ld;", rit); + } + + if (RIG_OK != (err = newcat_set_cmd(rig))) + { + return err; + } + + return RIG_OK; +} + +static int ftx1_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int err; + ftx1info *rdata; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (!rig || !xit) + { + return -RIG_EINVAL; + } + + rdata = (ftx1info *)priv->ret_data; + + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "IF;"); + + if (RIG_OK != (err = newcat_get_cmd(rig))) + { + return err; + } + + debug_ftx1info_data(rdata); + + if (rdata->tx_clarifier == '1') + { + *xit = atoi(rdata->clarifier); + if (rdata->clarifier[0] == '-') + { + *xit = -*xit; + } + } + else + { + *xit = 0; + } + + return RIG_OK; +} + +static int ftx1_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int err; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (xit == 0) + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "TC0;"); + } + else if (xit > 0) + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "TC+%04ld;", xit); + } + else + { + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "TC%05ld;", xit); + } + + if (RIG_OK != (err = newcat_set_cmd(rig))) + { + return err; + } + + return RIG_OK; +} + +/* Split functions */ +static int ftx1_get_split(RIG *rig, vfo_t vfo, split_t *split) +{ + int err; + split_t is_split; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (!rig || !split) + { + return -RIG_EINVAL; + } + + err = ftx1_get_tx_split(rig, &is_split); + if (err != RIG_OK) + { + return err; + } + + *split = is_split; + return RIG_OK; +} + +static int ftx1_set_split(RIG *rig, vfo_t vfo, split_t split) +{ + int err; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (split == RIG_SPLIT_ON) + { + err = newcat_set_tx_vfo(rig, RIG_VFO_B); + } + else + { + err = newcat_set_tx_vfo(rig, RIG_VFO_A); + } + + return err; +} + +/* Tuning step functions */ +static int ftx1_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) +{ + // FTX-1 doesn't have a direct tuning step query command + // Return a default value + *ts = 100; + return RIG_OK; +} + +static int ftx1_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) +{ + // FTX-1 doesn't have a direct tuning step set command + // This would need to be implemented via mode-specific commands + return -RIG_ENIMPL; +} + +/* + * FTX-1 specific power control function + * The FTX-1 uses PC command with format: PC[amp][power] where: + * amp: 1 = radio only, 2 = amplifier + * power: 3-digit percentage (005-010 for radio, 005-100 for amp) + */ +int ftx1_set_power_control(RIG *rig, vfo_t vfo, setting_t level, value_t val) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int amp_setting = 2; // Default to amp on (2) + int power_percent; + + ENTERFUNC; + + // Only handle RIG_LEVEL_RFPOWER + if (level != RIG_LEVEL_RFPOWER) + { + // For other levels, use the standard newcat function + return newcat_set_level(rig, vfo, level, val); + } + + // Convert power value (0.0-1.0) to percentage (0-100) + power_percent = (int)(val.f * 100.0f + 0.5f); + + // Ensure power is within valid range for amp (5-100) + if (power_percent < 5) power_percent = 5; + if (power_percent > 100) power_percent = 100; + + // Format: PC[amp][power] where amp=2 for amplifier, power=3 digits + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "PC%d%03d%c", amp_setting, power_percent, cat_term); + + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + + RETURNFUNC(newcat_set_cmd(rig)); +} + +/* + * FTX-1 specific power reading function + * The FTX-1 returns PC command responses in format: PC[amp][power] where: + * amp: 1 = radio only, 2 = amplifier + * power: 3-digit percentage (005-010 for radio, 005-100 for amp) + */ +int ftx1_get_power_control(RIG *rig, vfo_t vfo, setting_t level, value_t *val) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + int amp_setting, power_percent; + char response[16]; + int err; + + ENTERFUNC; + + // Only handle RIG_LEVEL_RFPOWER + if (level != RIG_LEVEL_RFPOWER) + { + // For other levels, use the standard newcat function + return newcat_get_level(rig, vfo, level, val); + } + + // Send PC; command to get current power setting + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "PC%c", cat_term); + + if (RIG_OK != (err = newcat_get_cmd(rig))) + { + RETURNFUNC(err); + } + + // Parse response like "PC2075;" or "PC1004;" + // Extract the numeric part (2075 or 1004) + strncpy(response, priv->ret_data, sizeof(response) - 1); + response[sizeof(response) - 1] = '\0'; + + // Remove "PC" prefix and ";" suffix + if (strlen(response) >= 4 && strncmp(response, "PC", 2) == 0) + { + char *numeric_part = response + 2; // Skip "PC" + char *semicolon = strchr(numeric_part, ';'); + if (semicolon) *semicolon = '\0'; + + if (strlen(numeric_part) == 4) + { + amp_setting = numeric_part[0] - '0'; // First digit (1 or 2) + power_percent = atoi(numeric_part + 1); // Last 3 digits + + // Convert to 0.0-1.0 range + val->f = (float)power_percent / 100.0f; + + rig_debug(RIG_DEBUG_TRACE, "%s: response=%s, amp=%d, power=%d, val=%.3f\n", + __func__, response, amp_setting, power_percent, val->f); + + RETURNFUNC(RIG_OK); + } + } + + // If parsing failed, return error + RETURNFUNC(-RIG_EPROTO); +} + +/* + * FTX-1 specific frequency setting function + * The FTX-1 requires FA command with format: FA[11 digits]; where: + * frequency is formatted as 11 digits with leading zeros + * e.g., FA007200000; for 7.2 MHz + */ +int ftx1_set_freq(RIG *rig, vfo_t vfo, freq_t freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)STATE(rig)->priv; + char c; + int err; + + ENTERFUNC; + + // Determine VFO letter (A or B) + if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) + { + c = 'A'; + } + else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) + { + c = 'B'; + } + else + { + // For other VFOs, default to A + c = 'A'; + } + + // Format: F[VFO][10 digits]; where 10 digits include leading zeros + // Radio returns: FA028100000; (10 digits after FA) + // We should send: FA028200000; (10 digits after FA, not 11) + // The frequency needs to be formatted as 10 digits with proper leading zeros + char freq_str[16]; + SNPRINTF(freq_str, sizeof(freq_str), "%09"PRIll, (int64_t)freq); + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "F%c%s%c", c, freq_str, cat_term); + + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + + RETURNFUNC(newcat_set_cmd(rig)); } \ No newline at end of file diff --git a/rigs/yaesu/ftx1.h b/rigs/yaesu/ftx1.h index 142d93b46..efbfa37dd 100644 --- a/rigs/yaesu/ftx1.h +++ b/rigs/yaesu/ftx1.h @@ -64,11 +64,11 @@ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ RIG_FUNC_RIT|RIG_FUNC_XIT|\ - RIG_FUNC_TUNER|RIG_FUNC_APF) + RIG_FUNC_TUNER|RIG_FUNC_APF|RIG_FUNC_MUTE) #define FTX1_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ - RIG_OP_TO_VFO|RIG_OP_FROM_VFO) + RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_MCL) // Borrowed from FLRig -- Thanks to Dave W1HKJ #define FTX1_RFPOWER_METER_CAL \ @@ -192,4 +192,22 @@ typedef struct char terminator; /* ';' */ } ftx1info; +/* Function prototypes for new commands */ +static int ftx1_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); +static int ftx1_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); +static int ftx1_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); +static int ftx1_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); +static int ftx1_get_split(RIG *rig, vfo_t vfo, split_t *split); +static int ftx1_set_split(RIG *rig, vfo_t vfo, split_t split); +static int ftx1_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); +static int ftx1_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); +static int ftx1_handle_cat_error(RIG *rig, const char *response); + +/* FTX-1 specific power control function */ +int ftx1_set_power_control(RIG *rig, vfo_t vfo, setting_t level, value_t val); +int ftx1_get_power_control(RIG *rig, vfo_t vfo, setting_t level, value_t *val); + +/* FTX-1 specific frequency setting function */ +int ftx1_set_freq(RIG *rig, vfo_t vfo, freq_t freq); + #endif /* _FTX1_H */ \ No newline at end of file diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index ccdc9c605..31ce67d01 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -6,6 +6,7 @@ * (C) Stephane Fillod 2008-2010 * (C) Terry Embry 2008-2010 * (C) David Fannin (kk6df at arrl.net) + * (C) Jeremy Miller KO4SSD 2025 (ko4ssd at ko4ssd.com) * * This shared library provides an API for communicating * via serial interface to any newer Yaesu radio using the @@ -248,23 +249,23 @@ static ncboolean is_ftdx9000Old; static const yaesu_newcat_commands_t valid_commands[] = { /* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D FTDX10 FTDX101MP FT710 FTX1 FT9000Old*/ - {"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE }, {"AC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AM", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AN", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE }, - {"AO", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, - {"BA", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"AO", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"BA", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BC", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BD", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"BM", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"BM", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BP", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BU", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"BY", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"CF", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE }, + {"CF", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE }, {"CH", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"CN", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"CO", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -274,7 +275,7 @@ static const yaesu_newcat_commands_t valid_commands[] = {"DN", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"DP", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }, {"DS", TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }, - {"DT", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"DT", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"ED", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"EK", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE }, {"EM", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE }, @@ -284,7 +285,7 @@ static const yaesu_newcat_commands_t valid_commands[] = {"FA", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"FB", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"FK", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }, - {"FN", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"FN", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"FR", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"FS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE }, {"FT", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -300,7 +301,7 @@ static const yaesu_newcat_commands_t valid_commands[] = {"LK", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"LM", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MA", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"MB", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"MB", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MD", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -308,10 +309,10 @@ static const yaesu_newcat_commands_t valid_commands[] = {"ML", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"MT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"MT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MW", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MX", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"NA", TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"NA", TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"NB", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"NL", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"NR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -323,8 +324,8 @@ static const yaesu_newcat_commands_t valid_commands[] = {"PL", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"PR", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"PS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"QI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"QR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"QI", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"QR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, {"QS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"RA", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"RC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -345,13 +346,13 @@ static const yaesu_newcat_commands_t valid_commands[] = {"SH", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"SM", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"SQ", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"SS", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"SS", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, // ST command has two meanings Step or Split Status // If new rig is added that has ST ensure it means Split // Otherwise modify newcat_(set|get)_split - {"ST", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"ST", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"SV", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"SY", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE}, + {"SY", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE }, {"TS", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"TX", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"UL", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -361,12 +362,12 @@ static const yaesu_newcat_commands_t valid_commands[] = {"VG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"VM", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"VR", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE }, - {"VS", TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE }, - {"VT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE }, - {"VV", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE }, + {"VS", TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"VT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE }, + {"VV", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE }, {"VX", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"XT", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE }, - {"ZI", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE }, + {"ZI", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }, } ; int valid_commands_count = sizeof(valid_commands) / sizeof( diff --git a/rigs/yaesu/yaesu.c b/rigs/yaesu/yaesu.c index ac9923ab6..db9916d2b 100644 --- a/rigs/yaesu/yaesu.c +++ b/rigs/yaesu/yaesu.c @@ -2,6 +2,7 @@ * hamlib - (C) Frank Singleton 2000 (vk...@ix...) * * yaesu.c - (C) Stephane Fillod 2001-2010 + * (C) Jeremy Miller KO4SSD 2025 (ko4ssd at ko4ssd.com) * * This shared library provides an API for communicating * via serial interface to a Yaesu rig diff --git a/rigs/yaesu/yaesu.h b/rigs/yaesu/yaesu.h index 049e2f678..7685d3664 100644 --- a/rigs/yaesu/yaesu.h +++ b/rigs/yaesu/yaesu.h @@ -3,6 +3,7 @@ * * yaesu.h - (C) Frank Singleton 2000 (vk...@ix...) * (C) Stephane Fillod 2001-2010 + * (C) Jeremy Miller KO4SSD 2025 (ko4ssd at ko4ssd.com) * * Common yaesu declarations for hamlib * diff --git a/tests/Makefile.am b/tests/Makefile.am index c120165ff..141c2cab4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,7 +17,7 @@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum bin_PROGRAMS = rigctl rigctld rigmem rigsmtr rigswr rotctl rotctld rigctlcom rigctltcp rigctlsync ampctl ampctld rigtestmcast rigtestmcastrx $(TESTLIBUSB) rigfreqwalk #check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid testsecurity -check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power test2038 +check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power test2038 test_ftx1 RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c dumpstate.c uthash.h rig_tests.c rig_tests.h dumpcaps.h ROTCOMMONSRC = rotctl_parse.c rotctl_parse.h dumpcaps_rot.c uthash.h dumpcaps_rot.h @@ -39,6 +39,8 @@ if HAVE_LIBUSB rigtestlibusb_SOURCES = rigtestlibusb.c endif +test_ftx1_SOURCES = test_ftx1.c + # include generated include files ahead of any in sources rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) -I$(top_builddir)/security $(AM_CPPFLAGS) ----------------------------------------------------------------------- Summary of changes: rigs/yaesu/ftx1.c | 596 ++++++++++++++++++++++++++++++++++++++++++++++------ rigs/yaesu/ftx1.h | 23 +- rigs/yaesu/newcat.c | 33 +-- rigs/yaesu/yaesu.c | 1 + rigs/yaesu/yaesu.h | 1 + 5 files changed, 566 insertions(+), 88 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-02 01:15:43
|
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 989623ec511e6f428aa8998e88df3f69f9e11d79 (commit) via b4eb1bdb12bd475927ec1c05d25a539eae5fa3df (commit) via 0c57ccad264d0f1b54a943795ab47ac199a08f27 (commit) via 094b5e741a63c7310983ee6e77da6d46de73c819 (commit) via 200b2aaecc89cfcfdce416d7f7a9439bd8758c2b (commit) via 6af3b3a94e55d69aad55f4a36818f41dec0aef05 (commit) via 5f78c54bae8502b3ec1e0f1c43643b7857b6e62f (commit) via f8c3d6b614597b8cc24c3b443a9fd1984ebf16a6 (commit) from a9ecd503294b60aed1874cd962c23a9655f3432d (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 989623ec511e6f428aa8998e88df3f69f9e11d79 Merge: b4eb1bdb1 0c57ccad2 Author: Nate Bargmann <n0...@n0...> Date: Fri Aug 1 18:31:38 2025 -0500 Merge GitHub PR #1824 commit b4eb1bdb12bd475927ec1c05d25a539eae5fa3df Author: Nate Bargmann <n0...@n0...> Date: Fri Aug 1 18:25:16 2025 -0500 Quell warning from clang This warning was seen on MacOS and on Debian 12 and 13 using clang: CC kenwood.lo kenwood.c:2293:9: warning: absolute value function 'abs' given an argument of type 'shortfreq_t' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] 2293 | if (abs(rit) > 9999) { RETURNFUNC(-RIG_EINVAL); } | ^ kenwood.c:2293:9: note: use function 'labs' instead 2293 | if (abs(rit) > 9999) { RETURNFUNC(-RIG_EINVAL); } | ^~~ | labs 1 warning generated. Closes issue #1806 on GitHub diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index ccb13c65a..3d67090a7 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2290,7 +2290,7 @@ int kenwood_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t rit) char rdbuf[10]; ENTERFUNC; - if (abs(rit) > 9999) { RETURNFUNC(-RIG_EINVAL); } + if (labs(rit) > 9999) { RETURNFUNC(-RIG_EINVAL); } retval = kenwood_get_rit_new(rig, vfo, &oldrit); if (retval != RIG_OK) { RETURNFUNC(retval); } if (rit == oldrit) // if the new value is the same commit 0c57ccad264d0f1b54a943795ab47ac199a08f27 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Jul 29 23:26:34 2025 +0200 Add missing include file Otherwise it isn't added to the distribution archive created by "make distcheck". diff --git a/simulators/Makefile.am b/simulators/Makefile.am index 2c7cb7f04..b9d58619e 100644 --- a/simulators/Makefile.am +++ b/simulators/Makefile.am @@ -32,7 +32,7 @@ simkenwood_LDFLAGS = $(WINEXELDFLAGS) simyaesu_LDFLAGS = $(WINEXELDFLAGS) simid5100_LDFLAGS = $(WINEXELDFLAGS) -EXTRA_DIST = +EXTRA_DIST = sim.h # Support 'make check' target for simple tests #check_SCRIPTS = commit 094b5e741a63c7310983ee6e77da6d46de73c819 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Jul 29 21:07:54 2025 +0200 Remove unused variables diff --git a/simulators/simic7000.c b/simulators/simic7000.c index 693971b7a..06673d9fa 100644 --- a/simulators/simic7000.c +++ b/simulators/simic7000.c @@ -60,7 +60,7 @@ void dumphex(const unsigned char *buf, int n) int frameGet(int fd, unsigned char *buf) { - int i = 0, n; + int i = 0; memset(buf, 0, BUFSIZE); unsigned char c; diff --git a/simulators/simtmd710.c b/simulators/simtmd710.c index 6cea1853b..9cd53ebc1 100644 --- a/simulators/simtmd710.c +++ b/simulators/simtmd710.c @@ -87,10 +87,7 @@ int openPort(char *comport) // doesn't matter for using pts devices int main(int argc, char *argv[]) { char buf[256]; - char *pbuf; int fd = openPort(argv[1]); - int freqa = 14074000, freqb = 140735000; - int modeA = 0; // , modeB = 0; while (1) { commit 200b2aaecc89cfcfdce416d7f7a9439bd8758c2b Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Jul 29 20:56:29 2025 +0200 Remove unneeded typedef It's only used by Yeasu simulators. diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 2ddcfab85..f52903254 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -38,27 +38,6 @@ int modea = 2; int modeb = 2; int ptt = 0; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { diff --git a/simulators/simelecraftk4.c b/simulators/simelecraftk4.c index 33399b91c..fae2f2cb7 100644 --- a/simulators/simelecraftk4.c +++ b/simulators/simelecraftk4.c @@ -39,27 +39,6 @@ int modeB = 2; int ptt = 0; // int freqa = 14074000, freqb = 14073500; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { diff --git a/simulators/simkenwood.c b/simulators/simkenwood.c index 208d3a464..daa7575f1 100644 --- a/simulators/simkenwood.c +++ b/simulators/simkenwood.c @@ -25,27 +25,6 @@ int filternum = 7; int datamode = 0; int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { diff --git a/simulators/simpowersdr.c b/simulators/simpowersdr.c index b603ae0c3..a3701831c 100644 --- a/simulators/simpowersdr.c +++ b/simulators/simpowersdr.c @@ -26,27 +26,6 @@ int keyspd = 20; double alc = 0; int tx; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { diff --git a/simulators/simtmd700.c b/simulators/simtmd700.c index 2e6876a37..5bb363533 100644 --- a/simulators/simtmd700.c +++ b/simulators/simtmd700.c @@ -25,27 +25,6 @@ char modeB = '0'; int band = 0; int control = 1; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { diff --git a/simulators/simtmd710.c b/simulators/simtmd710.c index f00d5ae3b..6cea1853b 100644 --- a/simulators/simtmd710.c +++ b/simulators/simtmd710.c @@ -25,27 +25,6 @@ int filternum = 7; int datamode = 0; int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; -// ID 0310 == 310, Must drop leading zero -typedef enum nc_rigid_e -{ - NC_RIGID_NONE = 0, - NC_RIGID_FT450 = 241, - NC_RIGID_FT450D = 244, - NC_RIGID_FT950 = 310, - NC_RIGID_FT891 = 135, - NC_RIGID_FT991 = 135, - NC_RIGID_FT2000 = 251, - NC_RIGID_FT2000D = 252, - NC_RIGID_FTDX1200 = 583, - NC_RIGID_FTDX9000D = 101, - NC_RIGID_FTDX9000Contest = 102, - NC_RIGID_FTDX9000MP = 103, - NC_RIGID_FTDX5000 = 362, - NC_RIGID_FTDX3000 = 460, - NC_RIGID_FTDX101D = 681, - NC_RIGID_FTDX101MP = 682 -} nc_rigid_t; - int getmyline(int fd, char *buf) { commit 6af3b3a94e55d69aad55f4a36818f41dec0aef05 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Jul 29 19:33:36 2025 +0200 Remove DECLARE_INITRIG_BACKEND() This code is uneeded. diff --git a/rigs/commradio/commradio.c b/rigs/commradio/commradio.c index c14c20fb8..560419438 100644 --- a/rigs/commradio/commradio.c +++ b/rigs/commradio/commradio.c @@ -226,12 +226,3 @@ DECLARE_INITRIG_BACKEND(commradio) return (RIG_OK); } - -/* - * For some reason, I can't get this to even link without this function. - */ -DECLARE_PROBERIG_BACKEND(commradio) -{ - return (RIG_MODEL_NONE); -} - diff --git a/src/register.c b/src/register.c index 2169e192d..fd6419e57 100644 --- a/src/register.c +++ b/src/register.c @@ -154,7 +154,7 @@ static struct { RIG_MDS, RIG_BACKEND_MDS, RIG_FUNCNAMA(mds) }, { RIG_ANYTONE, RIG_BACKEND_ANYTONE, RIG_FUNCNAMA(anytone) }, { RIG_MOTOROLA, RIG_BACKEND_MOTOROLA, RIG_FUNCNAMA(motorola) }, - { RIG_COMMRADIO, RIG_BACKEND_COMMRADIO, RIG_FUNCNAM(commradio) }, + { RIG_COMMRADIO, RIG_BACKEND_COMMRADIO, RIG_FUNCNAMA(commradio) }, { 0, NULL }, /* end */ }; commit 5f78c54bae8502b3ec1e0f1c43643b7857b6e62f Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Tue Jul 29 19:18:49 2025 +0200 Remove DECLARE_INITRIG_BACKEND() Breaks rig_probe() for rigs probed later (eg. Kenwood). diff --git a/rigs/gomspace/gs100.c b/rigs/gomspace/gs100.c index 647d11d69..86782c90a 100644 --- a/rigs/gomspace/gs100.c +++ b/rigs/gomspace/gs100.c @@ -578,11 +578,4 @@ DECLARE_INITRIG_BACKEND(gomspace) return (RIG_OK); } - -/* Probe RIG backend function */ -DECLARE_PROBERIG_BACKEND(gomspace) -{ - return (RIG_MODEL_GS100); -} - /*----------------------------------------------------------------------------*/ diff --git a/src/register.c b/src/register.c index aa476412e..2169e192d 100644 --- a/src/register.c +++ b/src/register.c @@ -150,7 +150,7 @@ static struct { RIG_BARRETT, RIG_BACKEND_BARRETT, RIG_FUNCNAMA(barrett) }, { RIG_ELAD, RIG_BACKEND_ELAD, RIG_FUNCNAMA(elad) }, { RIG_CODAN, RIG_BACKEND_CODAN, RIG_FUNCNAMA(codan) }, - { RIG_GOMSPACE, RIG_BACKEND_GOMSPACE, RIG_FUNCNAM(gomspace) }, + { RIG_GOMSPACE, RIG_BACKEND_GOMSPACE, RIG_FUNCNAMA(gomspace) }, { RIG_MDS, RIG_BACKEND_MDS, RIG_FUNCNAMA(mds) }, { RIG_ANYTONE, RIG_BACKEND_ANYTONE, RIG_FUNCNAMA(anytone) }, { RIG_MOTOROLA, RIG_BACKEND_MOTOROLA, RIG_FUNCNAMA(motorola) }, commit f8c3d6b614597b8cc24c3b443a9fd1984ebf16a6 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Jul 28 22:01:12 2025 +0200 Fix error messages diff --git a/simulators/simyaesu.c b/simulators/simyaesu.c index fe90cd422..cc57d818f 100644 --- a/simulators/simyaesu.c +++ b/simulators/simyaesu.c @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) n = write(fd, buf, strlen(buf)); //printf("n=%d\n", n); - if (n <= 0) { perror("ID"); } + if (n <= 0) { perror("AI"); } } else if (strcmp(buf, "AI0;") == 0) { @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) SNPRINTF(resp, sizeof(resp), "MD1%c;", modeB); n = write(fd, resp, strlen(resp)); - if (n < 0) { perror("MD0;"); } + if (n < 0) { perror("MD1;"); } } else if (strncmp(buf, "MD1", 3) == 0) { ----------------------------------------------------------------------- Summary of changes: rigs/commradio/commradio.c | 9 --------- rigs/gomspace/gs100.c | 7 ------- rigs/kenwood/kenwood.c | 2 +- simulators/Makefile.am | 2 +- simulators/simelecraft.c | 21 --------------------- simulators/simelecraftk4.c | 21 --------------------- simulators/simic7000.c | 2 +- simulators/simkenwood.c | 21 --------------------- simulators/simpowersdr.c | 21 --------------------- simulators/simtmd700.c | 21 --------------------- simulators/simtmd710.c | 24 ------------------------ simulators/simyaesu.c | 4 ++-- src/register.c | 4 ++-- 13 files changed, 7 insertions(+), 152 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-08-01 13:57:07
|
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 a9ecd503294b60aed1874cd962c23a9655f3432d (commit) via b4f0a3b4b3318564217fc0aea9fa558193d41c69 (commit) via 1c36377480cb13a2ea863a2fd8a045ce2c1ce5f3 (commit) via 72bc62366d1b4f9958a94480a172af773a93f72b (commit) via e172d343816c8514b9892375851bc4bf9ed6f81b (commit) via faad247f06df484a0ad68a4f5e96cce9036761ac (commit) from 48804dc4da2bb5e0035a2600a75f568b6e2280b3 (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 a9ecd503294b60aed1874cd962c23a9655f3432d Author: Nate Bargmann <n0...@n0...> Date: Fri Aug 1 07:42:33 2025 -0500 Sanitize radio model names and manufacturers Reference GitHub issue #1013. diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 822f6dcf2..b378fa360 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -143,9 +143,9 @@ static const struct confparams flrig_ext_parms[] = struct rig_caps flrig_caps = { RIG_MODEL(RIG_MODEL_FLRIG), - .model_name = "", - .mfg_name = "FLRig", - .version = "20250107.0", + .model_name = "FLRig", + .mfg_name = "W1HKJ", + .version = "20250107.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/rigs/dummy/gqrx.c b/rigs/dummy/gqrx.c index 5a9365278..e4ccb49d5 100644 --- a/rigs/dummy/gqrx.c +++ b/rigs/dummy/gqrx.c @@ -32,7 +32,7 @@ #include <cal.h> #include "idx_builtin.h" -#define BACKEND_VER "20250718.0" +#define BACKEND_VER "20250718.1" #define TRUE 1 #define FALSE 0 @@ -932,7 +932,7 @@ struct rig_caps gqrx_caps = { RIG_MODEL(RIG_MODEL_GQRX), .model_name = "GQRX", - .mfg_name = "GQRX", + .mfg_name = "OZ9AEC", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_NEW, diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index f6d2f3f65..f2d117e54 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -1632,9 +1632,9 @@ struct rig_caps powersdr_caps = struct rig_caps thetis_caps = { RIG_MODEL(RIG_MODEL_THETIS), - .model_name = "", - .mfg_name = "Thetis", - .version = "20231222.0", + .model_name = "Thetis", + .mfg_name = "TAPR", + .version = "20231222.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index a54f10853..5f19b55a7 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -455,9 +455,9 @@ struct rig_caps ft1000mp_caps = struct rig_caps ft1000mpmkv_caps = { RIG_MODEL(RIG_MODEL_FT1000MPMKV), - .model_name = "MARK-V FT-1000MP", + .model_name = "FT-1000MP MARK-V", .mfg_name = "Yaesu", - .version = "20241105.0", + .version = "20241105.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -598,9 +598,9 @@ struct rig_caps ft1000mpmkv_caps = struct rig_caps ft1000mpmkvfld_caps = { RIG_MODEL(RIG_MODEL_FT1000MPMKVFLD), - .model_name = "MARK-V Field FT-1000MP", + .model_name = "FT-1000MP MARK-V Field", .mfg_name = "Yaesu", - .version = "20241105.0", + .version = "20241105.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, commit b4f0a3b4b3318564217fc0aea9fa558193d41c69 Author: George Baltz N3GB <Geo...@gm...> Date: Tue Jul 29 14:04:16 2025 -0400 Update NEWS diff --git a/NEWS b/NEWS index 9e32531fa..7cf1895e1 100644 --- a/NEWS +++ b/NEWS @@ -14,11 +14,13 @@ Version 5.x -- future Version 4.7.0 * 2025-12-01 (target) + * Functions rig_get_conf, rot_get_conf, amp_get_conf deprecated; + use *_get_conf2() instead. * Fix handling of unprintable characters in kenwood.c that broke radios such as the TM-D710/TM-V71 that use EOM_TH (\r) as the command terminator. (TNX, Lars Kellogg-Stedman and George Baltz). * Reduce/repair excess output from cppcheck.sh - mostly cosmetic changes (WIP) - Output from `wc -l cppcheck.log` - 4.6.2: 981 now: 673 + Output from `wc -l cppcheck.log` - 4.6.2: 981 now: 642 * Remove dead getopt code. GitHub PR #1709. (TNX Daniele Forsi) * Move rig_cache to separate(calloc) storage. Prepare for other moves. Issue #1420 commit 1c36377480cb13a2ea863a2fd8a045ce2c1ce5f3 Author: George Baltz N3GB <Geo...@gm...> Date: Tue Jul 29 13:10:28 2025 -0400 Still more cppcheck tweaks diff --git a/rigs/icom/icr8500.c b/rigs/icom/icr8500.c index 00b6203d8..9aadadde5 100644 --- a/rigs/icom/icr8500.c +++ b/rigs/icom/icr8500.c @@ -57,7 +57,7 @@ { 238, 60 }, \ } } -int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); +static int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static struct icom_priv_caps icr8500_priv_caps = { @@ -199,7 +199,7 @@ struct rig_caps icr8500_caps = .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; -int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) +static int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { switch (func) { diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index cf6a0167d..0ca3a6bd8 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -674,7 +674,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rigs/yaesu/ft857.c b/rigs/yaesu/ft857.c index 3527b0e50..b195f3322 100644 --- a/rigs/yaesu/ft857.c +++ b/rigs/yaesu/ft857.c @@ -460,7 +460,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rigs/yaesu/ft897.c b/rigs/yaesu/ft897.c index d16a8cef6..7e3f33bbb 100644 --- a/rigs/yaesu/ft897.c +++ b/rigs/yaesu/ft897.c @@ -594,7 +594,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rotators/ts7400/include/peekpoke.c b/rotators/ts7400/include/peekpoke.c index 7ddb08383..544c2a7c2 100644 --- a/rotators/ts7400/include/peekpoke.c +++ b/rotators/ts7400/include/peekpoke.c @@ -4,7 +4,7 @@ #include<stdio.h> #include<fcntl.h> -unsigned int parseBinary(char *str) +unsigned int parseBinary(const char *str) { unsigned int val = 0; diff --git a/rotators/ts7400/include/readADC.c b/rotators/ts7400/include/readADC.c index 8bc9996d2..d91d8ffc7 100644 --- a/rotators/ts7400/include/readADC.c +++ b/rotators/ts7400/include/readADC.c @@ -76,7 +76,7 @@ empty_calibration: return 0; } -void write_calibration(int cal[NUM_CHANNELS][2]) +void write_calibration(const int cal[NUM_CHANNELS][2]) { unsigned short buf[16]; int i, j, k = 0; @@ -107,7 +107,7 @@ static void erase_calibration() } int check_calibration(int cal[NUM_CHANNELS][2], - int stored_cal[NUM_CHANNELS][2], int state) + const int stored_cal[NUM_CHANNELS][2], int state) { double pcnt_diff; int i, j, erase_cal = 0; diff --git a/rotators/ts7400/include/test7400ADC.c b/rotators/ts7400/include/test7400ADC.c index 96201e653..f03954ad5 100644 --- a/rotators/ts7400/include/test7400ADC.c +++ b/rotators/ts7400/include/test7400ADC.c @@ -74,7 +74,7 @@ empty_calibration: return 0; } -void write_calibration(int cal[NUM_CHANNELS][2]) +void write_calibration(const int cal[NUM_CHANNELS][2]) { unsigned short buf[16]; int i, j, k = 0; @@ -105,7 +105,7 @@ static void erase_calibration() } int check_calibration(int cal[NUM_CHANNELS][2], - int stored_cal[NUM_CHANNELS][2], int state) + const int stored_cal[NUM_CHANNELS][2], int state) { double pcnt_diff; int i, j, erase_cal = 0; diff --git a/security/aes.c b/security/aes.c index 9333b8a04..23fb3dac7 100644 --- a/security/aes.c +++ b/security/aes.c @@ -63,7 +63,7 @@ int do_init = 1; #define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) ) #define MUL(x,y) ( ( x && y ) ? pow[(log[x] + log[y]) % 255] : 0 ) -void aes_gen_tables(void) +static void aes_gen_tables(void) { int i; uint8 x, y; diff --git a/security/md5.c b/security/md5.c index 9baf0a048..191cfe664 100644 --- a/security/md5.c +++ b/security/md5.c @@ -1,6 +1,6 @@ #include "md5.h" -char *make_digest(const unsigned char *digest, int len) /* {{{ */ +static char *make_digest(const unsigned char *digest, int len) /* {{{ */ { int md5len = sizeof(char) * (len * 2 + 1); char *md5str = (char *) calloc(1, md5len); @@ -64,7 +64,7 @@ char *make_digest(const unsigned char *digest, int len) /* {{{ */ * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There are no alignment requirements. */ -const void *body(void *ctxBuf, const void *data, size_t size) +static const void *body(void *ctxBuf, const void *data, size_t size) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; const unsigned char *ptr; @@ -174,7 +174,7 @@ const void *body(void *ctxBuf, const void *data, size_t size) return ptr; } -void MD5Init(void *ctxBuf) +static void MD5Init(void *ctxBuf) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; ctx->a = 0x67452301; @@ -186,7 +186,7 @@ void MD5Init(void *ctxBuf) ctx->hi = 0; } -void MD5Update(void *ctxBuf, const void *data, size_t size) +static void MD5Update(void *ctxBuf, const void *data, size_t size) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; MD5_u32plus saved_lo; @@ -229,7 +229,7 @@ void MD5Update(void *ctxBuf, const void *data, size_t size) memcpy(ctx->buffer, data, size); } -void MD5Final(unsigned char *result, void *ctxBuf) +static void MD5Final(unsigned char *result, void *ctxBuf) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; MD5_u32plus used, free; @@ -282,7 +282,7 @@ void MD5Final(unsigned char *result, void *ctxBuf) memset(ctx, 0, sizeof(*ctx)); } -unsigned char *make_hash(const char *arg) +static unsigned char *make_hash(const char *arg) { MD5_CTX context; static unsigned char digest[65]; diff --git a/security/sha256.c b/security/sha256.c index 811cee623..4a010ebb4 100644 --- a/security/sha256.c +++ b/security/sha256.c @@ -53,7 +53,7 @@ void sha256_starts(sha256_context *ctx) ctx->state[7] = 0x5BE0CD19; } -void sha256_process(sha256_context *ctx, const uint8 data[64]) +static void sha256_process(sha256_context *ctx, const uint8 data[64]) { uint32 temp1, temp2, W[64]; uint32 A, B, C, D, E, F, G, H; diff --git a/simulators/simft990.c b/simulators/simft990.c index 06dca62a6..5dbb569ea 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -49,7 +49,7 @@ typedef enum nc_rigid_e NC_RIGID_FTDX101MP = 682 } nc_rigid_t; -void load_dat(const char *filename, unsigned char buf[1492]) +static void load_dat(const char *filename, unsigned char buf[1492]) { FILE *fp = fopen(filename, "r"); char line[4096]; diff --git a/tests/testnet.c b/tests/testnet.c index aff0b9a62..1d1f1f45d 100644 --- a/tests/testnet.c +++ b/tests/testnet.c @@ -106,7 +106,7 @@ static int test_host(char *hoststr, char host[256], char port[6]) } int -main(int argc, char *argv[]) +main(int argc, const char *argv[]) { // IPV4 test_host("127.0.0.1", "127.0.0.1", ""); commit 72bc62366d1b4f9958a94480a172af773a93f72b Author: George Baltz N3GB <Geo...@gm...> Date: Mon Jul 28 19:31:20 2025 -0400 A few more cppcheck messages silenced diff --git a/rigs/anytone/anytone.c b/rigs/anytone/anytone.c index 24b94282b..3945d08f6 100644 --- a/rigs/anytone/anytone.c +++ b/rigs/anytone/anytone.c @@ -46,7 +46,7 @@ // --------------------------------------------------------------------------- #include "anytone.h" -int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, +static int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, unsigned char *reply, int reply_len, int expected_len); DECLARE_INITRIG_BACKEND(anytone) @@ -94,7 +94,7 @@ DECLARE_PROBERIG_BACKEND(anytone) // AnyTone needs a keep-alive to emulate the MIC // Apparently to keep the rig from getting stuck in PTT if mic disconnects -void *anytone_thread(void *vrig) +static void *anytone_thread(void *vrig) { RIG *rig = (RIG *)vrig; hamlib_port_t *rp = RIGPORT(rig); @@ -135,7 +135,7 @@ void *anytone_thread(void *vrig) // --------------------------------------------------------------------------- // anytone_send // --------------------------------------------------------------------------- -int anytone_send(RIG *rig, +static int anytone_send(RIG *rig, unsigned char *cmd, int cmd_len) { int retval = RIG_OK; @@ -154,7 +154,7 @@ int anytone_send(RIG *rig, // --------------------------------------------------------------------------- // anytone_receive // --------------------------------------------------------------------------- -int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) +static int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) { int retval = RIG_OK; hamlib_port_t *rp = RIGPORT(rig); @@ -178,7 +178,7 @@ int anytone_receive(RIG *rig, unsigned char *buf, int buf_len, int expected) // --------------------------------------------------------------------------- // anytone_transaction // --------------------------------------------------------------------------- -int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, +static int anytone_transaction(RIG *rig, unsigned char *cmd, int cmd_len, unsigned char *reply, int reply_len, int expected_len) { int retval = RIG_OK; @@ -293,8 +293,12 @@ int anytone_open(RIG *rig) int anytone_close(RIG *rig) { int retval = RIG_OK; + anytone_priv_data_t *p = STATE(rig)->priv; ENTERFUNC; + + // Tell thread to give up + p->runflag = 0; char *cmd = "+ADATA:00,000\r\n"; anytone_transaction(rig, (unsigned char *)cmd, strlen(cmd), NULL, 0, 0); diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index db1c30a66..0fe7d5f66 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -62,9 +62,9 @@ */ void drake_fix_string(char* inStr) { - char chChkAry[3] = {0x20, 0x0d, 0x0a}; - char* chRepAry[3] = {"<SP>", "<CR>", "<LF>"}; - char* chPos; + const char chChkAry[3] = {0x20, 0x0d, 0x0a}; + const char* chRepAry[3] = {"<SP>", "<CR>", "<LF>"}; + const char* chPos; int newLen; int offset; int i; @@ -108,7 +108,7 @@ void drake_trans_rept(char* hdrStr, char* sentStr, int sentLen, char* recdStr, i { char sent[BUFSZ]; char recd[BUFSZ]; - char nullStr[7] = {'<','N','U','L','L','>',0x00}; + const char nullStr[7] = {'<','N','U','L','L','>',0x00}; int i; //in most cases each string is a buffer, so we need to ensure both command and response @@ -1583,7 +1583,7 @@ DECLARE_PROBERIG_BACKEND(drake) close(port->fd); - if (retval != RIG_OK || id_len <= 0 || id_len >= BUFSZ) + if (retval != RIG_OK || id_len <= 1 || id_len >= BUFSZ) { return RIG_MODEL_NONE; } diff --git a/rotators/androidsensor/androidsensor.cpp b/rotators/androidsensor/androidsensor.cpp index cff44d409..d970647be 100644 --- a/rotators/androidsensor/androidsensor.cpp +++ b/rotators/androidsensor/androidsensor.cpp @@ -143,7 +143,6 @@ const struct rot_caps androidsensor_rot_caps = /* ************************************************************************* */ -// cppcheck-suppress syntaxError DECLARE_INITROT_BACKEND(androidsensor) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); diff --git a/rotators/indi/indi_wrapper.cpp b/rotators/indi/indi_wrapper.cpp index c766c8af2..0ae8f1758 100644 --- a/rotators/indi/indi_wrapper.cpp +++ b/rotators/indi/indi_wrapper.cpp @@ -462,9 +462,7 @@ int RotINDIClient::setPosition(azimuth_t az, elevation_t el) return RIG_OK; } -// cppcheck-suppress unusedFunction void RotINDIClient::removeDevice(INDI::BaseDevice *dp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newProperty(INDI::Property *property) { std::string name(property->getName()); @@ -491,13 +489,9 @@ void RotINDIClient::newProperty(INDI::Property *property) mEl = property->getNumber()->np[1].value; } } -// cppcheck-suppress unusedFunction void RotINDIClient::removeProperty(INDI::Property *property) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newBLOB(IBLOB *bp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newSwitch(ISwitchVectorProperty *svp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newNumber(INumberVectorProperty *nvp) { std::string name(nvp->name); @@ -508,22 +502,16 @@ void RotINDIClient::newNumber(INumberVectorProperty *nvp) mEl = nvp->np[1].value; } } -// cppcheck-suppress unusedFunction void RotINDIClient::newMessage(INDI::BaseDevice *dp, int messageID) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newText(ITextVectorProperty *tvp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newLight(ILightVectorProperty *lvp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::newDevice(INDI::BaseDevice *dp) {} -// cppcheck-suppress unusedFunction void RotINDIClient::serverConnected() { rig_debug(RIG_DEBUG_VERBOSE, "indi: server connected\n"); } -// cppcheck-suppress unusedFunction void RotINDIClient::serverDisconnected(int exit_code) { rig_debug(RIG_DEBUG_VERBOSE, "indi: server disconnected\n"); diff --git a/src/network.c b/src/network.c index 0d37e392f..4c6242712 100644 --- a/src/network.c +++ b/src/network.c @@ -1000,7 +1000,7 @@ static int multicast_publisher_read_packet(multicast_publisher_args return (RIG_OK); } -void *multicast_publisher(void *arg) +static void *multicast_publisher(void *arg) { unsigned char spectrum_data[HAMLIB_MAX_SPECTRUM_DATA]; char snapshot_buffer[HAMLIB_MAX_SNAPSHOT_PACKET_SIZE]; @@ -1257,7 +1257,7 @@ int is_wireless() #include <unistd.h> #include <ifaddrs.h> -int is_networked(char *ipv4, int ipv4_length) +static int is_networked(char *ipv4, int ipv4_length) { struct ifaddrs *interfaces, *iface; char addr_str[INET_ADDRSTRLEN]; @@ -1345,7 +1345,7 @@ int is_wireless() #endif #endif -void *multicast_receiver(void *arg) +static void *multicast_receiver(void *arg) { char data[4096]; char ip4[INET6_ADDRSTRLEN]; diff --git a/tests/rigmatrix.c b/tests/rigmatrix.c index f574143ea..cb2f198da 100644 --- a/tests/rigmatrix.c +++ b/tests/rigmatrix.c @@ -34,7 +34,7 @@ static setting_t bitmap_func, bitmap_level, bitmap_parm, bitmap_vfo_ops; -int create_png_range(const freq_range_t rx_range_list[], +static int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num); int print_caps_sum(struct rig_caps *caps, void *data) @@ -566,7 +566,6 @@ static void draw_range(const freq_range_t range_list[], } } - static int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num) diff --git a/tests/rigmem.c b/tests/rigmem.c index 8b2c9cfb8..84b8eaf68 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -58,7 +58,7 @@ void usage(); void version(); static int set_conf(RIG *rig, char *conf_parms); -int clear_chans(RIG *rig, const char *infilename); +static int clear_chans(RIG *rig, const char *infilename); /* * Reminder: when adding long options, @@ -450,7 +450,7 @@ static int set_conf(RIG *rig, char *conf_parms) /* * Pretty nasty, clears everything you have in rig memory */ -int clear_chans(RIG *rig, const char *infilename) +static int clear_chans(RIG *rig, const char *infilename) { int i, j, ret; channel_t chan; diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 09b27c56f..9c0553e2f 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -246,7 +246,7 @@ struct test_table test_list[] = }; -struct test_table *find_cmd_entry(int cmd) +static struct test_table *find_cmd_entry(int cmd) { int i; @@ -286,7 +286,7 @@ struct mod_lst struct mod_lst *models = NULL; /* Add model information to the hash */ -void hash_add_model(int id, +static void hash_add_model(int id, const char *mfg_name, const char *model_name, const char *version, @@ -309,20 +309,20 @@ void hash_add_model(int id, /* Hash sorting functions */ -int hash_model_id_sort(const struct mod_lst *a, const struct mod_lst *b) +static int hash_model_id_sort(const struct mod_lst *a, const struct mod_lst *b) { return (a->id > b->id); } -void hash_sort_by_model_id() +static void hash_sort_by_model_id() { HASH_SORT(models, hash_model_id_sort); } /* Delete hash */ -void hash_delete_all() +static void hash_delete_all() { struct mod_lst *current_model, *tmp = NULL; @@ -372,7 +372,7 @@ static void rp_getline(const char *s) /* * TODO: use Lex? */ -char parse_arg(const char *arg) +static char parse_arg(const char *arg) { int i; diff --git a/tests/test2038.c b/tests/test2038.c index cb439548c..d7337008c 100644 --- a/tests/test2038.c +++ b/tests/test2038.c @@ -6,7 +6,7 @@ Does fail when compiled with gcc -m32 -o test2038 test2038.c #include <time.h> #include <string.h> -int test2038(void) +static int test2038(void) { time_t x; diff --git a/tests/testnet.c b/tests/testnet.c index ab11f0dd9..aff0b9a62 100644 --- a/tests/testnet.c +++ b/tests/testnet.c @@ -25,7 +25,7 @@ # include <arpa/inet.h> #endif -int rig_network_addr(char *hoststr, char *portstr) +static int rig_network_addr(char *hoststr, char *portstr) { struct in6_addr serveraddr; @@ -73,7 +73,7 @@ int rig_network_addr(char *hoststr, char *portstr) return 0; } -int test_host(char *hoststr, char host[256], char port[6]) +static int test_host(char *hoststr, char host[256], char port[6]) { int status; char host2[256], port2[6]; diff --git a/tests/testtrn.c b/tests/testtrn.c index ce3793acd..2333d8e0e 100644 --- a/tests/testtrn.c +++ b/tests/testtrn.c @@ -14,7 +14,7 @@ #define SERIAL_PORT "/dev/ttyS0" -int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) +static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) { int *count_ptr = (int *) arg; commit e172d343816c8514b9892375851bc4bf9ed6f81b Author: George Baltz N3GB <Geo...@gm...> Date: Mon Jul 28 11:32:34 2025 -0400 Deprecate amp_get_conf(), too diff --git a/c++/ampclass.cc b/c++/ampclass.cc index 72509c6d7..401051aed 100644 --- a/c++/ampclass.cc +++ b/c++/ampclass.cc @@ -74,13 +74,21 @@ void Amplifier::setConf(const char *name, const char *val) CHECK_AMP( amp_set_conf(theAmp, tokenLookup(name), val) ); } -void Amplifier::getConf(hamlib_token_t token, char *val) +HL_DEPRECATED void Amplifier::getConf(hamlib_token_t token, char *val) { - CHECK_AMP( amp_get_conf(theAmp, token, val) ); + CHECK_AMP( amp_get_conf2(theAmp, token, val, 128) ); } -void Amplifier::getConf(const char *name, char *val) +HL_DEPRECATED void Amplifier::getConf(const char *name, char *val) { - CHECK_AMP( amp_get_conf(theAmp, tokenLookup(name), val) ); + CHECK_AMP( amp_get_conf2(theAmp, tokenLookup(name), val, 128) ); +} +void Amplifier::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_AMP( amp_get_conf2(theAmp, token, val, val_len) ); +} +void Amplifier::getConf2(const char *name, char *val, int val_len) +{ + CHECK_AMP( amp_get_conf2(theAmp, tokenLookup(name), val, val_len) ); } hamlib_token_t Amplifier::tokenLookup(const char *name) diff --git a/include/hamlib/ampclass.h b/include/hamlib/ampclass.h index 1bb5876b7..31415c6dd 100644 --- a/include/hamlib/ampclass.h +++ b/include/hamlib/ampclass.h @@ -57,6 +57,8 @@ public: void setConf(const char *name, const char *val); void getConf(hamlib_token_t token, char *val); void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int val_len); + void getConf2(const char *name, char *val, int val_len); hamlib_token_t tokenLookup(const char *name); void setFreq(freq_t freq); diff --git a/include/hamlib/amplifier.h b/include/hamlib/amplifier.h index dd1ab62b4..f49d1d37f 100644 --- a/include/hamlib/amplifier.h +++ b/include/hamlib/amplifier.h @@ -232,7 +232,7 @@ struct amp_caps int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of amp_get_freq(). */ int (*set_conf)(AMP *amp, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of amp_set_conf(). */ - int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of amp_get_conf(). */ + int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of amp_get_conf2(). */ int (*get_conf)(AMP *amp, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of amp_get_conf(). */ /* @@ -310,11 +310,16 @@ extern HAMLIB_EXPORT(int) amp_set_conf HAMLIB_PARAMS((AMP *amp, hamlib_token_t token, const char *val)); -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) amp_get_conf HAMLIB_PARAMS((AMP *amp, hamlib_token_t token, char *val)); extern HAMLIB_EXPORT(int) +amp_get_conf2 HAMLIB_PARAMS((AMP *amp, + hamlib_token_t token, + char *val, + int val_len)); +extern HAMLIB_EXPORT(int) amp_set_powerstat HAMLIB_PARAMS((AMP *amp, powerstat_t status)); extern HAMLIB_EXPORT(int) diff --git a/tests/ampctl_parse.c b/tests/ampctl_parse.c index b54bd0235..e359b20b6 100644 --- a/tests/ampctl_parse.c +++ b/tests/ampctl_parse.c @@ -1501,7 +1501,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data) int i; char buf[128] = ""; - amp_get_conf(amp, cfp->token, buf); + amp_get_conf2(amp, cfp->token, buf, sizeof(buf)); printf("%s: \"%s\"\n" "\tDefault: %s, Value: %s\n", cfp->name, cfp->tooltip, commit faad247f06df484a0ad68a4f5e96cce9036761ac Author: George Baltz N3GB <Geo...@gm...> Date: Mon Jul 28 10:43:10 2025 -0400 Deprecate rot_get_conf() diff --git a/c++/rotclass.cc b/c++/rotclass.cc index daa47b711..ec18813f6 100644 --- a/c++/rotclass.cc +++ b/c++/rotclass.cc @@ -73,13 +73,21 @@ void Rotator::setConf(const char *name, const char *val) CHECK_ROT( rot_set_conf(theRot, tokenLookup(name), val) ); } -void Rotator::getConf(hamlib_token_t token, char *val) +HL_DEPRECATED void Rotator::getConf(hamlib_token_t token, char *val) { - CHECK_ROT( rot_get_conf(theRot, token, val) ); + CHECK_ROT( rot_get_conf2(theRot, token, val, 128) ); } -void Rotator::getConf(const char *name, char *val) +HL_DEPRECATED void Rotator::getConf(const char *name, char *val) { - CHECK_ROT( rot_get_conf(theRot, tokenLookup(name), val) ); + CHECK_ROT( rot_get_conf2(theRot, tokenLookup(name), val, 128) ); +} +void Rotator::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_ROT( rot_get_conf2(theRot, token, val, val_len) ); +} +void Rotator::getConf2(const char *name, char *val, int val_len) +{ + CHECK_ROT( rot_get_conf2(theRot, tokenLookup(name), val, val_len) ); } hamlib_token_t Rotator::tokenLookup(const char *name) diff --git a/include/hamlib/rotator.h b/include/hamlib/rotator.h index a2f8283ee..88de79fd1 100644 --- a/include/hamlib/rotator.h +++ b/include/hamlib/rotator.h @@ -613,7 +613,7 @@ extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, hamlib_token_t token, const char *val)); -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, hamlib_token_t token, char *val)); diff --git a/include/hamlib/rotclass.h b/include/hamlib/rotclass.h index 219e3a92f..5526f984c 100644 --- a/include/hamlib/rotclass.h +++ b/include/hamlib/rotclass.h @@ -55,6 +55,8 @@ public: void setConf(const char *name, const char *val); void getConf(hamlib_token_t token, char *val); void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int len); + void getConf2(const char *name, char *val, int len); hamlib_token_t tokenLookup(const char *name); void setPosition(azimuth_t az, elevation_t el); diff --git a/rotators/grbltrk/grbltrk.c b/rotators/grbltrk/grbltrk.c index a1f024f78..b207f6a64 100644 --- a/rotators/grbltrk/grbltrk.c +++ b/rotators/grbltrk/grbltrk.c @@ -488,7 +488,7 @@ grbltrk_rot_open(ROT *rot) } else if (rot->caps->rot_model == ROT_MODEL_GRBLTRK_NET) { - rot_get_conf(rot, TOK_PATHNAME, host); + rot_get_conf2(rot, TOK_PATHNAME, host, sizeof(host)); rot_debug(RIG_DEBUG_ERR, "%s:%d ctrl via net, host [%s]\n", __func__, __LINE__, host); grbl_net_open(rot, 23); diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index ec4ed85b6..09b27c56f 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -1698,7 +1698,7 @@ declare_proto_rot(get_conf) else { char value[4096]; - ret = rot_get_conf(rot, rot_token_lookup(rot, arg1), value); + ret = rot_get_conf2(rot, rot_token_lookup(rot, arg1), value, sizeof(value)); if (ret != RIG_OK) { @@ -2917,7 +2917,7 @@ int print_conf_list2(const struct confparams *cfp, rig_ptr_t data, FILE *fout) ROT *rot = (ROT *) data; char buf[128] = ""; - rot_get_conf(rot, cfp->token, buf); + rot_get_conf2(rot, cfp->token, buf, sizeof(buf)); fprintf(fout, "%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, ----------------------------------------------------------------------- Summary of changes: NEWS | 4 +++- c++/ampclass.cc | 16 ++++++++++++---- c++/rotclass.cc | 16 ++++++++++++---- include/hamlib/ampclass.h | 2 ++ include/hamlib/amplifier.h | 9 +++++++-- include/hamlib/rotator.h | 2 +- include/hamlib/rotclass.h | 2 ++ rigs/anytone/anytone.c | 14 +++++++++----- rigs/drake/drake.c | 10 +++++----- rigs/dummy/flrig.c | 6 +++--- rigs/dummy/gqrx.c | 4 ++-- rigs/icom/icr8500.c | 4 ++-- rigs/kenwood/flex6xxx.c | 6 +++--- rigs/yaesu/ft1000mp.c | 8 ++++---- rigs/yaesu/ft817.c | 2 +- rigs/yaesu/ft857.c | 2 +- rigs/yaesu/ft897.c | 2 +- rotators/androidsensor/androidsensor.cpp | 1 - rotators/grbltrk/grbltrk.c | 2 +- rotators/indi/indi_wrapper.cpp | 12 ------------ rotators/ts7400/include/peekpoke.c | 2 +- rotators/ts7400/include/readADC.c | 4 ++-- rotators/ts7400/include/test7400ADC.c | 4 ++-- security/aes.c | 2 +- security/md5.c | 12 ++++++------ security/sha256.c | 2 +- simulators/simft990.c | 2 +- src/network.c | 6 +++--- tests/ampctl_parse.c | 2 +- tests/rigmatrix.c | 3 +-- tests/rigmem.c | 4 ++-- tests/rotctl_parse.c | 16 ++++++++-------- tests/test2038.c | 2 +- tests/testnet.c | 6 +++--- tests/testtrn.c | 2 +- 35 files changed, 105 insertions(+), 88 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-07-28 00:04:56
|
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 48804dc4da2bb5e0035a2600a75f568b6e2280b3 (commit) via c0ec84ca4b8ce135af5d2c859ada50ce9e3e11eb (commit) via ed138699c343b3a0049a4d1bea84c2db35ef3d53 (commit) from 66acf19efedb17ad22a6734dbbed5b6b4466ba85 (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 48804dc4da2bb5e0035a2600a75f568b6e2280b3 Merge: 66acf19ef c0ec84ca4 Author: Nate Bargmann <n0...@n0...> Date: Sun Jul 27 18:45:52 2025 -0500 Merge GitHub PR #1819 commit c0ec84ca4b8ce135af5d2c859ada50ce9e3e11eb Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 27 20:13:07 2025 +0200 Add default values for make (dist)check diff --git a/bindings/python/conftest.py b/bindings/python/conftest.py index 4f5510778..a91d7684d 100644 --- a/bindings/python/conftest.py +++ b/bindings/python/conftest.py @@ -20,6 +20,12 @@ def pytest_addoption(parser): metavar='ID', help='select rotator model number') parser.addoption('--rot-file', default=None, metavar='DEVICE', help='set device of the rotator to operate on') + else: + # fallbacks for invocations through a Makefile + parser.addoption('--model', type=int, default=1) + parser.addoption('--amp-file', default=None) + parser.addoption('--rig-file', default=None) + parser.addoption('--rot-file', default=None) parser.addoption('--serial-speed', type=int, default=0, metavar='BAUD', help='set serial speed of the serial port') parser.addoption('--hamlib-verbose', action='count', default=0, commit ed138699c343b3a0049a4d1bea84c2db35ef3d53 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 27 19:53:45 2025 +0200 Add missing files for make distcheck diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 41b44a92a..651a7328c 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -22,11 +22,15 @@ SWGDEP = \ EXTRA_DIST = $(SWGFILES) \ Makefile.PL perltest.pl tcltest.tcl.in \ + python/conftest.py \ python/generate_tests.py \ python/test_Hamlib_Amp_class.py \ - python/test_Hamlib_class.py \ python/test_Hamlib_Rig_class.py \ python/test_Hamlib_Rot_class.py \ + python/test_Hamlib_class.py \ + python/test_amp.py \ + python/test_rig.py \ + python/test_rot.py \ python/test_startup.py \ luatest.lua README.python ----------------------------------------------------------------------- Summary of changes: bindings/Makefile.am | 6 +++++- bindings/python/conftest.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-07-27 23:42:57
|
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 66acf19efedb17ad22a6734dbbed5b6b4466ba85 (commit) via 20eeb96787a1e2dd67e158b52337f64ab47517e7 (commit) via 6c372f981f08dd571f5fc47197fcce9fd076f007 (commit) via a7c8c3fa9ebf0aa1c2b6ef4b6c4b20ba2ded4014 (commit) from 53b7cef53797338f26e72e6646fdbf4ce170c2f6 (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 66acf19efedb17ad22a6734dbbed5b6b4466ba85 Merge: 53b7cef53 20eeb9678 Author: Nate Bargmann <n0...@n0...> Date: Sun Jul 27 18:01:00 2025 -0500 Merge GitHub PR #1818 commit 20eeb96787a1e2dd67e158b52337f64ab47517e7 Author: George Baltz N3GB <Geo...@gm...> Date: Sun Jul 27 11:31:18 2025 -0400 Deprecate rig_get_conf() Define macro to set attribute, if compiler is capable Add macro to rig_get_conf(), Rig::getConf() declarations Fix internal uses of rig_get_conf() diff --git a/c++/rigclass.cc b/c++/rigclass.cc index 218058ea0..db473e2f1 100644 --- a/c++/rigclass.cc +++ b/c++/rigclass.cc @@ -87,11 +87,19 @@ void Rig::setConf(const char *name, const char *val) void Rig::getConf(hamlib_token_t token, char *val) { - CHECK_RIG( rig_get_conf(theRig, token, val) ); + CHECK_RIG( rig_get_conf2(theRig, token, val, 128) ); } void Rig::getConf(const char *name, char *val) { - CHECK_RIG( rig_get_conf(theRig, tokenLookup(name), val) ); + CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, 128) ); +} +void Rig::getConf2(hamlib_token_t token, char *val, int val_len) +{ + CHECK_RIG( rig_get_conf2(theRig, token, val, val_len) ); +} +void Rig::getConf2(const char *name, char *val, int val_len) +{ + CHECK_RIG( rig_get_conf2(theRig, tokenLookup(name), val, val_len) ); } hamlib_token_t Rig::tokenLookup(const char *name) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 3441a162b..7c79443a7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -86,10 +86,18 @@ #if __has_c_attribute(fallthrough) #define HL_FALLTHROUGH [[fallthrough]]; #else -/* Fall back */ +/* Fall back to nothing */ #define HL_FALLTHROUGH #endif +// Macro to mark function or variable as deprecated/obsolete +#if __has_c_attribute(deprecated) +#define HL_DEPRECATED [[deprecated]] +#else +// Make it vanish +#define HL_DEPRECATED +#endif + /** * \addtogroup rig * @{ @@ -2959,7 +2967,7 @@ rig_set_conf HAMLIB_PARAMS((RIG *rig, hamlib_token_t token, const char *val)); // deprecating rig_get_conf -extern HAMLIB_EXPORT(int) +HL_DEPRECATED extern HAMLIB_EXPORT(int) rig_get_conf HAMLIB_PARAMS((RIG *rig, hamlib_token_t token, char *val)); diff --git a/include/hamlib/rigclass.h b/include/hamlib/rigclass.h index 23b4738fd..6a0e428ff 100644 --- a/include/hamlib/rigclass.h +++ b/include/hamlib/rigclass.h @@ -56,8 +56,10 @@ public: void setConf(hamlib_token_t token, const char *val); void setConf(const char *name, const char *val); - void getConf(hamlib_token_t token, char *val); - void getConf(const char *name, char *val); + HL_DEPRECATED void getConf(hamlib_token_t token, char *val); + HL_DEPRECATED void getConf(const char *name, char *val); + void getConf2(hamlib_token_t token, char *val, int val_len); + void getConf2(const char *name, char *val, int val_len); hamlib_token_t tokenLookup(const char *name); void setFreq(freq_t freq, vfo_t vfo = RIG_VFO_CURR); diff --git a/rigs/flexradio/dttsp.c b/rigs/flexradio/dttsp.c index 2a24b70f1..24ca388fb 100644 --- a/rigs/flexradio/dttsp.c +++ b/rigs/flexradio/dttsp.c @@ -462,7 +462,7 @@ static int dttsp_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_le /* if it's not for the dttsp backend, maybe it's for the tuner */ if (priv->tuner) { - return rig_get_conf(priv->tuner, token, val); + return rig_get_conf2(priv->tuner, token, val, val_len); } else { diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index d650a2b9b..4db850e87 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2014,7 +2014,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data) int i; char buf[128] = ""; - rig_get_conf(rig, cfp->token, buf); + rig_get_conf2(rig, cfp->token, buf, sizeof(buf)); printf("%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, @@ -2078,7 +2078,7 @@ int print_conf_list2(const struct confparams *cfp, rig_ptr_t data) RIG *rig = (RIG *) data; char buf[128] = ""; - rig_get_conf(rig, cfp->token, buf); + rig_get_conf2(rig, cfp->token, buf, sizeof(buf)); fprintf(stdout, "%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, @@ -6025,7 +6025,7 @@ declare_proto_rig(get_conf) else { char value[4096]; // no max value known -- should we limit it? - ret = rig_get_conf(rig, mytoken, value); + ret = rig_get_conf2(rig, mytoken, value, sizeof(value)); if (ret != RIG_OK) { commit 6c372f981f08dd571f5fc47197fcce9fd076f007 Author: George Baltz N3GB <Geo...@gm...> Date: Sat Jul 26 21:56:39 2025 -0400 Distinguish wanted from unwanted fall through instances Compile with -Wimplicit-fallthrough; analyze the results. Define macro to mark valid fall through constructs. Mark all of the good ones, and fix the bad. Not available with all compilers - for those without the feature this commit does nothing. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index c5df12297..3441a162b 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -73,6 +73,23 @@ #include <hamlib/riglist.h> //#include <hamlib/config.h> +/* Define macros for handling attributes, if the compiler implements them + * Should be available in c23-capable compilers, or c++11 ones + */ +// From ISO/IEC 9899:202y n3301 working draft +#ifndef __has_c_attribute +#define __has_c_attribute(x) 0 +#endif + +// Macro to mark fallthrough as OK +// Squelch warnings if -Wimplicit-fallthrough added to CFLAGS +#if __has_c_attribute(fallthrough) +#define HL_FALLTHROUGH [[fallthrough]]; +#else +/* Fall back */ +#define HL_FALLTHROUGH +#endif + /** * \addtogroup rig * @{ diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 346dca79e..e1a00ea67 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -3393,6 +3393,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo '%s'\n", __func__, rig_strvfo(rs->current_vfo)); } + HL_FALLTHROUGH // Fall into outer default default: if (priv->x25cmdfails == 0 || priv_caps->x25x26_always) @@ -9111,12 +9112,14 @@ static int icom_parse_spectrum_frame(RIG *rig, size_t length, case SCOPE_MODE_FIXED: cache->spectrum_mode = RIG_SPECTRUM_MODE_FIXED; + HL_FALLTHROUGH case SCOPE_MODE_SCROLL_C: if (cache->spectrum_mode == RIG_SPECTRUM_MODE_NONE) { cache->spectrum_mode = RIG_SPECTRUM_MODE_CENTER_SCROLL; } + HL_FALLTHROUGH case SCOPE_MODE_SCROLL_F: if (cache->spectrum_mode == RIG_SPECTRUM_MODE_NONE) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 435bedf4e..ccb13c65a 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -5600,7 +5600,7 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) SNPRINTF(morsebuf, sizeof morsebuf, "KY2%s", m2); break; } - /* FALL THROUGH */ + HL_FALLTHROUGH default: /* the command must consist of 28 bytes 0x20 padded */ diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index 75af845c1..a166070d3 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -1298,6 +1298,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_CWN: *width = rig_passband_narrow(rig, RIG_MODE_CW); + HL_FALLTHROUGH case MD_CW: *mode = RIG_MODE_CW; @@ -1305,6 +1306,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_CWNR: *width = rig_passband_narrow(rig, RIG_MODE_CW); + HL_FALLTHROUGH case MD_CWR: *mode = RIG_MODE_CWR; @@ -1312,6 +1314,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_AMN: *width = rig_passband_narrow(rig, RIG_MODE_AM); + HL_FALLTHROUGH case MD_AM: *mode = RIG_MODE_AM; @@ -1319,6 +1322,7 @@ static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, case MD_FMN: *width = rig_passband_narrow(rig, RIG_MODE_FM); + HL_FALLTHROUGH case MD_FM: *mode = RIG_MODE_FM; diff --git a/rigs/yaesu/ft920.c b/rigs/yaesu/ft920.c index 41d58b350..bc525594e 100644 --- a/rigs/yaesu/ft920.c +++ b/rigs/yaesu/ft920.c @@ -794,6 +794,7 @@ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { return err; } + HL_FALLTHROUGH case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: @@ -965,6 +966,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { return err; } + HL_FALLTHROUGH case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index fe88b7880..ccdc9c605 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -4414,9 +4414,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) case RIG_METER_VDD: SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), format, 5); break; + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown val.i=%d\n", __func__, val.i); - - default: RETURNFUNC(-RIG_EINVAL); + RETURNFUNC(-RIG_EINVAL); } break; diff --git a/src/iofunc.c b/src/iofunc.c index 97d3ca135..99e75414f 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -408,8 +408,8 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type) default: rig_debug(RIG_DEBUG_ERR, "%s(): Unknown port type %d\n", __func__, port_type); + HL_FALLTHROUGH - /* fall through */ case RIG_PORT_DEVICE: ret = close(p->fd); } diff --git a/src/rig.c b/src/rig.c index dae5add5c..63019fdf8 100644 --- a/src/rig.c +++ b/src/rig.c @@ -3611,8 +3611,8 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { ptt = RIG_PTT_ON; } + HL_FALLTHROUGH - /* fall through */ case RIG_PTT_RIG_MICDATA: if (caps->set_ptt == NULL) { diff --git a/tests/uthash.h b/tests/uthash.h index 77a11c30e..6724600b1 100644 --- a/tests/uthash.h +++ b/tests/uthash.h @@ -412,15 +412,25 @@ do { hashv += keylen; \ switch ( _hj_k ) { \ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); \ + HL_FALLTHROUGH \ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); \ + HL_FALLTHROUGH \ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); \ + HL_FALLTHROUGH \ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); \ + HL_FALLTHROUGH \ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); \ + HL_FALLTHROUGH \ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); \ + HL_FALLTHROUGH \ case 5: _hj_j += _hj_key[4]; \ + HL_FALLTHROUGH \ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); \ + HL_FALLTHROUGH \ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); \ + HL_FALLTHROUGH \ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); \ + HL_FALLTHROUGH \ case 1: _hj_i += _hj_key[0]; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ @@ -547,7 +557,9 @@ do { \ uint32_t _mur_k1=0; \ switch((keylen) & 3) { \ case 3: _mur_k1 ^= _mur_tail[2] << 16; \ + HL_FALLTHROUGH \ case 2: _mur_k1 ^= _mur_tail[1] << 8; \ + HL_FALLTHROUGH \ case 1: _mur_k1 ^= _mur_tail[0]; \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ commit a7c8c3fa9ebf0aa1c2b6ef4b6c4b20ba2ded4014 Author: George Baltz N3GB <Geo...@gm...> Date: Sat Jul 26 14:04:25 2025 -0400 Fix another unwanted fall through diff --git a/tests/rotctld.c b/tests/rotctld.c index f5a08d749..c3dedb52f 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -246,6 +246,7 @@ int main(int argc, char *argv[]) case 'O': el_offset = atof(optarg); + break; case 'v': verbose++; ----------------------------------------------------------------------- Summary of changes: c++/rigclass.cc | 12 ++++++++++-- include/hamlib/rig.h | 27 ++++++++++++++++++++++++++- include/hamlib/rigclass.h | 6 ++++-- rigs/flexradio/dttsp.c | 2 +- rigs/icom/icom.c | 3 +++ rigs/kenwood/kenwood.c | 2 +- rigs/yaesu/ft847.c | 4 ++++ rigs/yaesu/ft920.c | 2 ++ rigs/yaesu/newcat.c | 4 ++-- src/iofunc.c | 2 +- src/rig.c | 2 +- tests/rigctl_parse.c | 6 +++--- tests/rotctld.c | 1 + tests/uthash.h | 12 ++++++++++++ 14 files changed, 71 insertions(+), 14 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-07-27 23:00:20
|
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 53b7cef53797338f26e72e6646fdbf4ce170c2f6 (commit) via 464076f193f64f9ee9c52705185790ce51536a7e (commit) via 4c28ba0bde5d7d068660c7f3632f7846c0bdd6d3 (commit) via 95bd993dd76b731945f7a5ec9d46f0a2a236dd42 (commit) from 96d5abab4750fdd7c9a08ef3abbab14955923dfd (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 53b7cef53797338f26e72e6646fdbf4ce170c2f6 Merge: 96d5abab4 464076f19 Author: Nate Bargmann <n0...@n0...> Date: Sun Jul 27 17:10:45 2025 -0500 Merge GitHub PR #1817 commit 464076f193f64f9ee9c52705185790ce51536a7e Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 27 16:23:09 2025 +0200 Disable Tcl bindings for macOS when running make distcheck diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 44db443ad..77953f3d9 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -94,4 +94,4 @@ jobs: run: make distcheck V=0 --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS="${{ matrix.configure_args }} --without-perl-binding" - name: make distcheck on macOS if: runner.os == 'macOS' - run: make distcheck V=0 --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS="${{ matrix.configure_args }} --without-perl-binding --without-lua-binding PYTHON=/opt/homebrew/bin/python3" + run: make distcheck V=0 --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS="${{ matrix.configure_args }} --without-perl-binding --without-lua-binding --without-tcl-binding PYTHON=/opt/homebrew/bin/python3" commit 4c28ba0bde5d7d068660c7f3632f7846c0bdd6d3 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 27 15:56:51 2025 +0200 Run the TCL tests using the library from build diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 9d66c1df9..5f4c84729 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -177,7 +177,7 @@ hamlibtcl_wrap.c: $(SWGDEP) -I$(top_srcdir)/bindings \ -o $@ $$(test -f hamlib.swg || echo '$(srcdir)/')hamlib.swg -do_subst = sed -e 's,[@]tcldir[@],$(tcldir),g' +do_subst = sed -e 's,[@]tcldir[@],$(tcldir),g' -e 's,[@]builddir[@],$(builddir),g' tcltest.tcl: tcltest.tcl.in Makefile $(AM_V_GEN)$(do_subst) < $(srcdir)/tcltest.tcl.in > tcltest.tcl diff --git a/bindings/tcltest.tcl.in b/bindings/tcltest.tcl.in index 51e9c0b70..1996224c4 100644 --- a/bindings/tcltest.tcl.in +++ b/bindings/tcltest.tcl.in @@ -6,7 +6,8 @@ exec tclsh "$0" "$@" lappend ::auto_path @tcldir@ ## Brute force loading -#load "@tcldir@/hamlibtcl.so" Hamlib +# load "@tcldir@/hamlibtcl.so" Hamlib ; # from the installation directory +load "@builddir@/.libs/hamlibtcl.so" Hamlib ; # from the build directory ## Preferred package loading package require hamlib commit 95bd993dd76b731945f7a5ec9d46f0a2a236dd42 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 27 15:10:10 2025 +0200 Do not clobber the return value of failed tests While printing an error message is nice, it prevented "make check" to fail; and the other two binding didn't print any. diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 41b44a92a..9d66c1df9 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -186,8 +186,7 @@ all-tcl: pkgIndex.tcl $(tcl_ltlib) tcltest.tcl check-tcl: all-tcl $(AM_V_at)cp $(builddir)/pkgIndex.tcl $(builddir)/.libs - $(AM_V_at)TCLLIBPATH=$(builddir)/.libs tclsh $(builddir)/tcltest.tcl \ - || echo "Tcl test failed" 1>&2 + $(AM_V_at)TCLLIBPATH=$(builddir)/.libs tclsh $(builddir)/tcltest.tcl $(AM_V_at)rm -f $(builddir)/.libs/pkgIndex.tcl install-tcl: @@ -220,8 +219,7 @@ Hamliblua_la_LTLIBRARIES = $(luaexec_ltlib) all-lua: $(luaexec_ltlib) check-lua: all-lua - $(AM_V_at)LUA_CPATH="$(abs_builddir)/.libs/?.so" $(LUA) $(srcdir)/luatest.lua \ - || echo "Lua test failed" 1>&2 + $(AM_V_at)LUA_CPATH="$(abs_builddir)/.libs/?.so" $(LUA) $(srcdir)/luatest.lua Hamlib.lua: hamliblua_wrap.c ----------------------------------------------------------------------- Summary of changes: .github/workflows/c-cpp.yml | 2 +- bindings/Makefile.am | 8 +++----- bindings/tcltest.tcl.in | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-07-27 22:09:41
|
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 96d5abab4750fdd7c9a08ef3abbab14955923dfd (commit) via eb5a838f3051f2d8a05557192586c4720575153c (commit) via fae77e4c0273020844ea32abd7d64378820943d6 (commit) via 389155fcdf94973903d007c0599576cb2b9e47be (commit) via c4ee44b1353f6f9a802b6291e5628f00eee157d7 (commit) via 62e42eb4b3269d2f30ba37f4d3584cc064028ddf (commit) via 5c06c7b942151177f742e0da15bcd4b3b67b8eeb (commit) via e54c38c522559349eb8d21d4fbeed98243666f5f (commit) via 9574e761ff2fbc7b3bf1a758639837b0dd3cc6c0 (commit) via e83d72608b61261d99f4b9c86fa755f0bb051a55 (commit) via 36576f8e40e701a651e85c567201f9758f20545a (commit) via 43193681b02938b06987224a2c572495638467d2 (commit) via 9626c8b90dc4d76b3071e65dfb0372f4caba342c (commit) via 5319f8b31b70da31144ed46ece9523b7f7eace9d (commit) via a617863a238af7eab33e4d10a75dc3149cfff4e2 (commit) via 2199ff2bde6b2d7dff5a7bd9b5880ea2cacced17 (commit) via 3240d2f8d3d3a366c56d05249605a9a06123635b (commit) via 92fb82f2204f45673374c9e40177f3b824d34180 (commit) via ef2d2236b5267a2eaf395cb6ffdbd3627e40b4d2 (commit) via 292da125661bd647c0334f7673a2f37e05f46175 (commit) via 160c941e9e2018878bd876cd46ba78cb9add7e00 (commit) via 25aae7d8e2ebc06c7c7094c0d42ceea8bc3d2c82 (commit) via 90c56f3e1fc6d7d86d758076011408832197ca65 (commit) via 01bc71ab8a2d24545f6d48ff90bd9c5c5747011f (commit) via 2b1428fd3e41cc7830ded0d057fdac0a27d4c5b3 (commit) via 8901b210ee0a9ff399904f1516350e65e2ed6de0 (commit) via 13c2413bbaf3fb99c3448771b868ea3c5c032282 (commit) via 25a2a4447f01eaaec83f5a95903f6e300ba0534b (commit) from 0d543f9483f348c1f6bc8ff0375034590cf9da85 (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 96d5abab4750fdd7c9a08ef3abbab14955923dfd Merge: eb5a838f3 0d543f948 Author: dforsi <iu...@gm...> Date: Sun Jul 27 18:22:26 2025 +0200 Merge branch 'master' into fix/pytest commit eb5a838f3051f2d8a05557192586c4720575153c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 13 17:19:17 2025 +0200 Check datatype before actual value diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 8c8c0c672..597578289 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -58,8 +58,8 @@ class TestClass: assert rig.get_freq() == 5700000000.0 frequency = 5700000000.5 assert rig.set_freq(Hamlib.RIG_VFO_CURR, frequency) is None - assert rig.get_freq(Hamlib.RIG_VFO_CURR) == 5700000000.5 assert isinstance(rig.get_freq(Hamlib.RIG_VFO_CURR), float) + assert rig.get_freq(Hamlib.RIG_VFO_CURR) == 5700000000.5 # VFO commit fae77e4c0273020844ea32abd7d64378820943d6 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 13 17:13:37 2025 +0200 Do the tests for set_vfo() and get_vfo() when the rig is open Hamlib returns -RIG_EINVAL if the rig is not open. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 276841f6c..8c8c0c672 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -63,6 +63,8 @@ class TestClass: # VFO + assert rig.set_vfo(Hamlib.RIG_VFO_A) is None + assert rig.get_vfo() == Hamlib.RIG_VFO_A assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A) is None assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A] assert rig.set_split_vfo(Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B) is None @@ -163,7 +165,6 @@ class TestClass: assert isinstance(rig.get_trn(), int) # deprecated assert isinstance(rig.get_ts(), int) assert isinstance(rig.get_ts(Hamlib.RIG_VFO_CURR), int) - assert isinstance(rig.get_vfo(), int) assert len(rig.get_vfo_info()) == 5 assert len(rig.get_vfo_info(Hamlib.RIG_VFO_CURR)) == 5 # assert rig_has_get_func(0) FIXME not defined @@ -226,7 +227,6 @@ class TestClass: assert rig.set_split_vfo(0, 0, 0) is None assert rig.set_trn(0) is None # deprecated assert rig.set_ts(0, 0) is None - assert rig.set_vfo(0) is None assert rig.set_vfo_opt(0) is None assert rig.token_lookup("") is None assert rig.vfo_op(0, 0) is None commit 389155fcdf94973903d007c0599576cb2b9e47be Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 13 17:04:55 2025 +0200 Do the tests for RIT and XIT when the rig is open Hamlib returns -RIG_EINVAL if the rig is not open. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index d0560b808..276841f6c 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -71,6 +71,15 @@ class TestClass: assert rig.get_split_vfo() == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] + # RIT and XIT + + assert rig.set_rit(Hamlib.RIG_VFO_CURR, 100) is None + assert rig.get_rit() == 100 + assert rig.get_rit(Hamlib.RIG_VFO_CURR) == 100 + assert rig.set_xit(Hamlib.RIG_VFO_CURR, 200) is None + assert rig.get_xit() == 200 + assert rig.get_xit(Hamlib.RIG_VFO_CURR) == 200 + # Antenna # FIXME should use a RIG_ANT_* constant but they aren't available in the bindings @@ -143,8 +152,6 @@ class TestClass: assert isinstance(rig.get_powerstat(), int) assert isinstance(rig.get_ptt(), int) assert isinstance(rig.get_ptt(Hamlib.RIG_VFO_CURR), int) - assert isinstance(rig.get_rit(), int) - assert isinstance(rig.get_rit(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_rptr_offs(), int) assert isinstance(rig.get_rptr_offs(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_rptr_shift(), int) @@ -159,8 +166,6 @@ class TestClass: assert isinstance(rig.get_vfo(), int) assert len(rig.get_vfo_info()) == 5 assert len(rig.get_vfo_info(Hamlib.RIG_VFO_CURR)) == 5 - assert isinstance(rig.get_xit(), int) - assert isinstance(rig.get_xit(Hamlib.RIG_VFO_CURR), int) # assert rig_has_get_func(0) FIXME not defined assert rig.has_get_level(0) is None # FIXME should return setting_t # assert rig_has_get_parm(0) FIXME not defined @@ -208,7 +213,6 @@ class TestClass: assert rig.set_parm(0, 0) is None assert rig.set_powerstat(0) is None assert rig.set_ptt(0, 0) is None - assert rig.set_rit(0, 0) is None assert rig.set_rptr_offs(0, 0) is None assert rig.set_rptr_shift(0, 0) is None assert rig.set_split_freq(0, 0) is None @@ -224,7 +228,6 @@ class TestClass: assert rig.set_ts(0, 0) is None assert rig.set_vfo(0) is None assert rig.set_vfo_opt(0) is None - assert rig.set_xit(0, 0) is None assert rig.token_lookup("") is None assert rig.vfo_op(0, 0) is None commit c4ee44b1353f6f9a802b6291e5628f00eee157d7 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jul 13 16:51:29 2025 +0200 Swap arguments of Rig.set_dcs_sql() and make both mandatory Makes the signature of Rig.set_dcs_sql() similar to those of set_ctcss_sql() set_ctcss_tone() set_dcs_code() diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 2b86372f0..d0560b808 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -96,9 +96,8 @@ class TestClass: assert rig.set_dcs_code(Hamlib.RIG_VFO_CURR, 125) is None assert rig.get_dcs_code() == 125 assert rig.get_dcs_code(Hamlib.RIG_VFO_CURR) == 125 - assert rig.set_dcs_sql(311) is None - assert rig.get_dcs_sql() == 311 - assert rig.set_dcs_sql(134, Hamlib.RIG_VFO_CURR) is None + assert rig.set_dcs_sql(Hamlib.RIG_VFO_CURR, 134) is None + assert rig.get_dcs_sql() == 134 assert rig.get_dcs_sql(Hamlib.RIG_VFO_CURR) == 134 assert rig.close() is None diff --git a/bindings/rig.swg b/bindings/rig.swg index f2ee04e53..2245d0155 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -372,7 +372,7 @@ typedef channel_t * const_channel_t_p; METHOD3(set_ctcss_tone, tone_t) METHOD3(set_dcs_code, tone_t) METHOD3(set_ctcss_sql, tone_t) - METHOD1(set_dcs_sql, tone_t) + METHOD3(set_dcs_sql, tone_t) METHOD3(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD3_INIT(set_split_freq_mode, freq_t, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) commit 62e42eb4b3269d2f30ba37f4d3584cc064028ddf Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 22:40:36 2025 +0200 Do the tests for tones when the rig is open Hamlib returns -RIG_EINVAL if the rig is not open. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index b765b3e36..2b86372f0 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -85,6 +85,22 @@ class TestClass: assert rig.set_ant(RIG_ANT_1, option, Hamlib.RIG_VFO_CURR) is None assert rig.get_ant(RIG_ANT_CURR, Hamlib.RIG_VFO_A) == expected + # Squelch codes and tones + + assert rig.set_ctcss_sql(Hamlib.RIG_VFO_CURR, 885) is None + assert rig.get_ctcss_sql() == 885 + assert rig.get_ctcss_sql(Hamlib.RIG_VFO_CURR) == 885 + assert rig.set_ctcss_tone(Hamlib.RIG_VFO_CURR, 854) is None + assert rig.get_ctcss_tone() == 854 + assert rig.get_ctcss_tone(Hamlib.RIG_VFO_CURR) == 854 + assert rig.set_dcs_code(Hamlib.RIG_VFO_CURR, 125) is None + assert rig.get_dcs_code() == 125 + assert rig.get_dcs_code(Hamlib.RIG_VFO_CURR) == 125 + assert rig.set_dcs_sql(311) is None + assert rig.get_dcs_sql() == 311 + assert rig.set_dcs_sql(134, Hamlib.RIG_VFO_CURR) is None + assert rig.get_dcs_sql(Hamlib.RIG_VFO_CURR) == 134 + assert rig.close() is None assert rig.state.comm_state == 0 info = rig.get_info() @@ -105,16 +121,8 @@ class TestClass: assert isinstance(rig.get_channel(channel, Hamlib.RIG_VFO_CURR), Hamlib.channel) assert isinstance(rig.get_channel(channel, Hamlib.RIG_VFO_CURR, readonly), Hamlib.channel) assert isinstance(rig.get_conf(""), str) - assert isinstance(rig.get_ctcss_sql(), int) - assert isinstance(rig.get_ctcss_sql(Hamlib.RIG_VFO_CURR), int) - assert isinstance(rig.get_ctcss_tone(), int) - assert isinstance(rig.get_ctcss_tone(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_dcd(), int) assert isinstance(rig.get_dcd(Hamlib.RIG_VFO_CURR), int) - assert isinstance(rig.get_dcs_code(), int) - assert isinstance(rig.get_dcs_code(Hamlib.RIG_VFO_CURR), int) - assert isinstance(rig.get_dcs_sql(), int) - assert isinstance(rig.get_dcs_sql(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_ext_func(0), int) assert isinstance(rig.get_ext_func(0, 0), int) assert rig.get_ext_level(0) is None @@ -184,11 +192,6 @@ class TestClass: channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) assert rig.set_channel(channel) is None assert rig.set_conf("", "") is None - assert rig.set_ctcss_sql(Hamlib.RIG_VFO_CURR, 0) is None - assert rig.set_ctcss_tone(Hamlib.RIG_VFO_CURR, 0) is None - assert rig.set_dcs_code(Hamlib.RIG_VFO_CURR, 0) is None - assert rig.set_dcs_sql(0) is None - assert rig.set_dcs_sql(0, Hamlib.RIG_VFO_CURR) is None assert rig.set_ext_func(0, 0) is None assert rig.set_ext_func(0, 0, 0) is None level = 0 commit 5c06c7b942151177f742e0da15bcd4b3b67b8eeb Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 22:07:02 2025 +0200 Add tests for Rig.set_freq() and Rig.get_freq() diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 6590fa9f3..b765b3e36 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -51,6 +51,16 @@ class TestClass: info = rig.get_info() assert isinstance(info, str) + # Frequency + + frequency = 5700000000 + assert rig.set_freq(Hamlib.RIG_VFO_CURR, frequency) is None + assert rig.get_freq() == 5700000000.0 + frequency = 5700000000.5 + assert rig.set_freq(Hamlib.RIG_VFO_CURR, frequency) is None + assert rig.get_freq(Hamlib.RIG_VFO_CURR) == 5700000000.5 + assert isinstance(rig.get_freq(Hamlib.RIG_VFO_CURR), float) + # VFO assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A) is None @@ -110,8 +120,6 @@ class TestClass: assert rig.get_ext_level(0) is None assert rig.get_ext_level(0, 0) is None assert rig.get_ext_parm(0) is None - assert isinstance(rig.get_freq(), float) - assert isinstance(rig.get_freq(Hamlib.RIG_VFO_CURR), float) assert isinstance(rig.get_func(0), int) assert isinstance(rig.get_func(0, 0), int) assert rig.get_info() is None @@ -189,8 +197,6 @@ class TestClass: assert rig.set_ext_level(level, value, Hamlib.RIG_VFO_CURR) is None value = Hamlib.value_t() assert rig.set_ext_parm(0, value) is None - freq = 5700000000 - assert rig.set_freq(Hamlib.RIG_VFO_CURR, freq) is None assert rig.set_func(0, 0, 0) is None assert rig.set_level(0, 0, 0) is None assert rig.set_mem(0, 0) is None commit e54c38c522559349eb8d21d4fbeed98243666f5f Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 22:01:54 2025 +0200 Add comments to group tests diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index b43dc9c9b..6590fa9f3 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -51,13 +51,17 @@ class TestClass: info = rig.get_info() assert isinstance(info, str) - assert rig.set_split_vfo(-600000, Hamlib.RIG_VFO_A) is None - assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [-600000, 1] - assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_B) is None - assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [5000000, 2] - assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_CURR) is None - assert rig.get_split_vfo() == [5000000, 1] - assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [5000000, 1] + # VFO + + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A) is None + assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A] + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B) is None + assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B] + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_CURR) is None + assert rig.get_split_vfo() == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] + assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] + + # Antenna # FIXME should use a RIG_ANT_* constant but they aren't available in the bindings RIG_ANT_1 = 1<<0 commit 9574e761ff2fbc7b3bf1a758639837b0dd3cc6c0 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 21:48:53 2025 +0200 Add meaningful arguments diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 3197b1033..b43dc9c9b 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -92,15 +92,15 @@ class TestClass: assert isinstance(rig.get_channel(channel, Hamlib.RIG_VFO_CURR, readonly), Hamlib.channel) assert isinstance(rig.get_conf(""), str) assert isinstance(rig.get_ctcss_sql(), int) - assert isinstance(rig.get_ctcss_sql(0), int) + assert isinstance(rig.get_ctcss_sql(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_ctcss_tone(), int) - assert isinstance(rig.get_ctcss_tone(0), int) + assert isinstance(rig.get_ctcss_tone(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_dcd(), int) - assert isinstance(rig.get_dcd(Hamlib.RIG_VFO_CURR,), int) + assert isinstance(rig.get_dcd(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_dcs_code(), int) - assert isinstance(rig.get_dcs_code(0), int) + assert isinstance(rig.get_dcs_code(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_dcs_sql(), int) - assert isinstance(rig.get_dcs_sql(0), int) + assert isinstance(rig.get_dcs_sql(Hamlib.RIG_VFO_CURR), int) assert isinstance(rig.get_ext_func(0), int) assert isinstance(rig.get_ext_func(0, 0), int) assert rig.get_ext_level(0) is None @@ -172,11 +172,11 @@ class TestClass: channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) assert rig.set_channel(channel) is None assert rig.set_conf("", "") is None - assert rig.set_ctcss_sql(0, 0) is None - assert rig.set_ctcss_tone(0, 0) is None - assert rig.set_dcs_code(0, 0) is None + assert rig.set_ctcss_sql(Hamlib.RIG_VFO_CURR, 0) is None + assert rig.set_ctcss_tone(Hamlib.RIG_VFO_CURR, 0) is None + assert rig.set_dcs_code(Hamlib.RIG_VFO_CURR, 0) is None assert rig.set_dcs_sql(0) is None - assert rig.set_dcs_sql(0, 0) is None + assert rig.set_dcs_sql(0, Hamlib.RIG_VFO_CURR) is None assert rig.set_ext_func(0, 0) is None assert rig.set_ext_func(0, 0, 0) is None level = 0 commit e83d72608b61261d99f4b9c86fa755f0bb051a55 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 20:14:04 2025 +0200 Fix the tests diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 0ecebd9bf..3197b1033 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -63,8 +63,12 @@ class TestClass: RIG_ANT_1 = 1<<0 RIG_ANT_UNKNOWN = 1<<30 RIG_ANT_CURR = 1<<31 + option = Hamlib.value_t() + option.i = 0 expected = [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, RIG_ANT_1, 0] + assert rig.set_ant(RIG_ANT_1, option) is None assert rig.get_ant(RIG_ANT_CURR) == expected + assert rig.set_ant(RIG_ANT_1, option, Hamlib.RIG_VFO_CURR) is None assert rig.get_ant(RIG_ANT_CURR, Hamlib.RIG_VFO_A) == expected assert rig.close() is None @@ -161,15 +165,8 @@ class TestClass: assert rig.scan(Hamlib.RIG_SCAN_VFO, channel, Hamlib.RIG_VFO_CURR) is None assert rig.send_dtmf(Hamlib.RIG_VFO_CURR, "*0123456789#ABCD") is None assert rig.send_morse(Hamlib.RIG_VFO_CURR, "73") is None - # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings - RIG_ANT_1 = 1<<0 - option = Hamlib.value_t() - option.i = 0 - assert rig.set_ant(Hamlib.RIG_VFO_CURR, option) is None - assert rig.set_ant(Hamlib.RIG_VFO_CURR, option, RIG_ANT_1) is None bank = 0 - assert rig.set_bank(bank) is None - assert rig.set_bank(bank, Hamlib.RIG_VFO_CURR) is None + assert rig.set_bank(Hamlib.RIG_VFO_CURR, bank) is None channel = Hamlib.channel() channel = Hamlib.channel(0) channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) @@ -188,9 +185,8 @@ class TestClass: assert rig.set_ext_level(level, value, Hamlib.RIG_VFO_CURR) is None value = Hamlib.value_t() assert rig.set_ext_parm(0, value) is None - freq = 0 - assert rig.set_freq(freq) is None - assert rig.set_freq(freq, Hamlib.RIG_VFO_CURR) is None + freq = 5700000000 + assert rig.set_freq(Hamlib.RIG_VFO_CURR, freq) is None assert rig.set_func(0, 0, 0) is None assert rig.set_level(0, 0, 0) is None assert rig.set_mem(0, 0) is None commit 36576f8e40e701a651e85c567201f9758f20545a Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 20:06:48 2025 +0200 Revert "Fix Rig.send_morse()" This reverts commit 656cf536524197c56d0523d424ba4eacfdbbc278. Conflicts: bindings/python/test_rig.py diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index e5f3c38ab..0ecebd9bf 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -160,8 +160,7 @@ class TestClass: assert rig.scan(Hamlib.RIG_SCAN_VFO, channel) is None assert rig.scan(Hamlib.RIG_SCAN_VFO, channel, Hamlib.RIG_VFO_CURR) is None assert rig.send_dtmf(Hamlib.RIG_VFO_CURR, "*0123456789#ABCD") is None - assert rig.send_morse("73") is None - assert rig.send_morse("73", Hamlib.RIG_VFO_CURR) is None + assert rig.send_morse(Hamlib.RIG_VFO_CURR, "73") is None # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings RIG_ANT_1 = 1<<0 option = Hamlib.value_t() diff --git a/bindings/python/test_startup.py b/bindings/python/test_startup.py index 4620ce4dc..e38cc355d 100755 --- a/bindings/python/test_startup.py +++ b/bindings/python/test_startup.py @@ -83,7 +83,7 @@ class TestClass: #(freq, width, mode, split) = my_rig.get_vfo_info(Hamlib.RIG_VFO_A,freq,width,mode,split) #print("Rig vfo_info:\t\tfreq=%s, mode=%s, width=%s, split=%s" % (freq, mode, width, split)) - assert my_rig.send_morse("73", Hamlib.RIG_VFO_A) is None + assert my_rig.send_morse(Hamlib.RIG_VFO_A, "73") is None assert my_rig.close() is None # Some static functions diff --git a/bindings/rig.swg b/bindings/rig.swg index 096b75b0b..f2ee04e53 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -386,7 +386,7 @@ typedef channel_t * const_channel_t_p; METHOD3(set_bank, int) METHOD3(set_mem, int) METHOD3(send_dtmf, const_char_string) - METHOD1(send_morse, const_char_string) + METHOD3(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) commit 43193681b02938b06987224a2c572495638467d2 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 20:00:24 2025 +0200 Revert "Fix Rig.send_dtmf()" This reverts commit 0e3a90bb351f9a412c5920981ea7cdc18855c4cc. Conflicts: bindings/python/test_rig.py diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 37cb1ebda..e5f3c38ab 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -159,8 +159,7 @@ class TestClass: channel = 0 assert rig.scan(Hamlib.RIG_SCAN_VFO, channel) is None assert rig.scan(Hamlib.RIG_SCAN_VFO, channel, Hamlib.RIG_VFO_CURR) is None - assert rig.send_dtmf("*0123456789#ABCD") is None - assert rig.send_dtmf("*0123456789#ABCD", Hamlib.RIG_VFO_CURR) is None + assert rig.send_dtmf(Hamlib.RIG_VFO_CURR, "*0123456789#ABCD") is None assert rig.send_morse("73") is None assert rig.send_morse("73", Hamlib.RIG_VFO_CURR) is None # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings diff --git a/bindings/rig.swg b/bindings/rig.swg index 4fe50342f..096b75b0b 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -385,7 +385,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_ext_func, hamlib_token_t, int) METHOD3(set_bank, int) METHOD3(set_mem, int) - METHOD1(send_dtmf, const_char_string) + METHOD3(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) commit 9626c8b90dc4d76b3071e65dfb0372f4caba342c Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:57:48 2025 +0200 Revert "Fix Rig.set_bank()" This reverts commit 04d675fc55266f3a96e52487b181c82536139b22. diff --git a/bindings/rig.swg b/bindings/rig.swg index cd30821c2..4fe50342f 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -383,7 +383,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_ant, ant_t, value_t) METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) - METHOD1(set_bank, int) + METHOD3(set_bank, int) METHOD3(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) commit 5319f8b31b70da31144ed46ece9523b7f7eace9d Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:57:43 2025 +0200 Revert "Fix Rig.set_freq()" This reverts commit 070efb7b4127f0b5626596d071d6c68fcee1d3de. diff --git a/bindings/python/test_startup.py b/bindings/python/test_startup.py index a0835ce86..4620ce4dc 100755 --- a/bindings/python/test_startup.py +++ b/bindings/python/test_startup.py @@ -33,7 +33,7 @@ class TestClass: assert my_rig.error_status == Hamlib.RIG_OK assert Hamlib.rigerror2(my_rig.error_status) == "Command completed successfully\n" - assert my_rig.set_freq(5700000000, Hamlib.RIG_VFO_B) is None + assert my_rig.set_freq(Hamlib.RIG_VFO_B, 5700000000) is None assert my_rig.set_vfo(Hamlib.RIG_VFO_B) is None assert my_rig.get_freq() == 5700000000 diff --git a/bindings/rig.swg b/bindings/rig.swg index f0b6a911e..cd30821c2 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -364,7 +364,7 @@ typedef channel_t * const_channel_t_p; #define _VFO_ARG ,vfo #define _VFO_DECL ,vfo_t vfo = RIG_VFO_CURR - METHOD1(set_freq, freq_t) + METHOD3(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD3(set_ptt, ptt_t) METHOD3(set_rptr_shift, rptr_shift_t) commit a617863a238af7eab33e4d10a75dc3149cfff4e2 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:57:14 2025 +0200 Revert "Fix Rig.set_mem()" This reverts commit 663612051c7fcc455c978c9f82889e2a9ab4836d. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index de7c3a285..37cb1ebda 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -195,8 +195,7 @@ class TestClass: assert rig.set_freq(freq, Hamlib.RIG_VFO_CURR) is None assert rig.set_func(0, 0, 0) is None assert rig.set_level(0, 0, 0) is None - assert rig.set_mem(0) is None - assert rig.set_mem(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_mem(0, 0) is None assert rig.set_mode(0) is None assert rig.set_mode(0, 0) is None assert rig.set_mode(0, 0, Hamlib.RIG_VFO_CURR) is None diff --git a/bindings/rig.swg b/bindings/rig.swg index cfe6ee865..f0b6a911e 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -384,7 +384,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) METHOD1(set_bank, int) - METHOD1(set_mem, int) + METHOD3(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) commit 2199ff2bde6b2d7dff5a7bd9b5880ea2cacced17 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:56:59 2025 +0200 Revert "Fix Rig.set_ctcss_sql() Rig.set_ctcss_tone() Rig.set_dcs_code()" This reverts commit ed7e5b2344ccabe0abf5d4f215345acf86aa834f. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 8da10841b..de7c3a285 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -177,16 +177,11 @@ class TestClass: channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) assert rig.set_channel(channel) is None assert rig.set_conf("", "") is None - tone = 0 - assert rig.set_ctcss_sql(tone) is None - assert rig.set_ctcss_sql(tone, Hamlib.RIG_VFO_CURR) is None - assert rig.set_ctcss_tone(tone) is None - assert rig.set_ctcss_tone(tone, Hamlib.RIG_VFO_CURR) is None - code = 0 - assert rig.set_dcs_code(code) is None - assert rig.set_dcs_code(code, Hamlib.RIG_VFO_CURR) is None - assert rig.set_dcs_sql(code) is None - assert rig.set_dcs_sql(code, Hamlib.RIG_VFO_CURR) is None + assert rig.set_ctcss_sql(0, 0) is None + assert rig.set_ctcss_tone(0, 0) is None + assert rig.set_dcs_code(0, 0) is None + assert rig.set_dcs_sql(0) is None + assert rig.set_dcs_sql(0, 0) is None assert rig.set_ext_func(0, 0) is None assert rig.set_ext_func(0, 0, 0) is None level = 0 diff --git a/bindings/rig.swg b/bindings/rig.swg index a136890b2..cfe6ee865 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -369,9 +369,9 @@ typedef channel_t * const_channel_t_p; METHOD3(set_ptt, ptt_t) METHOD3(set_rptr_shift, rptr_shift_t) METHOD3(set_rptr_offs, shortfreq_t) - METHOD1(set_ctcss_tone, tone_t) - METHOD1(set_dcs_code, tone_t) - METHOD1(set_ctcss_sql, tone_t) + METHOD3(set_ctcss_tone, tone_t) + METHOD3(set_dcs_code, tone_t) + METHOD3(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) METHOD3(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) commit 3240d2f8d3d3a366c56d05249605a9a06123635b Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:56:43 2025 +0200 Revert "Fix various methods" This reverts commit 623b93db3dfb5c80aa89f67eb2eb2eff4c044faa. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index f48cf43c4..8da10841b 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -207,16 +207,11 @@ class TestClass: assert rig.set_mode(0, 0, Hamlib.RIG_VFO_CURR) is None assert rig.set_parm(0, 0) is None assert rig.set_powerstat(0) is None - assert rig.set_ptt(0) is None - assert rig.set_ptt(0, Hamlib.RIG_VFO_CURR) is None - assert rig.set_rit(0) is None - assert rig.set_rit(0, Hamlib.RIG_VFO_CURR) is None - assert rig.set_rptr_offs(0) is None - assert rig.set_rptr_offs(0, Hamlib.RIG_VFO_CURR) is None - assert rig.set_rptr_shift(0) is None - assert rig.set_rptr_shift(0, Hamlib.RIG_VFO_CURR) is None - assert rig.set_split_freq(0) is None - assert rig.set_split_freq(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_ptt(0, 0) is None + assert rig.set_rit(0, 0) is None + assert rig.set_rptr_offs(0, 0) is None + assert rig.set_rptr_shift(0, 0) is None + assert rig.set_split_freq(0, 0) is None assert rig.set_split_freq_mode(0, 0) is None assert rig.set_split_freq_mode(0, 0, 0) is None assert rig.set_split_freq_mode(0, 0, 0, 0) is None @@ -226,15 +221,12 @@ class TestClass: assert rig.set_split_vfo(0, 0) is None assert rig.set_split_vfo(0, 0, 0) is None assert rig.set_trn(0) is None # deprecated - assert rig.set_ts(0) is None - assert rig.set_ts(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_ts(0, 0) is None assert rig.set_vfo(0) is None assert rig.set_vfo_opt(0) is None - assert rig.set_xit(0) is None - assert rig.set_xit(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_xit(0, 0) is None assert rig.token_lookup("") is None - assert rig.vfo_op(0) is None - assert rig.vfo_op(0, Hamlib.RIG_VFO_CURR) is None + assert rig.vfo_op(0, 0) is None def test_object_creation(self): diff --git a/bindings/rig.swg b/bindings/rig.swg index 94ed1f058..a136890b2 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -366,20 +366,20 @@ typedef channel_t * const_channel_t_p; METHOD1(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) - METHOD1(set_ptt, ptt_t) - METHOD1(set_rptr_shift, rptr_shift_t) - METHOD1(set_rptr_offs, shortfreq_t) + METHOD3(set_ptt, ptt_t) + METHOD3(set_rptr_shift, rptr_shift_t) + METHOD3(set_rptr_offs, shortfreq_t) METHOD1(set_ctcss_tone, tone_t) METHOD1(set_dcs_code, tone_t) METHOD1(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) - METHOD1(set_split_freq, freq_t) + METHOD3(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD3_INIT(set_split_freq_mode, freq_t, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD2(set_split_vfo, split_t, vfo_t) - METHOD1(set_rit, shortfreq_t) - METHOD1(set_xit, shortfreq_t) - METHOD1(set_ts, shortfreq_t) + METHOD3(set_rit, shortfreq_t) + METHOD3(set_xit, shortfreq_t) + METHOD3(set_ts, shortfreq_t) METHOD2(set_ant, ant_t, value_t) METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) @@ -387,7 +387,7 @@ typedef channel_t * const_channel_t_p; METHOD1(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) - METHOD1(vfo_op, vfo_op_t) + METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSIMPLESET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) commit 92fb82f2204f45673374c9e40177f3b824d34180 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 12 19:56:18 2025 +0200 Revert "Remove the macro METHOD3() which is unused now" This reverts commit 1eeb59e50c2fe34a59d46b3002c09355c798a528. diff --git a/bindings/rig.swg b/bindings/rig.swg index ebf646bcc..94ed1f058 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -89,6 +89,8 @@ typedef channel_t * const_channel_t_p; { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } #define METHOD2_INIT(f, t1, t2, i2) void f (t1 _##t1##_1, t2 _##t2##_2 = i2 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } +#define METHOD3(f, t1) void f ( vfo_t vfo, t1 _##t1) \ + { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1); } #define METHOD3_INIT(f, t1, t2, t3, i3) void f (t1 _##t1##_1, t2 _##t2##_2, t3 _##t3##_3 = i3 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2, _##t3##_3); } #define METHOD4(f, t1) void f ( vfo_t vfo, t1 _##t1) \ commit ef2d2236b5267a2eaf395cb6ffdbd3627e40b4d2 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 22:33:14 2025 +0200 Remove the macro METHOD3() which is unused now diff --git a/bindings/rig.swg b/bindings/rig.swg index 94ed1f058..ebf646bcc 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -89,8 +89,6 @@ typedef channel_t * const_channel_t_p; { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } #define METHOD2_INIT(f, t1, t2, i2) void f (t1 _##t1##_1, t2 _##t2##_2 = i2 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } -#define METHOD3(f, t1) void f ( vfo_t vfo, t1 _##t1) \ - { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1); } #define METHOD3_INIT(f, t1, t2, t3, i3) void f (t1 _##t1##_1, t2 _##t2##_2, t3 _##t3##_3 = i3 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2, _##t3##_3); } #define METHOD4(f, t1) void f ( vfo_t vfo, t1 _##t1) \ commit 292da125661bd647c0334f7673a2f37e05f46175 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 22:19:49 2025 +0200 Fix various methods Fixes: set_ptt set_rit set_rptr_offs set_rptr_shift set_split_freq set_ts set_xit vfo_op This is also swapping the arguments to make the vfo optional like in other methods. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 8da10841b..f48cf43c4 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -207,11 +207,16 @@ class TestClass: assert rig.set_mode(0, 0, Hamlib.RIG_VFO_CURR) is None assert rig.set_parm(0, 0) is None assert rig.set_powerstat(0) is None - assert rig.set_ptt(0, 0) is None - assert rig.set_rit(0, 0) is None - assert rig.set_rptr_offs(0, 0) is None - assert rig.set_rptr_shift(0, 0) is None - assert rig.set_split_freq(0, 0) is None + assert rig.set_ptt(0) is None + assert rig.set_ptt(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_rit(0) is None + assert rig.set_rit(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_rptr_offs(0) is None + assert rig.set_rptr_offs(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_rptr_shift(0) is None + assert rig.set_rptr_shift(0, Hamlib.RIG_VFO_CURR) is None + assert rig.set_split_freq(0) is None + assert rig.set_split_freq(0, Hamlib.RIG_VFO_CURR) is None assert rig.set_split_freq_mode(0, 0) is None assert rig.set_split_freq_mode(0, 0, 0) is None assert rig.set_split_freq_mode(0, 0, 0, 0) is None @@ -221,12 +226,15 @@ class TestClass: assert rig.set_split_vfo(0, 0) is None assert rig.set_split_vfo(0, 0, 0) is None assert rig.set_trn(0) is None # deprecated - assert rig.set_ts(0, 0) is None + assert rig.set_ts(0) is None + assert rig.set_ts(0, Hamlib.RIG_VFO_CURR) is None assert rig.set_vfo(0) is None assert rig.set_vfo_opt(0) is None - assert rig.set_xit(0, 0) is None + assert rig.set_xit(0) is None + assert rig.set_xit(0, Hamlib.RIG_VFO_CURR) is None assert rig.token_lookup("") is None - assert rig.vfo_op(0, 0) is None + assert rig.vfo_op(0) is None + assert rig.vfo_op(0, Hamlib.RIG_VFO_CURR) is None def test_object_creation(self): diff --git a/bindings/rig.swg b/bindings/rig.swg index a136890b2..94ed1f058 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -366,20 +366,20 @@ typedef channel_t * const_channel_t_p; METHOD1(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) - METHOD3(set_ptt, ptt_t) - METHOD3(set_rptr_shift, rptr_shift_t) - METHOD3(set_rptr_offs, shortfreq_t) + METHOD1(set_ptt, ptt_t) + METHOD1(set_rptr_shift, rptr_shift_t) + METHOD1(set_rptr_offs, shortfreq_t) METHOD1(set_ctcss_tone, tone_t) METHOD1(set_dcs_code, tone_t) METHOD1(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) - METHOD3(set_split_freq, freq_t) + METHOD1(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD3_INIT(set_split_freq_mode, freq_t, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD2(set_split_vfo, split_t, vfo_t) - METHOD3(set_rit, shortfreq_t) - METHOD3(set_xit, shortfreq_t) - METHOD3(set_ts, shortfreq_t) + METHOD1(set_rit, shortfreq_t) + METHOD1(set_xit, shortfreq_t) + METHOD1(set_ts, shortfreq_t) METHOD2(set_ant, ant_t, value_t) METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) @@ -387,7 +387,7 @@ typedef channel_t * const_channel_t_p; METHOD1(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) - METHOD3(vfo_op, vfo_op_t) + METHOD1(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSIMPLESET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) commit 160c941e9e2018878bd876cd46ba78cb9add7e00 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 22:05:23 2025 +0200 Fix Rig.set_ctcss_sql() Rig.set_ctcss_tone() Rig.set_dcs_code() This is also swapping the arguments to make the vfo optional like in other methods. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index de7c3a285..8da10841b 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -177,11 +177,16 @@ class TestClass: channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) assert rig.set_channel(channel) is None assert rig.set_conf("", "") is None - assert rig.set_ctcss_sql(0, 0) is None - assert rig.set_ctcss_tone(0, 0) is None - assert rig.set_dcs_code(0, 0) is None - assert rig.set_dcs_sql(0) is None - assert rig.set_dcs_sql(0, 0) is None + tone = 0 + assert rig.set_ctcss_sql(tone) is None + assert rig.set_ctcss_sql(tone, Hamlib.RIG_VFO_CURR) is None + assert rig.set_ctcss_tone(tone) is None + assert rig.set_ctcss_tone(tone, Hamlib.RIG_VFO_CURR) is None + code = 0 + assert rig.set_dcs_code(code) is None + assert rig.set_dcs_code(code, Hamlib.RIG_VFO_CURR) is None + assert rig.set_dcs_sql(code) is None + assert rig.set_dcs_sql(code, Hamlib.RIG_VFO_CURR) is None assert rig.set_ext_func(0, 0) is None assert rig.set_ext_func(0, 0, 0) is None level = 0 diff --git a/bindings/rig.swg b/bindings/rig.swg index cfe6ee865..a136890b2 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -369,9 +369,9 @@ typedef channel_t * const_channel_t_p; METHOD3(set_ptt, ptt_t) METHOD3(set_rptr_shift, rptr_shift_t) METHOD3(set_rptr_offs, shortfreq_t) - METHOD3(set_ctcss_tone, tone_t) - METHOD3(set_dcs_code, tone_t) - METHOD3(set_ctcss_sql, tone_t) + METHOD1(set_ctcss_tone, tone_t) + METHOD1(set_dcs_code, tone_t) + METHOD1(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) METHOD3(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) commit 25aae7d8e2ebc06c7c7094c0d42ceea8bc3d2c82 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 21:38:08 2025 +0200 Fix Rig.set_mem() This is also swapping the arguments to make the vfo optional like in other methods. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 37cb1ebda..de7c3a285 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -195,7 +195,8 @@ class TestClass: assert rig.set_freq(freq, Hamlib.RIG_VFO_CURR) is None assert rig.set_func(0, 0, 0) is None assert rig.set_level(0, 0, 0) is None - assert rig.set_mem(0, 0) is None + assert rig.set_mem(0) is None + assert rig.set_mem(0, Hamlib.RIG_VFO_CURR) is None assert rig.set_mode(0) is None assert rig.set_mode(0, 0) is None assert rig.set_mode(0, 0, Hamlib.RIG_VFO_CURR) is None diff --git a/bindings/rig.swg b/bindings/rig.swg index f0b6a911e..cfe6ee865 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -384,7 +384,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) METHOD1(set_bank, int) - METHOD3(set_mem, int) + METHOD1(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) commit 90c56f3e1fc6d7d86d758076011408832197ca65 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 21:30:40 2025 +0200 Fix Rig.set_freq() This is also swapping the arguments to make the vfo optional like in other methods. diff --git a/bindings/python/test_startup.py b/bindings/python/test_startup.py index 4620ce4dc..a0835ce86 100755 --- a/bindings/python/test_startup.py +++ b/bindings/python/test_startup.py @@ -33,7 +33,7 @@ class TestClass: assert my_rig.error_status == Hamlib.RIG_OK assert Hamlib.rigerror2(my_rig.error_status) == "Command completed successfully\n" - assert my_rig.set_freq(Hamlib.RIG_VFO_B, 5700000000) is None + assert my_rig.set_freq(5700000000, Hamlib.RIG_VFO_B) is None assert my_rig.set_vfo(Hamlib.RIG_VFO_B) is None assert my_rig.get_freq() == 5700000000 diff --git a/bindings/rig.swg b/bindings/rig.swg index cd30821c2..f0b6a911e 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -364,7 +364,7 @@ typedef channel_t * const_channel_t_p; #define _VFO_ARG ,vfo #define _VFO_DECL ,vfo_t vfo = RIG_VFO_CURR - METHOD3(set_freq, freq_t) + METHOD1(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD3(set_ptt, ptt_t) METHOD3(set_rptr_shift, rptr_shift_t) commit 01bc71ab8a2d24545f6d48ff90bd9c5c5747011f Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 21:26:22 2025 +0200 Fix Rig.set_bank() diff --git a/bindings/rig.swg b/bindings/rig.swg index 4fe50342f..cd30821c2 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -383,7 +383,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_ant, ant_t, value_t) METHOD2(set_func, setting_t, int) METHOD2(set_ext_func, hamlib_token_t, int) - METHOD3(set_bank, int) + METHOD1(set_bank, int) METHOD3(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) commit 2b1428fd3e41cc7830ded0d057fdac0a27d4c5b3 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 21:22:20 2025 +0200 Add meaningful arguments diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 8ef760f72..37cb1ebda 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -150,14 +150,15 @@ class TestClass: assert rig.lookup_mem_caps(0) is None assert isinstance(rig.mem_count(), int) assert rig.open() is None - assert rig.passband_narrow(0) is None - assert rig.passband_normal(0) is None - assert rig.passband_wide(0) is None + assert rig.passband_narrow(Hamlib.RIG_MODE_CW) is None # FIXME should return passband + assert rig.passband_normal(Hamlib.RIG_MODE_CW) is None # FIXME should return passband + assert rig.passband_wide(Hamlib.RIG_MODE_CW) is None # FIXME should return passband assert isinstance(rig.recv_dtmf(), str) - assert isinstance(rig.recv_dtmf(0), str) + assert isinstance(rig.recv_dtmf(Hamlib.RIG_VFO_CURR), str) assert rig.reset(Hamlib.RIG_RESET_NONE) is None - assert rig.scan(0, 0) is None - assert rig.scan(0, 0, 0) is None + channel = 0 + assert rig.scan(Hamlib.RIG_SCAN_VFO, channel) is None + assert rig.scan(Hamlib.RIG_SCAN_VFO, channel, Hamlib.RIG_VFO_CURR) is None assert rig.send_dtmf("*0123456789#ABCD") is None assert rig.send_dtmf("*0123456789#ABCD", Hamlib.RIG_VFO_CURR) is None assert rig.send_morse("73") is None @@ -168,10 +169,12 @@ class TestClass: option.i = 0 assert rig.set_ant(Hamlib.RIG_VFO_CURR, option) is None assert rig.set_ant(Hamlib.RIG_VFO_CURR, option, RIG_ANT_1) is None - assert rig.set_bank(0, 0) is None + bank = 0 + assert rig.set_bank(bank) is None + assert rig.set_bank(bank, Hamlib.RIG_VFO_CURR) is None channel = Hamlib.channel() channel = Hamlib.channel(0) - channel = Hamlib.channel(0, 0) + channel = Hamlib.channel(0, Hamlib.RIG_VFO_CURR) assert rig.set_channel(channel) is None assert rig.set_conf("", "") is None assert rig.set_ctcss_sql(0, 0) is None @@ -187,13 +190,15 @@ class TestClass: assert rig.set_ext_level(level, value, Hamlib.RIG_VFO_CURR) is None value = Hamlib.value_t() assert rig.set_ext_parm(0, value) is None - assert rig.set_freq(0, 0) is None + freq = 0 + assert rig.set_freq(freq) is None + assert rig.set_freq(freq, Hamlib.RIG_VFO_CURR) is None assert rig.set_func(0, 0, 0) is None assert rig.set_level(0, 0, 0) is None assert rig.set_mem(0, 0) is None assert rig.set_mode(0) is None assert rig.set_mode(0, 0) is None - assert rig.set_mode(0, 0, 0) is None + assert rig.set_mode(0, 0, Hamlib.RIG_VFO_CURR) is None assert rig.set_parm(0, 0) is None assert rig.set_powerstat(0) is None assert rig.set_ptt(0, 0) is None commit 8901b210ee0a9ff399904f1516350e65e2ed6de0 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 21:04:39 2025 +0200 Fix Rig.send_dtmf() diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 7547cd838..8ef760f72 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -158,7 +158,8 @@ class TestClass: assert rig.reset(Hamlib.RIG_RESET_NONE) is None assert rig.scan(0, 0) is None assert rig.scan(0, 0, 0) is None - assert rig.send_dtmf(0, "") is None + assert rig.send_dtmf("*0123456789#ABCD") is None + assert rig.send_dtmf("*0123456789#ABCD", Hamlib.RIG_VFO_CURR) is None assert rig.send_morse("73") is None assert rig.send_morse("73", Hamlib.RIG_VFO_CURR) is None # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings diff --git a/bindings/rig.swg b/bindings/rig.swg index 096b75b0b..4fe50342f 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -385,7 +385,7 @@ typedef channel_t * const_channel_t_p; METHOD2(set_ext_func, hamlib_token_t, int) METHOD3(set_bank, int) METHOD3(set_mem, int) - METHOD3(send_dtmf, const_char_string) + METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) commit 13c2413bbaf3fb99c3448771b868ea3c5c032282 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 20:59:09 2025 +0200 Fix Rig.send_morse() This is also swapping the arguments to make the vfo optional like in other methods. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 80f37acd2..7547cd838 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -159,7 +159,8 @@ class TestClass: assert rig.scan(0, 0) is None assert rig.scan(0, 0, 0) is None assert rig.send_dtmf(0, "") is None - assert rig.send_morse(0, "") is None + assert rig.send_morse("73") is None + assert rig.send_morse("73", Hamlib.RIG_VFO_CURR) is None # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings RIG_ANT_1 = 1<<0 option = Hamlib.value_t() diff --git a/bindings/python/test_startup.py b/bindings/python/test_startup.py index e38cc355d..4620ce4dc 100755 --- a/bindings/python/test_startup.py +++ b/bindings/python/test_startup.py @@ -83,7 +83,7 @@ class TestClass: #(freq, width, mode, split) = my_rig.get_vfo_info(Hamlib.RIG_VFO_A,freq,width,mode,split) #print("Rig vfo_info:\t\tfreq=%s, mode=%s, width=%s, split=%s" % (freq, mode, width, split)) - assert my_rig.send_morse(Hamlib.RIG_VFO_A, "73") is None + assert my_rig.send_morse("73", Hamlib.RIG_VFO_A) is None assert my_rig.close() is None # Some static functions diff --git a/bindings/rig.swg b/bindings/rig.swg index f2ee04e53..096b75b0b 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -386,7 +386,7 @@ typedef channel_t * const_channel_t_p; METHOD3(set_bank, int) METHOD3(set_mem, int) METHOD3(send_dtmf, const_char_string) - METHOD3(send_morse, const_char_string) + METHOD1(send_morse, const_char_string) METHOD3(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) commit 25a2a4447f01eaaec83f5a95903f6e300ba0534b Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 19:28:20 2025 +0200 Fix Rig.get_ant() tests The first argument is the antenna. diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 1c3927cb0..80f37acd2 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -59,10 +59,13 @@ class TestClass: assert rig.get_split_vfo() == [5000000, 1] assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [5000000, 1] - # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings + # FIXME should use a RIG_ANT_* constant but they aren't available in the bindings + RIG_ANT_1 = 1<<0 RIG_ANT_UNKNOWN = 1<<30 - assert rig.get_ant(Hamlib.RIG_VFO_A) == [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, Hamlib.RIG_VFO_A, 0] - assert rig.get_ant(Hamlib.RIG_VFO_A, Hamlib.RIG_VFO_A) == [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, Hamlib.RIG_VFO_A, 0] + RIG_ANT_CURR = 1<<31 + expected = [RIG_ANT_UNKNOWN, RIG_ANT_UNKNOWN, RIG_ANT_1, 0] + assert rig.get_ant(RIG_ANT_CURR) == expected + assert rig.get_ant(RIG_ANT_CURR, Hamlib.RIG_VFO_A) == expected assert rig.close() is None assert rig.state.comm_state == 0 ----------------------------------------------------------------------- Summary of changes: bindings/python/test_rig.py | 109 ++++++++++++++++++++++++++------------------ bindings/rig.swg | 2 +- 2 files changed, 65 insertions(+), 46 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: n0nb <n0...@us...> - 2025-07-27 16:08:35
|
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 0d543f9483f348c1f6bc8ff0375034590cf9da85 (commit) via bc25855f48edf631d7653345f0bb763759094ba5 (commit) via df6ddedf63a65529b214e609510e055da127a949 (commit) via f0efc558f6354a64fb22255a1979e58a68ff1e0f (commit) from 119e0793739c772fcee2fbe7228c4b61afc279e1 (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 0d543f9483f348c1f6bc8ff0375034590cf9da85 Merge: 119e07937 bc25855f4 Author: Nate Bargmann <n0...@n0...> Date: Sun Jul 27 10:54:55 2025 -0500 Merge GitHub PR #1815 commit bc25855f48edf631d7653345f0bb763759094ba5 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sat Jul 26 00:15:09 2025 +0200 Check split argument in dummy_get_split_mode() and fix the test diff --git a/bindings/python/test_rig.py b/bindings/python/test_rig.py index 1c3927cb0..0ccc01097 100755 --- a/bindings/python/test_rig.py +++ b/bindings/python/test_rig.py @@ -51,13 +51,13 @@ class TestClass: info = rig.get_info() assert isinstance(info, str) - assert rig.set_split_vfo(-600000, Hamlib.RIG_VFO_A) is None - assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [-600000, 1] - assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_B) is None - assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [5000000, 2] - assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_CURR) is None - assert rig.get_split_vfo() == [5000000, 1] - assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [5000000, 1] + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A) is None + assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A] + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B) is None + assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B] + assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_CURR) is None + assert rig.get_split_vfo() == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] + assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B] # FIXME should use a RIG_ANT_* constant but it isn't available in the bindings RIG_ANT_UNKNOWN = 1<<30 diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index de1dae493..e25d0bbf3 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -1114,11 +1114,25 @@ static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) rig_debug(RIG_DEBUG_VERBOSE, "%s: split=%d, vfo=%s, tx_vfo=%s\n", __func__, split, rig_strvfo(vfo), rig_strvfo(tx_vfo)); + switch (split) + { + case RIG_SPLIT_OFF: + priv->split = RIG_SPLIT_OFF; + break; + + case RIG_SPLIT_ON: + priv->split = RIG_SPLIT_ON; + break; + + default: + rig_debug(RIG_DEBUG_ERR, "%s: unsupported split %d", __func__, split); + RETURNFUNC(-RIG_EINVAL); + } + if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; } if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); } - priv->split = split; priv->tx_vfo = tx_vfo; RETURNFUNC(RIG_OK); commit df6ddedf63a65529b214e609510e055da127a949 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Jul 25 23:52:02 2025 +0200 Use a define instead of a magic number diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index fc9f10571..de1dae493 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -197,7 +197,7 @@ static void init_chan(RIG *rig, vfo_t vfo, channel_t *chan) chan->rit = 0; chan->xit = 0; chan->tuning_step = 0; - chan->ant = 0; + chan->ant = RIG_ANT_NONE; chan->funcs = (setting_t)0; memset(chan->levels, 0, RIG_SETTING_MAX * sizeof(value_t)); commit f0efc558f6354a64fb22255a1979e58a68ff1e0f Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Jun 29 18:15:00 2025 +0200 Make Dummy Rig handle also RIG_ANT_5 diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index a7006792f..fc9f10571 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -1823,6 +1823,7 @@ static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) case RIG_ANT_2: case RIG_ANT_3: case RIG_ANT_4: + case RIG_ANT_5: curr->ant = ant; break; @@ -1860,6 +1861,7 @@ static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, case RIG_ANT_2: case RIG_ANT_3: case RIG_ANT_4: + case RIG_ANT_5: *ant_curr = ant; break; @@ -2463,14 +2465,14 @@ struct rig_caps dummy_caps = .agc_levels = { RIG_AGC_OFF, RIG_AGC_SUPERFAST, RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW, RIG_AGC_AUTO, RIG_AGC_USER }, .rx_range_list1 = { { .startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES, - .low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4, + .low_power = -1, .high_power = -1, DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4 | RIG_ANT_5, .label = "Dummy#1" }, RIG_FRNG_END, }, .tx_range_list1 = { { .startf = kHz(150), .endf = MHz(1500), .modes = DUMMY_MODES, - .low_power = W(5), .high_power = W(100), DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4, + .low_power = W(5), .high_power = W(100), DUMMY_VFOS, RIG_ANT_1 | RIG_ANT_2 | RIG_ANT_3 | RIG_ANT_4 | RIG_ANT_5, .label = "Dummy#1" }, RIG_FRNG_END, ----------------------------------------------------------------------- Summary of changes: bindings/python/test_rig.py | 14 +++++++------- rigs/dummy/dummy.c | 24 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |