[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. c939f1a83ac1b7ad1bb90
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2025-02-09 20:54:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via c939f1a83ac1b7ad1bb903120da13f19b468e4be (commit) via a0df573df760ea8c137a26581d46d46abaf5a6c0 (commit) via 6e704c5bc8a374af5db07e76a7a11c15463540ed (commit) via 5ecc1934fc338608c46267df584c903fb847b751 (commit) via 62e44940cfa8d6ff365cb931f6e387398b26a62b (commit) via 19dce9fd1b515002fb64976d151e9bb05970e614 (commit) via 9ffbf632903d5642d4ceb2bb322baab671fed6be (commit) via 93c5267dfbf0c084f75b65165e2fe5a5167d81f7 (commit) via 79f5a08210d94e26eb7908a16ad53fa10d9936a0 (commit) via 62071273aae744b8dedf739be2ae1575f75a51a2 (commit) via 1813820dd3f2d0547190208979498c9fde449483 (commit) via 0e36ee79fe36750d77d1a021c5baaf892dbf5813 (commit) via 27f009da4c2b3781f467d1d1bea21f8776e2b1a6 (commit) via e44da73e9a0714efab2c67f6f15904f7116b612e (commit) via 2ed2a998e3d0d932afa184831d469f090fce50fe (commit) via 194e18f4e45c1afabeed7f838f32407851474239 (commit) via 8309616e9b6d293d3354444ad9b83a0b9f7b0ffb (commit) via 710dfea56e79bee7ef41d060153d9e22efdf9c61 (commit) from bb4eb78d22c312e708cf21a614019970f023b5a4 (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 c939f1a83ac1b7ad1bb903120da13f19b468e4be Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Feb 5 08:01:14 2025 -0600 Add missing levels for IC746/Pro RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_SWR|RIG_LEVEL_ALC diff --git a/NEWS b/NEWS index eb4c0c89a..d30dfad21 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ Version 5.x -- future * Change FT1000MP Mark V model names to align with FT1000MP Version 4.6.2 + * Add missing levels for IC746/PRO RIG_LEVEL_RFPOWER_METER,RIG_LEVEL_RFPOWER_METER_WATTS,RIG_LEVEL_SWR,RIG_LEVEL_ALC * Fix IC905 for gpredict * Fix potential segfault on QMX * Fix pmr171 diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index f8386e41b..6ace9675b 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -54,7 +54,7 @@ #define IC746_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_RF|RIG_FUNC_ANF|RIG_FUNC_APF|RIG_FUNC_RESUME|RIG_FUNC_ARO) -#define IC746_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_APF|RIG_LEVEL_AGC_TIME) +#define IC746_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_APF|RIG_LEVEL_AGC_TIME|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC746_GET_PARM (RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define IC746_SET_PARM (RIG_PARM_BACKLIGHT|RIG_PARM_BEEP|RIG_PARM_ANN) @@ -181,7 +181,7 @@ struct rig_caps ic746_caps = RIG_MODEL(RIG_MODEL_IC746), .model_name = "IC-746", .mfg_name = "Icom", - .version = BACKEND_VER ".4", + .version = BACKEND_VER ".5", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, commit a0df573df760ea8c137a26581d46d46abaf5a6c0 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Feb 4 11:45:56 2025 -0600 Reduce good news about serial port to verbose diff --git a/src/serial.c b/src/serial.c index 2d6fd5a7c..6fdecc739 100644 --- a/src/serial.c +++ b/src/serial.c @@ -242,7 +242,7 @@ int HAMLIB_API serial_open(hamlib_port_t *rp) return -RIG_EIO; case SER_AVAILABLE: - rig_debug(RIG_DEBUG_ERR, "%s: serial port %s is OK\n", __func__, rp->pathname); + rig_debug(RIG_DEBUG_VERBOSE, "%s: serial port %s is OK\n", __func__, rp->pathname); break; } commit 6e704c5bc8a374af5db07e76a7a11c15463540ed Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Jan 31 07:29:04 2025 -0600 Update NEWS diff --git a/NEWS b/NEWS index 03f5ee844..eb4c0c89a 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,11 @@ Version 5.x -- future * rot_get_conf deprecated and replaced by rot_get_conf2 * Change FT1000MP Mark V model names to align with FT1000MP +Version 4.6.2 + * Fix IC905 for gpredict + * Fix potential segfault on QMX + * Fix pmr171 + Version 4.6.1 * Fix C++ builds failing on rig_list_foreach function * Fix IC9100 rigctld startup to end up on VFOA commit 5ecc1934fc338608c46267df584c903fb847b751 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jan 30 22:59:01 2025 -0600 Add IC910 to Icom exceptions in rig.c diff --git a/src/rig.c b/src/rig.c index a380cf18a..739a17fce 100644 --- a/src/rig.c +++ b/src/rig.c @@ -169,6 +169,8 @@ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */ #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !STATE((r))->comm_state) #define CHECK_RIG_CAPS(r) (!(r) || !(r)->caps) +#define ICOM_EXCEPTIONS (rig->caps->rig_model == RIG_MODEL_IC9700 || rig->caps->rig_model == RIG_MODEL_IC9100 || rig->caps->rig_model == RIG_MODEL_IC910) + // The LOCK macro is for the primary thread calling the rig functions // For a separate thread use rig_lock directly // The purpose here is to avoid deadlock during recursion @@ -1547,7 +1549,7 @@ int HAMLIB_API rig_open(RIG *rig) { vfo_t myvfo = RIG_VFO_A; - if (rig->caps->rig_model == RIG_MODEL_IC9700 || rig->caps->rig_model == RIG_MODEL_IC9100) { myvfo = RIG_VFO_MAIN_A; } + if (ICOM_EXCEPTIONS) { myvfo = RIG_VFO_MAIN_A; } retval = rig_get_freq(rig, myvfo, &freq); @@ -1557,7 +1559,7 @@ int HAMLIB_API rig_open(RIG *rig) vfo_t tx_vfo = RIG_VFO_NONE; myvfo = RIG_VFO_B; - if (rig->caps->rig_model == RIG_MODEL_IC9700 || rig->caps->rig_model == RIG_MODEL_IC9100) { myvfo = RIG_VFO_MAIN_B; } + if (ICOM_EXCEPTIONS) { myvfo = RIG_VFO_MAIN_B; } rig_get_freq(rig, myvfo, &freq); rig_get_split_vfo(rig, RIG_VFO_RX, &split, &tx_vfo); @@ -1570,7 +1572,8 @@ int HAMLIB_API rig_open(RIG *rig) { myvfo = RIG_VFO_A; - if (rig->caps->rig_model == RIG_MODEL_IC9700 || rig->caps->rig_model == RIG_MODEL_IC9100) { myvfo = RIG_VFO_MAIN_A; } + if (ICOM_EXCEPTIONS) { myvfo = RIG_VFO_MAIN_A; } + rig_get_mode(rig, myvfo, &mode, &width); @@ -1578,7 +1581,7 @@ int HAMLIB_API rig_open(RIG *rig) { myvfo = RIG_VFO_B; - if (rig->caps->rig_model == RIG_MODEL_IC9700 || rig->caps->rig_model == RIG_MODEL_IC9100) { myvfo = RIG_VFO_MAIN_A; } + if (ICOM_EXCEPTIONS) { myvfo = RIG_VFO_MAIN_A; } rig_debug(RIG_DEBUG_VERBOSE, "xxxsplit=%d\n", split); HAMLIB_TRACE; commit 62e44940cfa8d6ff365cb931f6e387398b26a62b Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jan 30 12:09:35 2025 -0600 Add to Segfault user award diff --git a/Segfault-award b/Segfault-award index 4bf3b4be2..e775238db 100644 --- a/Segfault-award +++ b/Segfault-award @@ -37,3 +37,6 @@ Here is the list of the brave fellows: * Josef 'Jeff' Sipek netrigctl power2mW overflow https://github.com/Hamlib/Hamlib/issues/855 + +* David Balharrie M0DGB + Using python caused seg fault on QMX due to missing priv structure commit 19dce9fd1b515002fb64976d151e9bb05970e614 Merge: 9ffbf6329 93c5267df Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jan 30 11:51:23 2025 -0600 Merge branch 'master' of github.com:Hamlib/Hamlib commit 9ffbf632903d5642d4ceb2bb322baab671fed6be Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jan 30 11:50:57 2025 -0600 Add priv back to QMX as can cause segfault in some cases diff --git a/rigs/kenwood/ts480.c b/rigs/kenwood/ts480.c index 4cb0eb789..043f25334 100644 --- a/rigs/kenwood/ts480.c +++ b/rigs/kenwood/ts480.c @@ -1943,7 +1943,7 @@ struct rig_caps qrplabs_qmx_caps = RIG_MODEL(RIG_MODEL_QRPLABS_QMX), .model_name = "QMX", .mfg_name = "QRPLabs", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -1980,6 +1980,8 @@ struct rig_caps qrplabs_qmx_caps = RIG_FLT_END, }, + .priv = (void *)& ts480_priv_caps, + .rig_init = ts480_init, .rig_open = qrplabs_open, .rig_cleanup = kenwood_cleanup, commit 93c5267dfbf0c084f75b65165e2fe5a5167d81f7 Merge: 62071273a 79f5a0821 Author: Michael Black <mdb...@ya...> Date: Mon Jan 27 12:09:42 2025 -0600 Merge pull request #1667 from ny4i/patch-1 Update README.developer commit 79f5a08210d94e26eb7908a16ad53fa10d9936a0 Author: Tom Schaefer <to...@be...> Date: Mon Jan 27 12:12:16 2025 -0500 Update README.developer Removed s from end of the build-essential package. It is just build-essential. There is no such package as build-essentials. diff --git a/README.developer b/README.developer index 676acbfc7..2b5f64695 100644 --- a/README.developer +++ b/README.developer @@ -239,7 +239,7 @@ That is, if you want to take part in the development of Hamlib, you'll need the following tools. Make sure you have at least the required version or you won't even be able to build from the Git clone. -N.B. The Debian and derivatives (Ubuntu and friends) 'build-essentials' +N.B. The Debian and derivatives (Ubuntu and friends) 'build-essential' package will install a number of tools and minimize the number of packages that need to be installed manually (Debian package names are listed, other distributions may differ). commit 62071273aae744b8dedf739be2ae1575f75a51a2 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Jan 25 12:05:38 2025 -0600 Prompt PMR-171 to stable diff --git a/rigs/yaesu/pmr171.c b/rigs/yaesu/pmr171.c index 20b9fb51d..46d3b3d69 100644 --- a/rigs/yaesu/pmr171.c +++ b/rigs/yaesu/pmr171.c @@ -179,7 +179,7 @@ struct rig_caps pmr171_caps = .mfg_name = "Guohe", .version = "20240704.0", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, commit 1813820dd3f2d0547190208979498c9fde449483 Merge: 27f009da4 0e36ee79f Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Jan 25 12:04:44 2025 -0600 Merge branch 'master' of github.com:Hamlib/Hamlib commit 0e36ee79fe36750d77d1a021c5baaf892dbf5813 Merge: 8309616e9 2ed2a998e Author: Michael Black <mdb...@ya...> Date: Sat Jan 25 12:04:30 2025 -0600 Merge pull request #1665 from clzls/master pmr171.c: Fix mode, freq and PTT commit 27f009da4c2b3781f467d1d1bea21f8776e2b1a6 Merge: e44da73e9 8309616e9 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Jan 25 11:59:46 2025 -0600 Merge branch 'master' of github.com:Hamlib/Hamlib commit e44da73e9a0714efab2c67f6f15904f7116b612e Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Jan 25 11:59:25 2025 -0600 Revert "Fix CRC calculation in pmr171.c" Pull request being done instead This reverts commit 194e18f4e45c1afabeed7f838f32407851474239. diff --git a/rigs/yaesu/pmr171.c b/rigs/yaesu/pmr171.c index 1d7d102c2..0799a290f 100644 --- a/rigs/yaesu/pmr171.c +++ b/rigs/yaesu/pmr171.c @@ -177,9 +177,9 @@ struct rig_caps pmr171_caps = RIG_MODEL(RIG_MODEL_PMR171), .model_name = "PMR-171", .mfg_name = "Guohe", - .version = "20250125.0", + .version = "20240704.0", .copyright = "LGPL", - .status = RIG_STATUS_STABLE, + .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, @@ -456,7 +456,7 @@ static int pmr171_send_cmd1(RIG *rig, unsigned char cmd, unsigned char *reply) unsigned char buf[64] = { 0xa5, 0xa5, 0xa5, 0xa5, 0x03, 0x00, 0x00, 0x00 }; buf[5] = cmd; - unsigned int crc = CRC16Check(&buf[4], 2); + unsigned int crc = CRC16Check(&buf[4], 3); buf[6] = crc >> 8; buf[7] = crc & 0xff; rig_flush(rp); @@ -809,7 +809,7 @@ static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq) to_bcd_be(&cmd[10], CACHE(rig)->freqMainB, 8); } - unsigned int crc = CRC16Check(&cmd[4], 2); + unsigned int crc = CRC16Check(&cmd[4], 12); cmd[14] = crc >> 8; cmd[15] = crc & 0xff; rig_flush(rp); commit 2ed2a998e3d0d932afa184831d469f090fce50fe Author: clzls <164...@us...> Date: Sun Jan 26 01:35:05 2025 +0800 pmr171.c: Fix mode, freq and PTT diff --git a/rigs/yaesu/pmr171.c b/rigs/yaesu/pmr171.c index 0799a290f..20b9fb51d 100644 --- a/rigs/yaesu/pmr171.c +++ b/rigs/yaesu/pmr171.c @@ -453,19 +453,106 @@ static int pmr171_send_cmd1(RIG *rig, unsigned char cmd, unsigned char *reply) { hamlib_port_t *rp = RIGPORT(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); - unsigned char buf[64] = { 0xa5, 0xa5, 0xa5, 0xa5, 0x03, 0x00, 0x00, 0x00 }; + unsigned char buf[8] = { 0xa5, 0xa5, 0xa5, 0xa5, 0x03, 0x00, 0x00, 0x00 }; buf[5] = cmd; - unsigned int crc = CRC16Check(&buf[4], 3); + unsigned int crc = CRC16Check(&buf[4], 2); buf[6] = crc >> 8; buf[7] = crc & 0xff; rig_flush(rp); - write_block(rp, buf, 9); + write_block(rp, buf, 8); return RIG_OK; } -rmode_t pmr171_modes[] = { RIG_MODE_USB, RIG_MODE_LSB, RIG_MODE_CWR, RIG_MODE_CW, RIG_MODE_FM, RIG_MODE_FMN, RIG_MODE_PKTUSB, RIG_MODE_RTTY }; +#define GUOHE_MODE_TABLE_MAX 9 +rmode_t pmr171_modes[GUOHE_MODE_TABLE_MAX] = +{ + RIG_MODE_USB, + RIG_MODE_LSB, + RIG_MODE_CWR, + RIG_MODE_CW, + RIG_MODE_AM, + RIG_MODE_FM, + RIG_MODE_FMN, + RIG_MODE_PKTUSB, + RIG_MODE_RTTY // not functioning +}; + +rmode_t guohe2rmode(unsigned char mode, const rmode_t mode_table[]) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called, mode=0x%02x\n", __func__, + mode); + + if (mode >= GUOHE_MODE_TABLE_MAX) + { + return (RIG_MODE_NONE); + } + + rig_debug(RIG_DEBUG_VERBOSE, "%s: returning %s\n", __func__, + rig_strrmode(mode_table[mode])); + return (mode_table[mode]); +} + +unsigned char rmode2guohe(rmode_t mode, const rmode_t mode_table[]) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called, mode=%s\n", __func__, + rig_strrmode(mode)); + + if (mode != RIG_MODE_NONE) + { + unsigned char i; + + for (i = 0; i < GUOHE_MODE_TABLE_MAX; i++) + { + if (mode_table[i] == mode) + { + rig_debug(RIG_DEBUG_VERBOSE, "%s: returning 0x%02x\n", __func__, i); + return (i); + } + } + } + + return (-1); +} + +/** + * Converting to Big-endian bytes + */ +unsigned char *to_be(unsigned char data[], + unsigned long long freq, + unsigned int byte_len) +{ + int i; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + for (i = byte_len - 1; i >= 0; i--) + { + unsigned char a = freq & 0xFF; + freq >>= 8; + data[i] = a; + } + + return data; +} + + +unsigned long long from_be(const unsigned char data[], + unsigned int byte_len) +{ + int i; + unsigned long long f = 0; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + for (i = 0; i < byte_len; i++) + { + f = (f << 8) + data[i]; + } + + return f; +} static int pmr171_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { @@ -484,8 +571,8 @@ static int pmr171_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) pmr171_send_cmd1(rig, 0x0b, 0); read_block(rp, reply, 5); read_block(rp, &reply[5], reply[4]); - vfoa = from_bcd_be(&reply[9], 8); - vfob = from_bcd_be(&reply[13], 8); + vfoa = from_be(&reply[9], 4); + vfob = from_be(&reply[13], 4); cachep->freqMainA = vfoa; cachep->freqMainB = vfob; rig_debug(RIG_DEBUG_VERBOSE, "%s: vfoa=%.0f, vfob=%.0f\n", __func__, vfoa, @@ -494,8 +581,8 @@ static int pmr171_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) // Now grab the ptt status cachep->ptt = reply[6] == 1; // And the mode - cachep->modeMainA = pmr171_modes[reply[7]]; - cachep->modeMainB = pmr171_modes[reply[8]]; + cachep->modeMainA = guohe2rmode(reply[7], pmr171_modes); + cachep->modeMainB = guohe2rmode(reply[8], pmr171_modes); if (vfo == RIG_VFO_B) { *freq = cachep->freqMainA; } else { *freq = cachep->freqMainB; } @@ -790,7 +877,7 @@ static int pmr171_send_icmd(RIG *rig, int index, const unsigned char *data) static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { - unsigned char cmd[16] = { 0xa5, 0xa5, 0xa5, 0xa5, 12, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + unsigned char cmd[16] = { 0xa5, 0xa5, 0xa5, 0xa5, 11, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; unsigned char reply[16]; //int retval; hamlib_port_t *rp = RIGPORT(rig); @@ -800,16 +887,16 @@ static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq) /* fill in the frequency */ if (vfo == RIG_VFO_B) { - to_bcd_be(&cmd[6], CACHE(rig)->freqMainA, 8); - to_bcd_be(&cmd[10], freq, 8); + to_be(&cmd[6], CACHE(rig)->freqMainA, 4); + to_be(&cmd[10], freq, 4); } else { - to_bcd_be(&cmd[6], freq, 8); - to_bcd_be(&cmd[10], CACHE(rig)->freqMainB, 8); + to_be(&cmd[6], freq, 4); + to_be(&cmd[10], CACHE(rig)->freqMainB, 4); } - unsigned int crc = CRC16Check(&cmd[4], 12); + unsigned int crc = CRC16Check(&cmd[4], 10); cmd[14] = crc >> 8; cmd[15] = crc & 0xff; rig_flush(rp); @@ -823,34 +910,38 @@ static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq) static int pmr171_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { hamlib_port_t *rp = RIGPORT(rig); - unsigned char cmd[10] = { 0xa5, 0xa5, 0xa5, 0xa5, 3, 0x0a, 0x00, 0x00, 0x00, 0x00 }; + unsigned char cmd[10] = { 0xa5, 0xa5, 0xa5, 0xa5, 5, 0x0a, 0x00, 0x00, 0x00, 0x00 }; unsigned char reply[10]; - int i, crc; + int crc; + unsigned char i = rmode2guohe(mode, pmr171_modes); - for (i = 0; i < sizeof(pmr171_modes) / sizeof(rmode_t); ++i) + if (i != (-1)) { - if (pmr171_modes[i] == mode) + if (vfo == RIG_VFO_B) { - if (vfo == RIG_VFO_B) - { - cmd[6] = CACHE(rig)->modeMainA; - cmd[7] = i; - } - else - { - cmd[6] = i; - cmd[7] = CACHE(rig)->modeMainB; - } - - crc = CRC16Check(&cmd[4], 4); - cmd[8] = crc >> 8; - cmd[9] = crc & 0xff; - rig_flush(rp); - write_block(rp, cmd, 16); - read_block(rp, reply, 16); - dump_hex(reply, 16); - return RIG_OK; + cmd[6] = rmode2guohe(CACHE(rig)->modeMainA, pmr171_modes); + cmd[7] = i; + } + else + { + cmd[6] = i; + cmd[7] = rmode2guohe(CACHE(rig)->modeMainB, pmr171_modes); } + + crc = CRC16Check(&cmd[4], 4); + cmd[8] = crc >> 8; + cmd[9] = crc & 0xff; + rig_flush(rp); + write_block(rp, cmd, 10); + read_block(rp, reply, 5); + read_block(rp, &reply[5], reply[4]); + dump_hex(reply, reply[4] + 5); + /* + // Grab the modes + CACHE(rig)->modeMainA = guohe2rmode(reply[6], pmr171_modes); + CACHE(rig)->modeMainB = guohe2rmode(reply[7], pmr171_modes); + */ + return RIG_OK; } rig_debug(RIG_DEBUG_ERR, "%s: invalid mode=%s\n", __func__, rig_strrmode(mode)); @@ -863,13 +954,15 @@ static int pmr171_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) hamlib_port_t *rp = RIGPORT(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); + // According to the manual, sending 0 means PTT ON. + // TODO: How to process ack messages? switch (ptt) { case RIG_PTT_ON: - return pmr171_send_cmd2(rig, 0x07, 0x01, 1); + return pmr171_send_cmd2(rig, 0x07, 0x00, 1); case RIG_PTT_OFF: - return pmr171_send_cmd2(rig, 0x07, 0x00, 0); + return pmr171_send_cmd2(rig, 0x07, 0x01, 1); default: return -RIG_EINVAL; commit 194e18f4e45c1afabeed7f838f32407851474239 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Jan 25 11:02:19 2025 -0600 Fix CRC calculation in pmr171.c https://github.com/Hamlib/Hamlib/issues/1483#issuecomment-2614000861 diff --git a/rigs/yaesu/pmr171.c b/rigs/yaesu/pmr171.c index 0799a290f..1d7d102c2 100644 --- a/rigs/yaesu/pmr171.c +++ b/rigs/yaesu/pmr171.c @@ -177,9 +177,9 @@ struct rig_caps pmr171_caps = RIG_MODEL(RIG_MODEL_PMR171), .model_name = "PMR-171", .mfg_name = "Guohe", - .version = "20240704.0", + .version = "20250125.0", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, @@ -456,7 +456,7 @@ static int pmr171_send_cmd1(RIG *rig, unsigned char cmd, unsigned char *reply) unsigned char buf[64] = { 0xa5, 0xa5, 0xa5, 0xa5, 0x03, 0x00, 0x00, 0x00 }; buf[5] = cmd; - unsigned int crc = CRC16Check(&buf[4], 3); + unsigned int crc = CRC16Check(&buf[4], 2); buf[6] = crc >> 8; buf[7] = crc & 0xff; rig_flush(rp); @@ -809,7 +809,7 @@ static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq) to_bcd_be(&cmd[10], CACHE(rig)->freqMainB, 8); } - unsigned int crc = CRC16Check(&cmd[4], 12); + unsigned int crc = CRC16Check(&cmd[4], 2); cmd[14] = crc >> 8; cmd[15] = crc & 0xff; rig_flush(rp); commit 8309616e9b6d293d3354444ad9b83a0b9f7b0ffb Merge: bb4eb78d2 710dfea56 Author: Michael Black <mdb...@ya...> Date: Fri Jan 24 22:11:18 2025 -0600 Merge pull request #1664 from classabbyamp/kenwood-mode kenwood.h: fix typo commit 710dfea56e79bee7ef41d060153d9e22efdf9c61 Author: classabbyamp <536...@us...> Date: Fri Jan 24 22:40:29 2025 -0500 kenwood.h: fix typo looks like `last_mode_pc` was missing a character on the type. This was caught by compiling on musl libc, where `mode_t` wasn't available from any of the other includes. diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index f1b2d0e07..f553cadc4 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -183,7 +183,7 @@ struct kenwood_priv_data int save_k2_ext_lvl; // so we can restore to original int save_k3_ext_lvl; // so we can restore to original -- for future use if needed int voice_bank; /* last voice bank send for use by stop_voice_mem */ - mode_t last_mode_pc; // last mode memory for PC command + rmode_t last_mode_pc; // last mode memory for PC command int power_now,power_min,power_max; }; ----------------------------------------------------------------------- Summary of changes: NEWS | 6 ++ README.developer | 2 +- Segfault-award | 3 + rigs/icom/ic746.c | 4 +- rigs/kenwood/kenwood.h | 2 +- rigs/kenwood/ts480.c | 4 +- rigs/yaesu/pmr171.c | 173 +++++++++++++++++++++++++++++++++++++------------ src/rig.c | 11 ++-- src/serial.c | 2 +- 9 files changed, 157 insertions(+), 50 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |