[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.5.5 updated. 4.5.4-66-g6eecd
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2023-04-05 11:44:34
|
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.5.5 has been updated via 6eecd3d0160278373875e16b77299881ff656068 (commit) via e5210bec1545472ef924c8fb8f21a550c6b6be3d (commit) via ad140cbac217ea346ebbe8042ecf67b1bbca08d7 (commit) from 9bf8066b836399507e0ae5cbed3f6c07a16de938 (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 6eecd3d0160278373875e16b77299881ff656068 Author: Nate Bargmann <n0...@n0...> Date: Wed Apr 5 06:43:08 2023 -0500 Update NEWS for 4.5.5 release diff --git a/NEWS b/NEWS index 73af32a6..8b13ec30 100644 --- a/NEWS +++ b/NEWS @@ -1,36 +1,14 @@ Hamlib -- History of visible changes. Copyright (C) 2000-2003 Frank Singleton -Copyright (C) 2000-2021 Stephane Fillod, and others -Copyright (C) 2000-2021 Michael Black W9MDB, and others +Copyright (C) 2000-2023 Stephane Fillod, and others +Copyright (C) 2000-2023 Michael Black W9MDB, and others Please send Hamlib bug reports to ham...@li... -Version 5.x -- future - * rig_get_conf deprecated and replaced by rig_get_conf2 - * rot_get_conf deprecated and replaced by rot_get_conf2 - * Change FT1000MP Mark V model names to align with FT1000MP - -Version 4.6 - * Add saebrtrack rotor https://sites.google.com/site/marklhammond/saebrtrack - * Add offset_vfoa and offset_vfob applying to rig_set_freq - * Fix K4 to put it in K40 mode when requesting ID - * 2023-11-XX -- Planned for Nov 2023 - * Fixes for M2 Rotors - * Add rigctlsync utility to synchronize frequency from a rig to SDR# (or others) - * Add SDR# rig for use with SDR#'s gpredict plugin -- can only get/set freq - * Add Apex Shared Loop rotator -- unidirectional only so far - * Add client_version to rigctld so client can report it's version for future use/compatility/alternatives - * Add --set-conf=tuner_control_pathname=hamlib_tuner_control (default) - If file exists then it will be called with 0/1 (Off/On) argument - with 'U TUNER 0' or 'U TUNER 1" - Default path is for current directory - * Add MDS 4710/9710 rigs - * Add FLIR PTU-D48, E46, D100, D300 rotors - * Fix FTDX3000 rig split - Version 4.5.5 + * 2023-04-05 * Add park to rotorez.c * Fix rig power on/off from rigctl cmd line and rigctld * Enable async mode by default to prevent WSJT-X crash on IC9700 with transceive on @@ -66,7 +44,7 @@ Version 4.5.5 * Fix power on/off/on for Icom rigs with rigctld power_on=0 Version 4.5.4 - * 2023-XX-XX + * 2023-01-10 * Fix CM108 ptt setting for non-default usage * Fix power on/off for Icom rigs with rigctld power_on=0 * Fix get_powerstat status return for non-PS kenwood rigs commit e5210bec1545472ef924c8fb8f21a550c6b6be3d Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 4 22:13:16 2023 -0500 Fix bootstrap problems diff --git a/simulators/Makefile.am b/simulators/Makefile.am index eebddedd..3e2d7c04 100644 --- a/simulators/Makefile.am +++ b/simulators/Makefile.am @@ -8,7 +8,7 @@ DISTCLEANFILES = bin_PROGRAMS = -check_PROGRAMS = simelecraft simicom simkenwood simyaesu simicom9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr +check_PROGRAMS = simelecraft simicom simkenwood simyaesu simicom9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simelecraft_SOURCES = simelecraft.c simicom_SOURCES = simicom.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 828f5efc..69cd60be 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,6 @@ AMPCOMMONSRC = ampctl_parse.c ampctl_parse.h dumpcaps_amp.c uthash.h rigctl_SOURCES = rigctl.c $(RIGCOMMONSRC) rigctld_SOURCES = rigctld.c $(RIGCOMMONSRC) rigctlcom_SOURCES = rigctlcom.c $(RIGCOMMONSRC) -rigctltcp_SOURCES = rigctltcp.c $(RIGCOMMONSRC) rotctl_SOURCES = rotctl.c $(ROTCOMMONSRC) rotctld_SOURCES = rotctld.c $(ROTCOMMONSRC) ampctl_SOURCES = ampctl.c $(AMPCOMMONSRC) @@ -51,7 +50,6 @@ rotctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src ampctl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src ampctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src rigctlcom_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security -rigctltcp_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security if HAVE_LIBUSB rigtestlibusb_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(LIBUSB_CFLAGS) endif @@ -65,7 +63,6 @@ ampctl_LDADD = $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) ampctld_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) rigmem_LDADD = $(LIBXML2_LIBS) $(LDADD) rigctlcom_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) -rigctltcp_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) if HAVE_LIBUSB rigtestlibusb_LDADD = $(LIBUSB_LIBS) endif @@ -81,7 +78,6 @@ rigctld_LDFLAGS = $(WINEXELDFLAGS) rotctld_LDFLAGS = $(WINEXELDFLAGS) ampctld_LDFLAGS = $(WINEXELDFLAGS) rigctlcom_LDFLAGS = $(WINEXELDFLAGS) -rigctltcp_LDFLAGS = $(WINEXELDFLAGS) if HAVE_LIBUSB rigtestlibusb_LDFLAGS = $(WINEXELDFLAGS) endif commit ad140cbac217ea346ebbe8042ecf67b1bbca08d7 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Jan 4 17:33:55 2023 -0600 Add simid5100.c diff --git a/simulators/simid5100.c b/simulators/simid5100.c new file mode 100644 index 00000000..3db0a01f --- /dev/null +++ b/simulators/simid5100.c @@ -0,0 +1,476 @@ +// simicom will show the pts port to use for rigctl on Unix +// using virtual serial ports on Windows is to be developed yet +// Needs a lot of improvement to work on all Icoms +// gcc -g -Wall -o simicom simicom.c -lhamlib +// On mingw in the hamlib src directory +// gcc -static -I../include -g -Wall -o simicom simicom.c -L../../build/src/.libs -lhamlib -lwsock32 -lws2_32 +#define _XOPEN_SOURCE 600 +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/time.h> +#include <hamlib/rig.h> +#include "../src/misc.h" +#include <termios.h> +#include <unistd.h> + + +#define BUFSIZE 256 + +int civ_731_mode = 0; +vfo_t current_vfo = RIG_VFO_A; +int split = 0; + +// we make B different from A to ensure we see a difference at startup +float freqA = 145000000; +float freqB = 14074500; +mode_t modeA = RIG_MODE_PKTUSB; +mode_t modeB = RIG_MODE_PKTUSB; +int datamodeA = 0; +int datamodeB = 0; +int filterA = 0; +ant_t ant_curr = 0; +int ant_option = 0; +int ptt = 0; +int satmode = 0; +int agc_time = 1; +int ovf_status = 0; +int powerstat = 1; + +void dumphex(unsigned char *buf, int n) +{ + for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); } + + printf("\n"); +} + +int +frameGet(int fd, unsigned char *buf) +{ + int i = 0; + memset(buf, 0, BUFSIZE); + unsigned char c; + +again: + + while (read(fd, &c, 1) > 0) + { + buf[i++] = c; + //printf("i=%d, c=0x%02x\n",i,c); + + if (c == 0xfd) + { + dumphex(buf, i); + return i; + } + + if (i > 2 && c == 0xfe) + { + printf("Turning power on due to 0xfe string\n"); + powerstat = 1; + int j; + + for (j = i; j < 175; ++j) + { + if (read(fd, &c, 1) < 0) { break; } + } + + i = 0; + goto again; + } + } + + printf("Error???\n"); + + return 0; +} + +void frameParse(int fd, unsigned char *frame, int len) +{ + double freq; + int n = 0; + + dumphex(frame, len); + + if (frame[0] != 0xfe && frame[1] != 0xfe) + { + printf("expected fe fe, got "); + dumphex(frame, len); + return; + } + + switch (frame[4]) + { + case 0x00: + freq = from_bcd(&frame[5], 5 * 2); + freqA = freq; + printf("freq=%lf\n", freqA); + break; + case 0x03: + + //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) + { + printf("get_freqA\n"); + to_bcd(&frame[5], (long long)freqA/10000, 3 * 2); + dump_hex(frame,11); + } + else + { + printf("get_freqB\n"); + to_bcd(&frame[5], (long long)freqB/10000, 3 * 2); + } + + frame[8] = 0xfd; + dump_hex(frame,9); + + n = write(fd, frame, 9); + + break; + + case 0x04: + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) + { + printf("get_modeA\n"); + frame[5] = modeA; + frame[6] = filterA; + } + else + { + printf("get_modeB\n"); + frame[5] = modeB; + frame[6] = filterA; + } + + frame[7] = 0xfd; + n = write(fd, frame, 8); + break; + + case 0x05: + freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); + printf("set_freq to %.0f\n", freq); + + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { freqA = freq; } + else { freqB = freq; } + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x06: + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { modeA = frame[6]; } + else { modeB = frame[6]; } + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x07: + + switch (frame[5]) + { + case 0x00: current_vfo = RIG_VFO_A; break; + + case 0x01: current_vfo = RIG_VFO_B; break; + + case 0xd0: current_vfo = RIG_VFO_MAIN; break; + + case 0xd1: current_vfo = RIG_VFO_SUB; break; + } + + printf("set_vfo to %s\n", rig_strvfo(current_vfo)); + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x0f: + if (frame[5] == 0) { split = 0; } + else if (frame[5] == 1) { split = 1; } + else { frame[6] = split; } + + if (frame[5] == 0xfd) + { + printf("get split %d\n", 1); + frame[7] = 0xfd; + n = write(fd, frame, 8); + } + else + { + printf("set split %d\n", 1); + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + } + + break; + + case 0x12: // we're simulating the 3-byte version -- not the 2-byte + if (frame[5] != 0xfd) + { + printf("Set ant %d\n", -1); + ant_curr = frame[5]; + ant_option = frame[6]; + dump_hex(frame, 8); + } + else + { + printf("Get ant\n"); + } + + frame[5] = ant_curr; + frame[6] = ant_option; + frame[7] = 0xfd; + printf("write 8 bytes\n"); + dump_hex(frame, 8); + n = write(fd, frame, 8); + break; + + case 0x14: + switch (frame[5]) + { + static int power_level = 0; + + case 0x0a: + printf("Using power level %d\n", power_level); + power_level += 10; + + if (power_level > 250) { power_level = 0; } + + to_bcd(&frame[6], (long long)power_level, 2); + frame[8] = 0xfd; + n = write(fd, frame, 9); + break; + } + + break; + + case 0x15: + switch (frame[5]) + { + static int meter_level = 0; + + case 0x07: + frame[6] = ovf_status; + frame[7] = 0xfd; + n = write(fd, frame, 8); + ovf_status = ovf_status == 0 ? 1 : 0; + break; + + case 0x11: + printf("Using meter level %d\n", meter_level); + meter_level += 10; + + if (meter_level > 250) { meter_level = 0; } + + to_bcd(&frame[6], (long long)meter_level, 2); + frame[8] = 0xfd; + n = write(fd, frame, 9); + break; + } + + case 0x16: + switch (frame[5]) + { + case 0x5a: + if (frame[6] == 0xfe) + { + satmode = frame[6]; + } + else + { + frame[6] = satmode; + frame[7] = 0xfd; + n = write(fd, frame, 8); + } + + break; + } + + break; + + case 0x18: // miscellaneous things + frame[5] = 1; + frame[6] = 0xfd; + n = write(fd, frame, 7); + break; + + case 0x1a: // miscellaneous things + switch (frame[5]) + { + case 0x03: // width + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { frame[6] = filterA; } + + frame[7] = 0xfd; + n = write(fd, frame, 8); + break; + + case 0x04: // AGC TIME + printf("frame[6]==x%02x, frame[7]=0%02x\n", frame[6], frame[7]); + + if (frame[6] == 0xfd) // the we are reading + { + frame[6] = agc_time; + frame[7] = 0xfd; + n = write(fd, frame, 8); + } + else + { + printf("AGC_TIME RESPONSE******************************"); + agc_time = frame[6]; + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + } + + break; + + case 0x07: // satmode + frame[4] = 0; + frame[7] = 0xfd; + n = write(fd, frame, 8); + break; + + } + + break; + + case 0x1c: + switch (frame[5]) + { + case 0: + if (frame[6] == 0xfd) + { + frame[6] = ptt; + frame[7] = 0xfd; + n = write(fd, frame, 8); + } + else + { + ptt = frame[6]; + frame[7] = 0xfb; + frame[8] = 0xfd; + n = write(fd, frame, 9); + } + + break; + + } + + break; + + case 0x25: + frame[4] = 0xfa; + frame[5] = 0xfd; + break; + + case 0x26: + frame[4] = 0xfa; + frame[5] = 0xfd; + break; + + default: printf("cmd 0x%02x unknown\n", frame[4]); + } + + if (n == 0) { printf("Write failed?\n"); } + +// don't care about the rig type yet + +} + +#if defined(WIN32) || defined(_WIN32) +int openPort(char *comport) // doesn't matter for using pts devices +{ + int fd; + fd = open(comport, O_RDWR); + + if (fd < 0) + { + perror(comport); + } + + return fd; +} + +#else +int openPort(char *comport) // doesn't matter for using pts devices +{ + int fd = posix_openpt(O_RDWR); + char *name = ptsname(fd); + + if (name == NULL) + { + perror("pstname"); + return -1; + } + + printf("name=%s\n", name); + + if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1) + { + perror("posix_openpt"); + return -1; + } + + return fd; +} +#endif + +void rigStatus() +{ + char vfoa = current_vfo == RIG_VFO_A ? '*' : ' '; + char vfob = current_vfo == RIG_VFO_B ? '*' : ' '; + printf("%cVFOA: mode=%d filter=%d freq=%.0f\n", vfoa, modeA, + filterA, + freqA); + printf("%cVFOB: mode=%d filter=%d freq=%.0f\n", vfob, modeB, + filterA, + freqB); +} + +int main(int argc, char **argv) +{ + unsigned char buf[256]; + int fd = openPort(argv[1]); + + printf("%s: %s\n", argv[0], rig_version()); +#if defined(WIN32) || defined(_WIN32) + + if (argc != 2) + { + printf("Missing comport argument\n"); + printf("%s [comport]\n", argv[0]); + exit(1); + } + +#endif + + while (1) + { + int len = frameGet(fd, buf); + + if (len <= 0) + { + close(fd); + fd = openPort(argv[1]); + } + + if (powerstat) + { + frameParse(fd, buf, len); + } + else + { + usleep(1000 * 1000); + } + + rigStatus(); + } + + return 0; +} ----------------------------------------------------------------------- Summary of changes: NEWS | 30 +------ simulators/Makefile.am | 2 +- simulators/{simicom9700.c => simid5100.c} | 144 +++++------------------------- tests/Makefile.am | 4 - 4 files changed, 25 insertions(+), 155 deletions(-) copy simulators/{simicom9700.c => simid5100.c} (73%) hooks/post-receive -- Hamlib -- Ham radio control libraries |