[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 93a24356e5ad79a128659
Library to control radio transceivers and receivers
Brought to you by:
n0nb
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] |