Commit graph

354 commits

Author SHA1 Message Date
George Baltz N3GB
3bed166fd6 Update a couple of simulators
Yet another failed attempt to test code via simulator; x25/x26 commands
  gave bogus answers.  So, another round of general cleanups for a
  couple of simulated rigs.

Fix detection of bad headers
Always send well-formed ACK/NAK frames
Add missing values to 0x26 messages
Fix bad responses when VFOB is active
Remove duplicate debug messages
Add some vendor-specific data and definitions to sim.h
Partial removal of rig.h dependencies/definitions
2026-07-01 15:29:58 -04:00
George Baltz N3GB
2360882b0c Still more scope shrinkage 2026-06-23 22:55:11 -04:00
George Baltz N3GB
0b2b91f538 Get rid of all 'mode_t' declarations
Use rmode_t for real hamlib modes, appropriate types for others.
2026-05-10 12:11:01 -04:00
Daniele Forsi IU5HKX
f91ec06df2 Remove duplicated line 2026-04-26 10:59:38 +02:00
George Baltz N3GB
2f3d01728b Remove all traces of FTDX3000DM
Per Yaesu Tech support, treat all FTDX-3000 models the same. See comments
  in PR #2039.

While removing references to FTDX-3000DM, I happened across simft818.c.
  It set a new low for simulators.  It is completely wrong - it uses
  new CAT protocol, while the rig uses the old 5-byte binary version.
  If you want to simulate the FT-818, start over with simft817.c as
  the basis, because this one is gone.
2026-04-22 12:51:36 -04:00
George Baltz N3GB
cbf6aff25a One more simulator limps across the starting line.
Just enough hacking to get it going.
2026-04-19 14:44:58 -04:00
George Baltz N3GB
c375832f62 Make a couple more simulators barely functional
Allow simftdx1200.c and simftdx3000.c to at least start, go
  through the initial setup/open, have mode and width do something.
Fix field lengths, missing commands, incorrect data, etc.

simftdx3000.c shows an interesting problem - the FTDX3000 CAT manual
  says the rig should return 0462 for the ID command - hamlib thinks
  that is a FTDX-3000DM, the low power version.  Maybe they're backwards??
  Does anybody have a real one to find out?
2026-04-19 13:39:32 -04:00
George Baltz N3GB
4b9908f981 Fix up another simulator.
Fix the ID command
Remove includes
Make the mode, width and narrow consistent.
2026-04-19 13:39:32 -04:00
George Baltz N3GB
78530515e5 Fix simftdx101.c so it is marginally useful.
As usual, trying to use a simulator for debugging/development testing
  is not helpful.

Fix ID command so it at least can say it is a FTDX-101
Get rig of includes of rig.h and misc.h
Fix the SH command so it agrees with the FTDX101MP/FTDX101D CAT OpsRef

TODO: Roofing filters, Main/Sub vfo commands, and lots more.
2026-04-19 13:39:32 -04:00
George Baltz N3GB
bf5bea4012 Use the correct SH command in newcat_set_rx_bandwidth() and simft710.c
FT-710 CAT Operations Manual says the FT-710 has 2 leading zeroes (P1
  & P2), not just 1.

Fix missing "== 0"
2026-04-04 02:42:44 -04:00
George Baltz N3GB
31d1635cf3 Make sure simft710.c rejects RF command
No roofing filters on this rig.
Clean out includes of rig.h and misc.c
2026-04-03 16:45:08 -04:00
George Baltz N3GB
37df17c1a2 Drop a few more cppcheck dings
Use c11 `for` statements
2025-12-26 12:55:33 -05:00
Nate Bargmann
95cd7391a2
Merge GitHub PR #1917 2025-09-19 08:07:16 -05:00
Daniele Forsi IU5HKX
7ed63e2e20 Fix build failure when trying to build simulators on a clean tree
Fixes:
make[1]: *** No rule to make target '../lib/libmisc.la', needed by 'simatd578'.  Stop.

Steps to reproduce:
make clean
make -j12 -C simulators check
2025-09-18 18:57:51 +02:00
George Baltz N3GB
00fb4bba71 Remove dependency on misc.h from sim.h
Include string.h to declare strerror
Remove rig.h from simic705.c

From first principles, none of the simulators should use *ANY* of the
code from Hamlib.  Using the same code on both sides of a simulation gives
the equivalent of a math "X = X" proof; guaranteed to work, but useless
for proving anything else.
2025-09-15 14:58:38 -04:00
Daniele Forsi IU5HKX
47f60d4ad7 [simulators] Remove unused includes
Found by iwyu.
2025-08-30 09:43:45 +02:00
Daniele Forsi IU5HKX
8f0c94dc77
[simulators] Fix compiler warning
Adds the same code used in other simulators.

