[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 02a5f70200e589249bf89
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2024-05-08 10:06:47
|
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 02a5f70200e589249bf8958e6d4b4a3aa094e00a (commit) via e9fa4de2aeffb637b76a1440cc8207d242ec809a (commit) via fd69cb0487c491133a2cc1f231c73096b3369cc4 (commit) via 85d9d8d62c2575a0314d403c08f3e10d23dfa2f0 (commit) via fadf83a42c35e95b7c8a64037aeb08923cc92761 (commit) via 95f2e9b54678b0d83178ec3de6e0902db214fbfc (commit) via c2b8f2b4fe87b17568101a776305bd9e2af76405 (commit) via 42c900cb8a8ee1733aa39c6b808fa5bb2dd1118a (commit) via 9bcb4c4771649468dfafd4eb47da5c7c813b0dc2 (commit) via 44317e542bca8922a7cc69a68bee0560e9466540 (commit) via 424a34c504c90ae8839f076b23cfaed424b70980 (commit) via 74c96da18a6f4ee6159c4459b9614bbb7eaec14f (commit) via cc9bb6f0b54eaddf90fb6e1d32f1f0787b6eec04 (commit) via a5fa04f8847d94d18b17e2a7e51a0b0df2fdd663 (commit) via 85f78862863f24ff842edae95024b3d8409e360a (commit) via baeb484ddf1ae2a7aff811a0788f75c0762c87cc (commit) via 4e600a9ed67c6e627c495deeacbb65872f8eaec0 (commit) via 8002d470508135ce4b70c40e8b736ff436e9b7fc (commit) via 105c6b8d3942646d35a7af09d52e1cb73a5a8c8b (commit) via d683955811377ae1e47db526ae8d6a46928a1abf (commit) via e67c80f1217953f1bff20bd4483e48df3a266e03 (commit) via 594df4b31de374e1066dd27ddb510640f59d9531 (commit) via 8f1b6851e787a72f617e5e139f2a046413b5a5b7 (commit) via c7635ee3b14e7ec2c7ccba9bbb3ea81aa56685f2 (commit) via 94d753860b194b234324195681484e2efcc5d711 (commit) via 7b44297543ff0ff1c2b11b71fa17ecf33477e05b (commit) via abee6a3cb9f93c9456fbae8bcd3d44c9f22f07d1 (commit) from d47fb672c82aebce342cba8f0dd3b496ec536b9a (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 02a5f70200e589249bf8958e6d4b4a3aa094e00a Author: Mike Black W9MDB <mdb...@ya...> Date: Tue May 7 16:47:32 2024 -0500 Update some things for G90 diff --git a/rigs/icom/xiegu.c b/rigs/icom/xiegu.c index 8ec5ec7e9..3fc04385b 100644 --- a/rigs/icom/xiegu.c +++ b/rigs/icom/xiegu.c @@ -151,7 +151,8 @@ int xiegu_rig_open(RIG *rig) rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu Radio ID=0x%04x\n", __func__, iid); switch(iid) { - case 0x0090: rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu model %s\n", __func__, "G90/G90S");break; + case 0x0070: rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu model %s\n", __func__, "G90");break; + case 0x0090: rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu model %s\n", __func__, "G90S");break; case 0x0106: rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu model %s\n", __func__, "G106/G106C");break; case 0x6100: case 0xa400: rig_debug(RIG_DEBUG_VERBOSE, "%s: Xiegu model %s\n", __func__, "X6100");break; @@ -181,7 +182,7 @@ struct rig_caps x108g_caps = RIG_MODEL(RIG_MODEL_X108G), .model_name = "X108G", .mfg_name = "Xiegu", - .version = BACKEND_VER ".2", + .version = BACKEND_VER ".3", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -570,7 +571,7 @@ struct rig_caps g90_caps = .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, - .serial_rate_min = 300, + .serial_rate_min = 19200, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 1, commit e9fa4de2aeffb637b76a1440cc8207d242ec809a Author: Mike Black W9MDB <mdb...@ya...> Date: Mon May 6 06:58:52 2024 -0500 Disable TARGETABLE for G90 due to firmware bug https://github.com/Hamlib/Hamlib/issues/1547 diff --git a/rigs/icom/xiegu.c b/rigs/icom/xiegu.c index 2acee5a81..8ec5ec7e9 100644 --- a/rigs/icom/xiegu.c +++ b/rigs/icom/xiegu.c @@ -598,7 +598,8 @@ struct rig_caps g90_caps = .max_xit = Hz(9999), .max_ifshift = Hz(0), /* TODO */ .vfo_ops = X108G_VFO_OPS, - .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE, +// Disabling targetable_vfo as G90 firmare update has brokne it see https://github.com/Hamlib/Hamlib/issues/1547 +// .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE, .scan_ops = X108G_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 5, commit fd69cb0487c491133a2cc1f231c73096b3369cc4 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon May 6 06:35:40 2024 -0500 Have icom rigs fallback to old get mode when x26 has beeen disabled https://github.com/Hamlib/Hamlib/issues/1547 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index d30b70ed8..5660a9823 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2254,8 +2254,9 @@ static int icom_get_mode_x26(RIG *rig, vfo_t vfo, int *mode_len, const struct icom_priv_caps *priv_caps = rig->caps->priv; int retval; - if (priv->x26cmdfails > 0 && !priv_caps->x25x26_always) + if (priv->x26cmdfails != 0 && priv_caps->x25x26_always==0) { + rig_debug(RIG_DEBUG_WARN, "%s: x26cmdfails=%d, x25x26_always=%d\n", __func__, priv->x26cmdfails, priv_caps->x25x26_always); return -RIG_ENAVAIL; } @@ -2610,13 +2611,20 @@ static int icom_get_mode_without_data(RIG *rig, vfo_t vfo, rmode_t *mode, { retval = icom_get_mode_x26(rig, vfo, &mode_len, modebuf); - // mode_len=5, modebuf=26 01 01 01 01 - // last 3 bytes are mode, datamode, filter (1-3) - priv_data->datamode = modebuf[3]; - *width = priv_data->filter = modebuf[4]; - modebuf[1] = modebuf[2]; // copy mode to 2-byte format - modebuf[2] = modebuf[4]; // copy filter to 2-byte format - mode_len = 2; + if (retval == RIG_OK) + { + // mode_len=5, modebuf=26 01 01 01 01 + // last 3 bytes are mode, datamode, filter (1-3) + priv_data->datamode = modebuf[3]; + *width = priv_data->filter = modebuf[4]; + modebuf[1] = modebuf[2]; // copy mode to 2-byte format + modebuf[2] = modebuf[4]; // copy filter to 2-byte format + mode_len = 2; + } + else if (retval == -RIG_ENAVAIL) // In case it's been disabled + { + retval = icom_transaction(rig, C_RD_MODE, -1, NULL, 0, modebuf, &mode_len); + } } else { commit 85d9d8d62c2575a0314d403c08f3e10d23dfa2f0 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 5 22:17:17 2024 -0500 Make ignoring morse handler more generic diff --git a/src/rig.c b/src/rig.c index a898034de..f42aace5a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1494,8 +1494,8 @@ int HAMLIB_API rig_open(RIG *rig) if (skip_init) { return RIG_OK; } #if defined(HAVE_PTHREAD) - // Some models don't support CW - if (rig->caps->rig_model != RIG_MODEL_SDRCONSOLE) + // Some models don't support CW so don't need morse handler + if (rig->caps->send_morse) { status = morse_data_handler_start(rig); commit fadf83a42c35e95b7c8a64037aeb08923cc92761 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 5 17:28:29 2024 -0500 Update kenwood.h version diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index c8d57dbcf..ec2331ab8 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -28,7 +28,7 @@ #include "token.h" #include "idx_builtin.h" -#define BACKEND_VER "20240413" +#define BACKEND_VER "20240505" #define EOM_KEN ';' #define EOM_TH '\r' commit 95f2e9b54678b0d83178ec3de6e0902db214fbfc Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 5 17:19:22 2024 -0500 Change Xeigu G90 to not use 0x25/x26 since it misbehaves on latest firmware and is not documented either diff --git a/rigs/icom/xiegu.c b/rigs/icom/xiegu.c index 97efc7c0b..2acee5a81 100644 --- a/rigs/icom/xiegu.c +++ b/rigs/icom/xiegu.c @@ -543,12 +543,27 @@ struct rig_caps x6100_caps = .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; +static struct icom_priv_caps g90_priv_caps = +{ + 0xa4, /* default address */ + 0, /* 731 mode */ + 0, /* no XCHG */ + ic7200_ts_sc_list, + .x25x26_always = 0, + .x25x26_possibly = 0, // Firmware G90 v20240504.8 doesn't work well -- see https://github.com/Hamlib/Hamlib/issues/1547 + .x1cx03_always = 0, + .x1cx03_possibly = 0, + .x1ax03_supported = 0, + .mode_with_filter = 1, + .data_mode_supported = 1 +}; + struct rig_caps g90_caps = { RIG_MODEL(RIG_MODEL_G90), .model_name = "G90", .mfg_name = "Xiegu", - .version = BACKEND_VER ".7", + .version = BACKEND_VER ".9", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -667,7 +682,7 @@ struct rig_caps g90_caps = .set_conf = icom_set_conf, .get_conf = icom_get_conf, - .priv = (void *)& x108g_priv_caps, + .priv = (void *)& g90_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = xiegu_rig_open, commit c2b8f2b4fe87b17568101a776305bd9e2af76405 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 5 16:03:50 2024 -0500 Improve SDRCONSOLE behavior diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 64c80e267..e0f029721 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1115,11 +1115,15 @@ int kenwood_open(RIG *rig) } /* driver mismatch */ - rig_debug(RIG_DEBUG_VERBOSE, + // SDRCONSOLE identifies as TS-2000 -- even though it's a sub/superset + if (rig->caps->rig_model == RIG_MODEL_SDRCONSOLE && kenwood_id_string_list[i].model != 2014) + { + rig_debug(RIG_DEBUG_VERBOSE, "%s: not the right driver apparently (found %u, asked for %d, checked %s)\n", __func__, rig->caps->rig_model, kenwood_id_string_list[i].model, rig->caps->model_name); + } // we continue to search for other matching IDs/models } diff --git a/src/rig.c b/src/rig.c index cdb3d8e88..a898034de 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1494,14 +1494,18 @@ int HAMLIB_API rig_open(RIG *rig) if (skip_init) { return RIG_OK; } #if defined(HAVE_PTHREAD) - status = morse_data_handler_start(rig); - - if (status < 0) + // Some models don't support CW + if (rig->caps->rig_model != RIG_MODEL_SDRCONSOLE) { - rig_debug(RIG_DEBUG_ERR, "%s: cw_data_handler_start failed: %s\n", __func__, + status = morse_data_handler_start(rig); + + if (status < 0) + { + rig_debug(RIG_DEBUG_ERR, "%s: cw_data_handler_start failed: %s\n", __func__, rigerror(status)); - port_close(rp, rp->type.rig); - RETURNFUNC2(status); + port_close(rp, rp->type.rig); + RETURNFUNC2(status); + } } #endif commit 42c900cb8a8ee1733aa39c6b808fa5bb2dd1118a Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 4 22:57:25 2024 -0500 Fix default filter_width in icom.c diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 17d774329..d30b70ed8 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2699,7 +2699,7 @@ static int icom_get_mode_without_data(RIG *rig, vfo_t vfo, rmode_t *mode, * The DSP filter width can be read only for the selected VFO, so use cached width for other VFOs. */ - pbwidth_t filter_width; + pbwidth_t filter_width = 1; if (vfo == rig->state.current_vfo) { diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 8d17cfb34..212a35c2f 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -35,7 +35,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20240422" +#define BACKEND_VER "20240504" #define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31) #define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51) commit 9bcb4c4771649468dfafd4eb47da5c7c813b0dc2 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 4 17:36:02 2024 -0500 Fix micom set_freq to read ack back and get freq offsets diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index b66d99c51..7d26a30f4 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -92,10 +92,16 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) set_transaction_active(rig); rig_flush(rp); retval = write_block(rp, rxcmd, sizeof(rxcmd)); + micom_read_frame(rig, reply, sizeof(reply)); if (retval == RIG_OK) retval = write_block(rp, cmd2, sizeof(cmd2)); + micom_read_frame(rig, reply, sizeof(reply)); if (retval == RIG_OK) retval = write_block(rp, cmd3, sizeof(cmd3)); + micom_read_frame(rig, reply, sizeof(reply)); if (retval == RIG_OK) retval = write_block(rp, cmd4, sizeof(cmd4)); + micom_read_frame(rig, reply, sizeof(reply)); if (retval == RIG_OK) retval = write_block(rp, cmd5, sizeof(cmd5)); + micom_read_frame(rig, reply, sizeof(reply)); + micom_read_frame(rig, reply, sizeof(reply)); if (retval != RIG_OK) { @@ -163,7 +169,7 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) micom_read_frame(rig, reply, sizeof(reply)); write_block(rp, ack, sizeof(ack)); set_transaction_inactive(rig); - *freq = (reply[5] << 24) | (reply[6] << 16) | (reply[7] << 8) | reply[8]; + *freq = (reply[4] << 24) | (reply[5] << 16) | (reply[6] << 8) | reply[7]; RETURNFUNC(RIG_OK); } @@ -189,7 +195,7 @@ struct rig_caps micom_caps = RIG_MODEL(RIG_MODEL_MICOM2), .model_name = "Micom 2/3", .mfg_name = "Micom", - .version = "20240503.1", + .version = "20240504.0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, commit 44317e542bca8922a7cc69a68bee0560e9466540 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 4 08:44:19 2024 -0500 Make ft891 power level work like ft991 which supposedly is the same according to JA1NLX diff --git a/rigs/yaesu/ft891.c b/rigs/yaesu/ft891.c index 7a576e688..cbba6e96f 100644 --- a/rigs/yaesu/ft891.c +++ b/rigs/yaesu/ft891.c @@ -130,7 +130,7 @@ struct rig_caps ft891_caps = RIG_MODEL(RIG_MODEL_FT891), .model_name = "FT-891", .mfg_name = "Yaesu", - .version = NEWCAT_VER ".9", + .version = NEWCAT_VER ".10", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/rigs/yaesu/ft891.h b/rigs/yaesu/ft891.h index 58c3c294f..f61fcb247 100644 --- a/rigs/yaesu/ft891.h +++ b/rigs/yaesu/ft891.h @@ -69,13 +69,18 @@ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO) -// Borrowed from FLRig -- Thanks to Dave W1HKJ +// borrowed from FT991 #define FT891_RFPOWER_METER_CAL \ { \ - 2, \ + 7, \ { \ {0, 0.0f}, \ - {100, 100.0f}, \ + {10, 0.8f}, \ + {50, 8.0f}, \ + {100, 26.0f}, \ + {150, 54.0f}, \ + {200, 92.0f}, \ + {250, 140.0f}, \ } \ } commit 424a34c504c90ae8839f076b23cfaed424b70980 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri May 3 17:16:25 2024 -0500 More work on micom get_freq diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index 7c60bcd7e..b66d99c51 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -137,6 +137,7 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { hamlib_port_t *rp = RIGPORT(rig); unsigned char cmd[6] = { 0x24, 0x01, 0x18, 0x06, 0x06, 0x03 }; + unsigned char ack[6] = { 0x24, 0x01, 0x18, 0xf3, 0xff, 0x03 }; unsigned char reply[11]; int retval; @@ -153,7 +154,14 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return retval; } + // expecting 24 01 80 fe 98 03 -- an ack packet? micom_read_frame(rig, reply, sizeof(reply)); + if (reply[3] != 0xfe) + { + rig_debug(RIG_DEBUG_ERR, "%s: unknown packet...expected byte 4 = 0xfe\n", __func__); + } + micom_read_frame(rig, reply, sizeof(reply)); + write_block(rp, ack, sizeof(ack)); set_transaction_inactive(rig); *freq = (reply[5] << 24) | (reply[6] << 16) | (reply[7] << 8) | reply[8]; RETURNFUNC(RIG_OK); @@ -181,7 +189,7 @@ struct rig_caps micom_caps = RIG_MODEL(RIG_MODEL_MICOM2), .model_name = "Micom 2/3", .mfg_name = "Micom", - .version = "20240503.0", + .version = "20240503.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, commit 74c96da18a6f4ee6159c4459b9614bbb7eaec14f Author: Mike Black W9MDB <mdb...@ya...> Date: Fri May 3 07:52:55 2024 -0500 Fix micom get_freq diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index ff8a96bb6..7c60bcd7e 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -41,16 +41,26 @@ static int micom_open(RIG *rig) RETURNFUNC(RIG_OK); } +// returns bytes read +// format has length in byte[1] plus 5 bytes 0x24/len/cmd at start and checksum+0x03 at end +// So a data "length" of 5 is 10 bytes for example static int micom_read_frame(RIG *rig, unsigned char *buf, int maxlen) { hamlib_port_t *rp = RIGPORT(rig); - int retval; + int bytes; //const char stopset[1] = {0x03}; ENTERFUNC; - retval = read_block(rp, buf, 4); - retval = read_block(rp, buf, buf[1]+1); - rig_debug(RIG_DEBUG_VERBOSE, "%s: retval=%d\n", __func__, retval); - RETURNFUNC(retval); + bytes = read_block(rp, buf, 3); + if (bytes+buf[1]+2 > maxlen) + { + rig_debug(RIG_DEBUG_ERR, "%s: buffer overrun...expected max of %d, got %d\n", + __func__, maxlen, bytes+buf[1]+2); + dump_hex(buf,bytes); + RETURNFUNC(-RIG_EPROTO); + } + bytes += read_block(rp, &buf[3], buf[1]+2); + dump_hex(buf,bytes); + RETURNFUNC(bytes); } /* Example of set of commands that works @@ -129,7 +139,6 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) unsigned char cmd[6] = { 0x24, 0x01, 0x18, 0x06, 0x06, 0x03 }; unsigned char reply[11]; int retval; - int ifreq; cmd[4] = checksum(cmd,4); set_transaction_active(rig); @@ -146,8 +155,7 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) micom_read_frame(rig, reply, sizeof(reply)); set_transaction_inactive(rig); - ifreq = (reply[5] << 24) | (reply[6] << 16) | (reply[7] << 8) | reply[8]; - *freq = ifreq * 1000; + *freq = (reply[5] << 24) | (reply[6] << 16) | (reply[7] << 8) | reply[8]; RETURNFUNC(RIG_OK); } @@ -173,7 +181,7 @@ struct rig_caps micom_caps = RIG_MODEL(RIG_MODEL_MICOM2), .model_name = "Micom 2/3", .mfg_name = "Micom", - .version = "20240502.0", + .version = "20240503.0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/simulators/simmicom.c b/simulators/simmicom.c index 70f5b0019..1cfb6a4d4 100644 --- a/simulators/simmicom.c +++ b/simulators/simmicom.c @@ -15,6 +15,7 @@ struct ip_mreq #include <string.h> #include <unistd.h> #include "../include/hamlib/rig.h" +#include "../src/misc.h" #define BUFSIZE 256 @@ -114,6 +115,10 @@ again: { case 0x06: printf("Report receiver freq\n"); + unsigned char cmd[11] = { 0x24,0x06,0x18,0x05,0x01,0x00,0x38,0xea,0x50,0xba,0x03}; + dump_hex(cmd, 11); + int n = write(fd, cmd, sizeof(cmd)); + printf("%d bytes sent\n", n); break; case 0x13: printf("PTT On\n"); @@ -121,6 +126,9 @@ again: case 0x14: printf("PTT Off\n"); break; + case 0x36: + printf("Key request\n"); + break; default: printf("Unknown cmd=%02x\n", buf[3]); } commit cc9bb6f0b54eaddf90fb6e1d32f1f0787b6eec04 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu May 2 08:20:02 2024 -0500 Another attempt at micom get/set freq diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index c86f28485..ff8a96bb6 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -45,18 +45,30 @@ static int micom_read_frame(RIG *rig, unsigned char *buf, int maxlen) { hamlib_port_t *rp = RIGPORT(rig); int retval; - const char stopset[1] = {0x03}; + //const char stopset[1] = {0x03}; ENTERFUNC; - retval = read_string_direct(rp, buf, maxlen, stopset, 1, 0, 12); + retval = read_block(rp, buf, 4); + retval = read_block(rp, buf, buf[1]+1); rig_debug(RIG_DEBUG_VERBOSE, "%s: retval=%d\n", __func__, retval); RETURNFUNC(retval); } +/* Example of set of commands that works +24 06 18 05 01 00 38 ea 50 ba 03 15 +24 05 18 36 fe 7b ef 01 e0 03 15 +24 05 18 36 ff 7b ef 01 e1 03 15 +24 05 18 36 df 7b ef 01 c1 03 15 +24 05 18 36 ff 7b ef 01 e1 03 +*/ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { hamlib_port_t *rp = RIGPORT(rig); - unsigned char rxcmd[11] = { 0x24, 0x06, 0x18, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; - unsigned char txcmd[11] = { 0x24, 0x05, 0x81, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; + unsigned char rxcmd[12] = { 0x24, 0x06, 0x18, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x15 }; + unsigned char cmd2[11] = { 0x24, 0x05, 0x18, 0x36, 0xfe, 0x7b, 0xef, 0x01, 0xe0, 0x03, 0x15 }; + unsigned char cmd3[11] = { 0x24, 0x05, 0x18, 0x36, 0xfe, 0x7b, 0xef, 0x01, 0xe1, 0x03, 0x15 }; + unsigned char cmd4[11] = { 0x24, 0x05, 0x18, 0x36, 0xdf, 0x7b, 0xef, 0x01, 0xc1, 0x03, 0x15 }; + unsigned char cmd5[10] = { 0x24, 0x05, 0x18, 0x36, 0xff, 0x7b, 0xef, 0x01, 0xe1, 0x03 }; + //unsigned char txcmd[11] = { 0x24, 0x05, 0x81, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; unsigned int ifreq = freq; unsigned char reply[11]; int retval; @@ -69,8 +81,11 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) set_transaction_active(rig); rig_flush(rp); -#if 0 retval = write_block(rp, rxcmd, sizeof(rxcmd)); + if (retval == RIG_OK) retval = write_block(rp, cmd2, sizeof(cmd2)); + if (retval == RIG_OK) retval = write_block(rp, cmd3, sizeof(cmd3)); + if (retval == RIG_OK) retval = write_block(rp, cmd4, sizeof(cmd4)); + if (retval == RIG_OK) retval = write_block(rp, cmd5, sizeof(cmd5)); if (retval != RIG_OK) { @@ -82,13 +97,11 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) micom_read_frame(rig, reply, sizeof(reply)); -#endif -#if 0 +#if 0 // this method doesn't work txcmd[5] = (ifreq >> 16) & 0xff; txcmd[6] = (ifreq >> 8) & 0xff; txcmd[7] = ifreq & 0xff; txcmd[8] = checksum(txcmd, 8); -#endif txcmd[5] = (ifreq >> 24) & 0xff; txcmd[6] = (ifreq >> 16) & 0xff; txcmd[7] = (ifreq >> 8) & 0xff; @@ -105,7 +118,7 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return retval; } - micom_read_frame(rig, reply, sizeof(reply)); +#endif set_transaction_inactive(rig); return retval; } @@ -160,7 +173,7 @@ struct rig_caps micom_caps = RIG_MODEL(RIG_MODEL_MICOM2), .model_name = "Micom 2/3", .mfg_name = "Micom", - .version = "20240429.0", + .version = "20240502.0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, commit a5fa04f8847d94d18b17e2a7e51a0b0df2fdd663 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 1 16:33:17 2024 -0500 Add another flush to micom.c diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index 0179efebd..c86f28485 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -120,6 +120,7 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) cmd[4] = checksum(cmd,4); set_transaction_active(rig); + rig_flush(rp); retval = write_block(rp, cmd, sizeof(cmd)); if (retval != RIG_OK) @@ -172,6 +173,7 @@ struct rig_caps micom_caps = .serial_stop_bits = 2, .serial_parity = RIG_PARITY_ODD, .serial_handshake = RIG_HANDSHAKE_NONE, + .timeout = 500, .rig_open = micom_open, .set_freq = micom_set_freq, .get_freq = micom_get_freq, commit 85f78862863f24ff842edae95024b3d8409e360a Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 1 16:29:48 2024 -0500 Another attempt at micom set_freq diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index ad2d6e428..0179efebd 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -56,8 +56,8 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { hamlib_port_t *rp = RIGPORT(rig); unsigned char rxcmd[11] = { 0x24, 0x06, 0x18, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; - unsigned char txcmd[10] = { 0x24, 0x05, 0x18, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03 }; - unsigned int ifreq = freq / 1000; + unsigned char txcmd[11] = { 0x24, 0x05, 0x81, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; + unsigned int ifreq = freq; unsigned char reply[11]; int retval; @@ -83,10 +83,17 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) micom_read_frame(rig, reply, sizeof(reply)); #endif +#if 0 txcmd[5] = (ifreq >> 16) & 0xff; txcmd[6] = (ifreq >> 8) & 0xff; txcmd[7] = ifreq & 0xff; txcmd[8] = checksum(txcmd, 8); +#endif + txcmd[5] = (ifreq >> 24) & 0xff; + txcmd[6] = (ifreq >> 16) & 0xff; + txcmd[7] = (ifreq >> 8) & 0xff; + txcmd[8] = ifreq & 0xff; + txcmd[9] = checksum(rxcmd, 9); retval = write_block(rp, txcmd, sizeof(txcmd)); micom_read_frame(rig, reply, sizeof(reply)); commit baeb484ddf1ae2a7aff811a0788f75c0762c87cc Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 1 08:34:01 2024 -0500 Change micom to odd parity diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index b4f7ad077..ad2d6e428 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -46,8 +46,10 @@ static int micom_read_frame(RIG *rig, unsigned char *buf, int maxlen) hamlib_port_t *rp = RIGPORT(rig); int retval; const char stopset[1] = {0x03}; + ENTERFUNC; retval = read_string_direct(rp, buf, maxlen, stopset, 1, 0, 12); - return retval; + rig_debug(RIG_DEBUG_VERBOSE, "%s: retval=%d\n", __func__, retval); + RETURNFUNC(retval); } static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) @@ -161,7 +163,7 @@ struct rig_caps micom_caps = .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, - .serial_parity = RIG_PARITY_EVEN, + .serial_parity = RIG_PARITY_ODD, .serial_handshake = RIG_HANDSHAKE_NONE, .rig_open = micom_open, .set_freq = micom_set_freq, commit 4e600a9ed67c6e627c495deeacbb65872f8eaec0 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 30 22:41:06 2024 -0500 For Micom see if setting transmit freq is all we need -- setting Rx freq, then Tx isn't working diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index 8773e1edb..b4f7ad077 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -57,6 +57,7 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) unsigned char txcmd[10] = { 0x24, 0x05, 0x18, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03 }; unsigned int ifreq = freq / 1000; unsigned char reply[11]; + int retval; rxcmd[5] = (ifreq >> 24) & 0xff; rxcmd[6] = (ifreq >> 16) & 0xff; @@ -66,7 +67,8 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) set_transaction_active(rig); rig_flush(rp); - int retval = write_block(rp, rxcmd, sizeof(rxcmd)); +#if 0 + retval = write_block(rp, rxcmd, sizeof(rxcmd)); if (retval != RIG_OK) { @@ -78,6 +80,7 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) micom_read_frame(rig, reply, sizeof(reply)); +#endif txcmd[5] = (ifreq >> 16) & 0xff; txcmd[6] = (ifreq >> 8) & 0xff; txcmd[7] = ifreq & 0xff; commit 8002d470508135ce4b70c40e8b736ff436e9b7fc Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 30 17:28:37 2024 -0500 Fix micom set_freq for correct checksum diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index ca9a01239..8773e1edb 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -106,6 +106,7 @@ static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int retval; int ifreq; + cmd[4] = checksum(cmd,4); set_transaction_active(rig); retval = write_block(rp, cmd, sizeof(cmd)); @@ -149,7 +150,7 @@ struct rig_caps micom_caps = .version = "20240429.0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, - .rig_type = RIG_TYPE_OTHER, + .rig_type = RIG_TYPE_TRANSCEIVER, .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE, .ptt_type = RIG_PTT_RIG, .port_type = RIG_PORT_SERIAL, @@ -158,8 +159,10 @@ struct rig_caps micom_caps = .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_EVEN, + .serial_handshake = RIG_HANDSHAKE_NONE, .rig_open = micom_open, .set_freq = micom_set_freq, .get_freq = micom_get_freq, - .set_ptt = micom_set_ptt + .set_ptt = micom_set_ptt, + .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; commit 105c6b8d3942646d35a7af09d52e1cb73a5a8c8b Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 30 17:28:03 2024 -0500 Add simmicom.c diff --git a/simulators/Makefile.am b/simulators/Makefile.am index 12c290686..74fb40224 100644 --- a/simulators/Makefile.am +++ b/simulators/Makefile.am @@ -8,7 +8,7 @@ DISTCLEANFILES = bin_PROGRAMS = -check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000 simtmd710 simts890 simxiegux108g simxiegux6100 simic910 simft450 simelecraftk4 +check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000 simtmd710 simts890 simxiegux108g simxiegux6100 simic910 simft450 simelecraftk4 simmicom simelecraft_SOURCES = simelecraft.c simkenwood_SOURCES = simkenwood.c diff --git a/simulators/simmicom.c b/simulators/simmicom.c new file mode 100644 index 000000000..70f5b0019 --- /dev/null +++ b/simulators/simmicom.c @@ -0,0 +1,130 @@ +// can run this using rigctl/rigctld and socat pty devices +// gcc -o simspid simspid.c +#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 <fcntl.h> +#include <string.h> +#include <unistd.h> +#include "../include/hamlib/rig.h" + +#define BUFSIZE 256 + +float freqA = 14074000; +float freqB = 14074500; +char tx_vfo = '0'; +char rx_vfo = '0'; +char modeA = '1'; +char modeB = '1'; +int width_main = 500; +int width_sub = 700; + + +int +getmyline(int fd, unsigned char *buf) +{ + int i = 0; + int n = 0; + memset(buf, 0, BUFSIZE); + + n = read(fd, buf, 4); + + if (n <= 0) { sleep(1); return 0;} + + int bytesToRead = buf[1] + 2; //; len does not include cksum, or eom + n += read(fd, &buf[4], bytesToRead); + printf("n=%d:", n); + + for (i = 0; i < n; ++i) + { + printf(" %02x", buf[i]); + } + + printf("\n"); + return n; +} + +#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 + + + +int main(int argc, char *argv[]) +{ + unsigned char buf[256]; + + +again: + int fd = openPort(argv[1]); + + while (1) + { + int bytes = getmyline(fd, buf); + + if (bytes == 0) + { + close(fd); + goto again; + } + + switch (buf[3]) + { + case 0x06: + printf("Report receiver freq\n"); + break; + case 0x13: + printf("PTT On\n"); + break; + case 0x14: + printf("PTT Off\n"); + break; + + default: printf("Unknown cmd=%02x\n", buf[3]); + } + } + + return 0; +} commit d683955811377ae1e47db526ae8d6a46928a1abf Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 30 10:39:30 2024 -0500 Fix set_freq for micom.c diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index adb88f06a..ca9a01239 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -81,7 +81,7 @@ static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) txcmd[5] = (ifreq >> 16) & 0xff; txcmd[6] = (ifreq >> 8) & 0xff; txcmd[7] = ifreq & 0xff; - rxcmd[8] = checksum(txcmd, 8); + txcmd[8] = checksum(txcmd, 8); retval = write_block(rp, txcmd, sizeof(txcmd)); micom_read_frame(rig, reply, sizeof(reply)); commit e67c80f1217953f1bff20bd4483e48df3a266e03 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Apr 29 23:40:35 2024 -0500 Add get_freq and set_freq for micom diff --git a/rigs/motorola/micom.c b/rigs/motorola/micom.c index 43ad9b11f..adb88f06a 100644 --- a/rigs/motorola/micom.c +++ b/rigs/motorola/micom.c @@ -23,7 +23,17 @@ #include <misc.h> #include <iofunc.h> -static freq_t freqA = 14074000; +// char* to start of checksum for len bytes +unsigned int checksum(unsigned char *buf, int len) +{ + int checksum = 0; + int i; + + // simple 1-byte checksum + for (i = 0; i < len; ++i) { checksum += buf[i]; } + + return checksum & 0xff; +} static int micom_open(RIG *rig) { @@ -31,15 +41,86 @@ static int micom_open(RIG *rig) RETURNFUNC(RIG_OK); } +static int micom_read_frame(RIG *rig, unsigned char *buf, int maxlen) +{ + hamlib_port_t *rp = RIGPORT(rig); + int retval; + const char stopset[1] = {0x03}; + retval = read_string_direct(rp, buf, maxlen, stopset, 1, 0, 12); + return retval; +} + static int micom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { - freqA = freq; - RETURNFUNC(RIG_OK); + hamlib_port_t *rp = RIGPORT(rig); + unsigned char rxcmd[11] = { 0x24, 0x06, 0x18, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; + unsigned char txcmd[10] = { 0x24, 0x05, 0x18, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03 }; + unsigned int ifreq = freq / 1000; + unsigned char reply[11]; + + rxcmd[5] = (ifreq >> 24) & 0xff; + rxcmd[6] = (ifreq >> 16) & 0xff; + rxcmd[7] = (ifreq >> 8) & 0xff; + rxcmd[8] = ifreq & 0xff; + rxcmd[9] = checksum(rxcmd, 9); + + set_transaction_active(rig); + rig_flush(rp); + int retval = write_block(rp, rxcmd, sizeof(rxcmd)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: write_block err: %s\n", __func__, + rigerror(retval)); + set_transaction_inactive(rig); + return retval; + } + + micom_read_frame(rig, reply, sizeof(reply)); + + txcmd[5] = (ifreq >> 16) & 0xff; + txcmd[6] = (ifreq >> 8) & 0xff; + txcmd[7] = ifreq & 0xff; + rxcmd[8] = checksum(txcmd, 8); + retval = write_block(rp, txcmd, sizeof(txcmd)); + micom_read_frame(rig, reply, sizeof(reply)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: write_block err: %s\n", __func__, + rigerror(retval)); + set_transaction_inactive(rig); + return retval; + } + + micom_read_frame(rig, reply, sizeof(reply)); + set_transaction_inactive(rig); + return retval; } static int micom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { - *freq = freqA; + hamlib_port_t *rp = RIGPORT(rig); + unsigned char cmd[6] = { 0x24, 0x01, 0x18, 0x06, 0x06, 0x03 }; + unsigned char reply[11]; + int retval; + int ifreq; + + set_transaction_active(rig); + retval = write_block(rp, cmd, sizeof(cmd)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: write_block err: %s\n", __func__, + rigerror(retval)); + set_transaction_inactive(rig); + return retval; + } + + micom_read_frame(rig, reply, sizeof(reply)); + set_transaction_inactive(rig); + ifreq = (reply[5] << 24) | (reply[6] << 16) | (reply[7] << 8) | reply[8]; + *freq = ifreq * 1000; RETURNFUNC(RIG_OK); } @@ -48,17 +129,16 @@ static int micom_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) hamlib_port_t *rp = RIGPORT(rig); unsigned char on[] = { 0x24, 0x02, 0x81, 0x13, 0x01, 0xBB, 0x03 }; unsigned char off[] = { 0x24, 0x02, 0x81, 0x14, 0x01, 0xBC, 0x03 }; + int retval; + set_transaction_active(rig); rig_flush(rp); - int retval = write_block(rp, ptt ? on : off, sizeof(on)); - if (retval != RIG_OK) - { - set_transaction_inactive(rig); - RETURNFUNC(retval); - } + retval = write_block(rp, ptt ? on : off, sizeof(on)); + + set_transaction_inactive(rig); - return RIG_OK; + return retval; } struct rig_caps micom_caps = @@ -66,7 +146,7 @@ struct rig_caps micom_caps = RIG_MODEL(RIG_MODEL_MICOM2), .model_name = "Micom 2/3", .mfg_name = "Micom", - .version = "20240428.0", + .version = "20240429.0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_OTHER, commit 594df4b31de374e1066dd27ddb510640f59d9531 Merge: c7635ee3b 8f1b6851e Author: Michael Black <mdb...@ya...> Date: Sun Apr 28 17:06:20 2024 -0500 Merge pull request #1544 from N0NB/update_win_build_scripts Sync local build scripts with main repository commit 8f1b6851e787a72f617e5e139f2a046413b5a5b7 Author: Nate Bargmann <n0...@n0...> Date: Sun Apr 28 16:23:35 2024 -0500 Sync local build scripts with main repository Updates for including libgcc* provided by MinGW in Debian 11 and Debian 12 (untested). Include other updates added to the build virtual machine along the way. diff --git a/scripts/build-w32.sh b/scripts/build-w32.sh index de7f17607..8414faf1f 100755 --- a/scripts/build-w32.sh +++ b/scripts/build-w32.sh @@ -14,14 +14,17 @@ BUILD_DIR=~/builds # Set this to LibUSB archive extracted in $BUILD_DIR -LIBUSB_VER=libusb-1.0.22 +LIBUSB_VER=libusb-1.0.24 -# Set to the correct HOST_ARCH= line for your minGW installation +# Set to the correct HOST_ARCH= line for your MinGW installation HOST_ARCH=i686-w64-mingw32 -# Set to the strip name for your version of minGW +# Set to the strip name for your version of MinGW HOST_ARCH_STRIP=i686-w64-mingw32-strip +# Set to the dlltool name for your version of MinGW +HOST_ARCH_DLLTOOL=i686-w64-mingw32-dlltool + # Error return codes. See /usr/include/sysexits.h EX_USAGE=64 EX_NOINPUT=66 @@ -176,6 +179,10 @@ 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 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. +If this file does not work for your project, follow the steps in the following +section: + For linking the library with MS Visual C++ 2003, from the directory you installed Hamlib run the following commands to generate the libhamlib-4.lib file needed for linking with your MSVC project: @@ -186,15 +193,12 @@ c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:i3 To do the same for Visual Studio 2017: cd lib\msvc -"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe" /lib /machine:i386 /def:libhamlib-4.def +c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def -and for VS 2019: +For VS 2019: cd lib\msvc -"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x86\bin\link.exe" /lib /machine:i386 /def:libhamlib-4.def - -cd lib/msvc -"c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x86\link.exe" /lib /machine:i386 /def:libhamlib-4.def +c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def NOTE: feedback is requested on the previous two command examples! @@ -212,6 +216,7 @@ Please report problems or success to ham...@li... Cheers, Stephane Fillod - F8CFE +Mike Black - W9MDB Nate Bargmann - N0NB http://www.hamlib.org @@ -232,9 +237,9 @@ make -j 4 install 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 +todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. -#todos ${ZIP_DIR}/include/hamlib/*.h +todos ${ZIP_DIR}/include/hamlib/*.h # C++ binding is useless on w32 because of ABI for f in *class.h @@ -287,4 +292,21 @@ then cp -a ${FILE} ${ZIP_DIR}/bin/. fi +# Required for MinGW with GCC 10 (Debian 11) +FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" +if test -f "$FILE" +then + cp -a ${FILE} ${ZIP_DIR}/bin/. +fi + +# Required for MinGW with GCC 12 (Debian 12) +FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" +if test -f "$FILE" +then + cp -a ${FILE} ${ZIP_DIR}/bin/. +fi + +# Generate .lib file for MSVC +${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/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 eb302f135..fff9b6241 100755 --- a/scripts/build-w64.sh +++ b/scripts/build-w64.sh @@ -14,14 +14,17 @@ BUILD_DIR=~/builds # Set this to LibUSB archive extracted in $BUILD_DIR -LIBUSB_VER=libusb-1.0.22 +LIBUSB_VER=libusb-1.0.24 -# Set to the correct HOST_ARCH= line for your minGW installation +# Set to the correct HOST_ARCH= line for your MinGW installation HOST_ARCH=x86_64-w64-mingw32 -# Set to the strip name for your version of minGW +# Set to the strip name for your version of MinGW HOST_ARCH_STRIP=x86_64-w64-mingw32-strip +# Set to the dlltool name for your version of MinGW +HOST_ARCH_DLLTOOL=x86_64-w64-mingw32-dlltool + # Error return codes. See /usr/include/sysexits.h EX_USAGE=64 EX_NOINPUT=66 @@ -176,6 +179,10 @@ 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 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. +If this file does not work for your project, follow the steps in the following +section: + For linking the library with MS Visual C++ 2003, from the directory you installed Hamlib run the following commands to generate the libhamlib-4.lib file needed for linking with your MSVC project: @@ -196,6 +203,11 @@ c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.2 NOTE: feedback is requested on the previous two command examples as these do not appear to be correct to generate a 64 bit libhamlib-4.lib file! +For VS 2022: + +cd lib/msvc +c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x86\link.exe /lib /machine:i386 /def:libhamlib-4.def + The published Hamlib API may be found at: http://hamlib.sourceforge.net/manuals/4.1/index.html @@ -210,6 +222,7 @@ Please report problems or success to ham...@li... Cheers, Stephane Fillod - F8CFE +Mike Black - W9MDB Nate Bargmann - N0NB http://www.hamlib.org @@ -285,4 +298,21 @@ then cp -a ${FILE} ${ZIP_DIR}/bin/. fi +# Required for MinGW with GCC 10 (Debian 11) +FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" +if test -f "$FILE" +then + cp -a ${FILE} ${ZIP_DIR}/bin/. +fi + +# Required for MinGW with GCC 12 (Debian 12) +FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" +if test -f "$FILE" +then + cp -a ${FILE} ${ZIP_DIR}/bin/. +fi + +# Generate .lib file for MSVC +${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/libhamlib-4.lib + /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) commit c7635ee3b14e7ec2c7ccba9bbb3ea81aa56685f2 Merge: 7b4429754 94d753860 Author: Nate Bargmann <n0...@n0...> Date: Sun Apr 28 15:49:15 2024 -0500 Merge pull request #1543 from N0NB/update_win_build_scripts REALLY include README.md in archive commit 94d753860b194b234324195681484e2efcc5d711 Author: Nate Bargmann <n0...@n0...> Date: Sun Apr 28 15:47:08 2024 -0500 REALLY include README.md in archive Teach me not to test before committing and pushing... diff --git a/Makefile.am b/Makefile.am index 7dff7c0d0..398b1f812 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ aclocal_DATA = hamlib.m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = hamlib.pc -EXTRA_DIST = PLAN LICENSE hamlib.m4 hamlib.pc.in README.developer \ +EXTRA_DIST = PLAN LICENSE hamlib.m4 hamlib.pc.in README.md README.developer \ README.betatester README.freqranges README.multicast README.osx \ Android.mk commit 7b44297543ff0ff1c2b11b71fa17ecf33477e05b Merge: d47fb672c abee6a3cb Author: Nate Bargmann <n0...@n0...> Date: Sun Apr 28 15:36:03 2024 -0500 Merge pull request #1542 from N0NB/update_win_build_scripts Distribute README.md instead of README commit abee6a3cb9f93c9456fbae8bcd3d44c9f22f07d1 Author: Nate Bargmann <n0...@n0...> Date: Sun Apr 28 15:31:16 2024 -0500 Distribute README.md instead of README README.md has replaced README as the main introductory file. diff --git a/Makefile.am b/Makefile.am index b854d504c..7dff7c0d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,7 @@ EXTRA_DIST = PLAN LICENSE hamlib.m4 hamlib.pc.in README.developer \ Android.mk doc_DATA = ChangeLog COPYING COPYING.LIB LICENSE \ - README README.betatester README.developer + README.md README.betatester README.developer SUBDIRS = macros include lib security \ $(BACKEND_LIST) \ ----------------------------------------------------------------------- Summary of changes: Makefile.am | 4 +- rigs/icom/icom.c | 26 ++++-- rigs/icom/icom.h | 2 +- rigs/icom/xiegu.c | 29 +++++-- rigs/kenwood/kenwood.c | 6 +- rigs/kenwood/kenwood.h | 2 +- rigs/motorola/micom.c | 162 +++++++++++++++++++++++++++++++---- rigs/yaesu/ft891.c | 2 +- rigs/yaesu/ft891.h | 11 ++- scripts/build-w32.sh | 44 +++++++--- scripts/build-w64.sh | 36 +++++++- simulators/Makefile.am | 2 +- simulators/{simspid.c => simmicom.c} | 48 +++++++---- src/rig.c | 16 ++-- 14 files changed, 313 insertions(+), 77 deletions(-) copy simulators/{simspid.c => simmicom.c} (63%) hooks/post-receive -- Hamlib -- Ham radio control libraries |