Fixes:
simft897.c:26:9: warning: variable ‘n’ set but not used [-Wunused-but-set-variable]
2025-08-18 17:17:32 -05:00
Daniele Forsi IU5HKX
1aafbb3f24
[simulators] Add missing files to check_PROGRAMS 2025-08-18 17:17:31 -05:00
Daniele Forsi IU5HKX
271129705a
[simulators] Split and sort the list of check_PROGRAMS 2025-08-18 17:17:31 -05:00
Daniele Forsi IU5HKX
8805748e74
[simulators] Add missing files to EXTRA_DIST 2025-08-18 09:02:06 -05:00
George Baltz N3GB
74558224a9 More cppcheck style hints 2025-08-13 09:30:59 -04:00
Nate Bargmann
93a24356e5
Merge GitHub PR #1831 2025-08-07 07:26:47 -05:00
Daniele Forsi IU5HKX
891070941f 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]
2025-08-07 14:14:58 +02:00
Daniele Forsi IU5HKX
5b1517778e 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.
2025-08-07 11:38:12 +02:00
Daniele Forsi IU5HKX
8887294cd8 Replace "goto again" with "continue" (second case)
Does the same thing with more structured control flow.
It also silences compiler warnings.
2025-08-07 11:22:44 +02:00
Daniele Forsi IU5HKX
5b87b38704 Replace "goto again" with "continue" (first case)
Does the same thing with more structured control flow.
It also silences compiler warnings.
2025-08-07 11:22:14 +02:00
Daniele Forsi IU5HKX
4251c50b7f 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)
2025-08-07 08:54:09 +02:00
Daniele Forsi IU5HKX
49c78edb80 Make code more uniform 2025-08-06 21:49:17 +02:00
Daniele Forsi IU5HKX
59acdb791e Fix compiler warning
Move both initialization outside of the conditional.

Fixes:
simyaesu.c:364:12: warning: ‘pbuf’ may be used uninitialized [-Wmaybe-uninitialized]
2025-08-06 09:34:04 +02:00
Daniele Forsi IU5HKX
032e78826e 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=]
2025-08-05 23:46:10 +02:00
Daniele Forsi IU5HKX
d5c5eeff15 No need to use strlen() because the i variable counted the chars read 2025-08-05 22:40:17 +02:00
Daniele Forsi IU5HKX
af4c6ec806 Make the output of simft990 more friendly 2025-08-05 22:40:17 +02:00
Daniele Forsi IU5HKX
9dd0009f9e Remove unused define 2025-08-05 22:22:50 +02:00
Daniele Forsi IU5HKX
816d6d9bef Replace magic number with a defined constant 2025-08-05 22:22:50 +02:00
Daniele Forsi IU5HKX
249a993633 Avoid spamming the terminal with 0's 2025-08-05 22:22:50 +02:00
Daniele Forsi IU5HKX
8064da8121 Avoid burning 100% CPU
Adds hl_usleep() like in the other version of getmyline().
2025-08-05 21:16:33 +02:00
Daniele Forsi IU5HKX
d9532a9c62 Fix compiler warning
Fixes:
simft990.c:64:36: warning: pointer targets in passing argument 2 of ‘getmyline5’ differ in signedness [-Wpointer-sign]
2025-08-05 20:51:04 +02:00
Daniele Forsi IU5HKX
f691a68c06 Fix compiler warning
Fixes:
simft990.c:39:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
2025-08-05 20:38:57 +02:00
Daniele Forsi IU5HKX
725fcee004 Fix compiler warning
Fixes:
simatd578.c:143:9: warning: ‘n’ may be used uninitialized [-Wmaybe-uninitialized]
2025-08-05 20:22:41 +02:00
Daniele Forsi IU5HKX
151549bb3b Remove disabled code
None of these simulators does multicast networking.
2025-08-04 11:36:03 +02:00
Daniele Forsi IU5HKX
790820ab22 Refactor to remove code duplication of one version of getmyline() 2025-08-04 11:36:03 +02:00
Daniele Forsi IU5HKX
b809937395 Rename in preparation of conflicting changes 2025-08-04 11:36:03 +02:00
Daniele Forsi IU5HKX
498b45f5b0 Rename in preparation of conflicting changes 2025-08-04 11:36:03 +02:00
Daniele Forsi IU5HKX
a5467f4033 Refactor to remove code duplication of one version of getmyline() 2025-08-04 11:34:00 +02:00
Daniele Forsi IU5HKX
10f6504897 Remove disabled code and change signature
Makes getmyline() identical to the other simulators.
2025-08-04 11:32:26 +02:00
Daniele Forsi IU5HKX
f8881f9bb9 Remove disabled code
None of these simulators does multicast networking.
2025-08-03 22:09:04 +02:00
Daniele Forsi IU5HKX
9e51419ab8 Do not use relative paths for including rig.h
The Makefile adds all necessary include directories.
2025-08-03 16:09:51 +02:00
Daniele Forsi IU5HKX
c26f033395 Do not use relative paths for including misc.h
The Makefile adds all necessary include directories.
2025-08-03 16:09:47 +02:00
Daniele Forsi IU5HKX
8d8d0328bf Fix typos 2025-08-03 10:49:23 +02:00
Daniele Forsi IU5HKX
f89ebfd226 Add include missed by IWYU 2025-08-03 09:35:03 +02:00