[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.0 updated. b1a5fc3a2ca2a6e0b
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Nate B. <n0...@us...> - 2020-09-15 16:40:10
|
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.0 has been updated via b1a5fc3a2ca2a6e0b7d60ecba318da39ff951f3c (commit) via eeeb41ac4d88a6044b9b63a96a20a6b99f6fa526 (commit) via 6da8958787f110ec51eeb63dd4918b9662992ee9 (commit) via 39c8d186ef0a7eaa07a9c56d3978d5680f824f07 (commit) via 28fa1835dc04e7c34aa089df5ec6d8868d9c5e4a (commit) via 05dd3e80157686bcde4690fb9524a679abd04943 (commit) via bbc5e307d0b6c0f754bb7f991c04240a0097ac75 (commit) via 03a856642630bf64e4f6f49ae96fa06d061c9b44 (commit) via 57704aacf952102269afb7684d4444b5a141da02 (commit) via 5c906771038568f034ef82eea1a8e9fb42fc079c (commit) via a3caf7e400eb194234ffffb60e7a616d1b3f3f53 (commit) via b396d60921bd92584a5cd94eb4fcb16fc72b10f4 (commit) via aa352d1d14362d9392074e531aa81e305ca6dde3 (commit) via d519f2a596a56ca7576604cb93280b5811efe8f6 (commit) from 8120c068ec845f12bdb0e1c62a02837344587f03 (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 b1a5fc3a2ca2a6e0b7d60ecba318da39ff951f3c Author: Nate Bargmann <n0...@n0...> Date: Tue Sep 15 10:58:17 2020 -0500 Removed TODO from Makefile.am With the TODO file removed, 'make dist' was failing. (cherry picked from commit d817aefa3602f78ea2fa5d77bb69650107177ad1) diff --git a/Makefile.am b/Makefile.am index b5ebaaf5..0e6c93f2 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 TODO LICENSE hamlib.m4 hamlib.pc.in README.developer \ +EXTRA_DIST = PLAN LICENSE hamlib.m4 hamlib.pc.in README.developer \ README.betatester README.win32 Android.mk doc_DATA = ChangeLog COPYING COPYING.LIB LICENSE \ commit eeeb41ac4d88a6044b9b63a96a20a6b99f6fa526 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 23:12:35 2020 -0500 astyle files (cherry picked from commit b97d05369cb4a8f27780837af8af99530c0665e0) diff --git a/lib/termios.c b/lib/termios.c index eb27729b..887b2ff6 100644 --- a/lib/termios.c +++ b/lib/termios.c @@ -828,7 +828,7 @@ int win32_serial_close(int fd) if ( index->filename ) free( index->filename ); */ free(index); - + LEAVE("serial_close"); return 0; @@ -2496,6 +2496,7 @@ int tcgetattr(int fd, struct termios *s_termios) myDCB.fParity = 1; #if 0 // redundant + if (myDCB.fParity) { #endif @@ -2524,12 +2525,14 @@ int tcgetattr(int fd, struct termios *s_termios) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } + #if 0 // see redundant above } else { s_termios->c_cflag &= ~PARENB; } + #endif /* CSIZE */ diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 658099cc..a2c40c04 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -324,9 +324,9 @@ const struct rig_caps ic7300_caps = RIG_CHAN_END, }, - .rx_range_list1 = { - {kHz(30), MHz(74.8), IC7300_ALL_RX_MODES, -1, -1, IC7300_VFOS}, RIG_FRNG_END, - }, + .rx_range_list1 = { + {kHz(30), MHz(74.8), IC7300_ALL_RX_MODES, -1, -1, IC7300_VFOS}, RIG_FRNG_END, + }, .tx_range_list1 = { FRQ_RNG_HF(1, IC7300_OTHER_TX_MODES, W(2), W(100), IC7300_VFOS, RIG_ANT_1), FRQ_RNG_60m(1, IC7300_OTHER_TX_MODES, W(2), W(100), IC7300_VFOS, RIG_ANT_1), @@ -741,46 +741,46 @@ const struct rig_caps ic705_caps = RIG_CHAN_END, }, - .rx_range_list1 = { + .rx_range_list1 = { {kHz(30), MHz(199.999999), IC705_ALL_RX_MODES, -1, -1, IC7300_VFOS, RIG_ANT_1, "USA"}, {MHz(400), MHz(470), IC705_ALL_RX_MODES, -1, -1, IC7300_VFOS, RIG_ANT_1, "USA"}, - RIG_FRNG_END, + RIG_FRNG_END, }, .tx_range_list1 = { - { kHz(1800), MHz(1.999999),IC705_ALL_TX_MODES, W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(3.5), MHz(3.999999),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(5.255), MHz(5.405),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(7.0), MHz(7.3),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(10.1), MHz(10.15),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(14.0), MHz(14.35),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(18.068), MHz(18.168),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(21.00), MHz(21.45),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(24.89), MHz(24.99),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(28.00), MHz(29.70),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(50.00), MHz(54.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(144.00), MHz(148.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, - { MHz(430.00), MHz(450.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "USA" }, + { kHz(1800), MHz(1.999999), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(3.5), MHz(3.999999), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(5.255), MHz(5.405), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(7.0), MHz(7.3), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(10.1), MHz(10.15), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(14.0), MHz(14.35), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(18.068), MHz(18.168), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(21.00), MHz(21.45), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(24.89), MHz(24.99), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(28.00), MHz(29.70), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(50.00), MHz(54.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(144.00), MHz(148.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, + { MHz(430.00), MHz(450.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "USA" }, RIG_FRNG_END, }, - .rx_range_list2 = { + .rx_range_list2 = { {kHz(30), MHz(199.999999), IC705_ALL_RX_MODES, -1, -1, IC7300_VFOS, RIG_ANT_1, "EUR"}, {MHz(400), MHz(470), IC705_ALL_RX_MODES, -1, -1, IC7300_VFOS, RIG_ANT_1, "EUR"}, - RIG_FRNG_END, + RIG_FRNG_END, }, .tx_range_list2 = { - { kHz(1810), MHz(1.999999),IC705_ALL_TX_MODES, W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(3.5), MHz(3.8),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(7.0), MHz(7.2),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(10.1), MHz(10.15),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(14.0), MHz(14.35),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(18.068), MHz(18.168),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(21.00), MHz(21.45),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(24.89), MHz(24.99),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(28.00), MHz(29.70),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(50.00), MHz(52.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(144.00), MHz(146.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, - { MHz(430.00), MHz(440.00),IC705_ALL_TX_MODES ,W(0.1) , W(10) , IC7300_VFOS, RIG_ANT_1, "EUR" }, + { kHz(1810), MHz(1.999999), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(3.5), MHz(3.8), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(7.0), MHz(7.2), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(10.1), MHz(10.15), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(14.0), MHz(14.35), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(18.068), MHz(18.168), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(21.00), MHz(21.45), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(24.89), MHz(24.99), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(28.00), MHz(29.70), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(50.00), MHz(52.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(144.00), MHz(146.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, + { MHz(430.00), MHz(440.00), IC705_ALL_TX_MODES, W(0.1), W(10), IC7300_VFOS, RIG_ANT_1, "EUR" }, RIG_FRNG_END, }, @@ -936,19 +936,24 @@ int ic7300_set_parm(RIG *rig, setting_t parm, value_t val) { prmbuf[0] = 0x1a; prmbuf[1] = 0x05; - switch (rig->caps->rig_model) { + + switch (rig->caps->rig_model) + { case RIG_MODEL_IC7300: prmbuf[2] = 0x00; prmbuf[3] = 0x39; break; + case RIG_MODEL_IC9700: prmbuf[2] = 0x01; prmbuf[3] = 0x77; break; + case RIG_MODEL_IC705: prmbuf[2] = 0x00; prmbuf[3] = 0x53; break; + default: return -RIG_ENIMPL; } @@ -965,22 +970,27 @@ int ic7300_set_parm(RIG *rig, setting_t parm, value_t val) hr = (int)((float) val.i / 3600.0); min = (int)((float)(val.i - (hr * 3600)) / 60.0); - switch (rig->caps->rig_model) { + switch (rig->caps->rig_model) + { case RIG_MODEL_IC7300: prmbuf[0] = 0x00; prmbuf[1] = 0x95; break; + case RIG_MODEL_IC9700: prmbuf[0] = 0x01; prmbuf[1] = 0x80; break; + case RIG_MODEL_IC705: prmbuf[0] = 0x01; prmbuf[1] = 0x66; break; + default: return -RIG_ENIMPL; } + to_bcd_be(prmbuf + 2, (long long) hr, 2); to_bcd_be(prmbuf + 3, (long long) min, 2); return icom_set_raw(rig, C_CTL_MEM, S_MEM_PARM, 4, prmbuf, 0, 0); @@ -1008,8 +1018,9 @@ int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val) return -RIG_ENIMPL; // How can we implement this? default: - rig_debug(RIG_DEBUG_TRACE, "%s: using icom routine for PARM=%s\n", __func__, rig_strparm(parm)); - return icom_get_parm(rig,parm,val); + rig_debug(RIG_DEBUG_TRACE, "%s: using icom routine for PARM=%s\n", __func__, + rig_strparm(parm)); + return icom_get_parm(rig, parm, val); } retval = icom_transaction(rig, prm_cn, prm_sc, prmbuf, prm_len, resbuf, @@ -1033,11 +1044,12 @@ int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val) switch (parm) { - case RIG_PARM_ANN: + case RIG_PARM_ANN: rig_debug(RIG_DEBUG_WARN, "%s: not implemented\n", __func__); return -RIG_ENIMPL; + default: - return icom_get_parm(rig,parm,val); + return icom_get_parm(rig, parm, val); } diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 7207ac77..0cad1438 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2703,12 +2703,14 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) for (i = 0; cmd && cmd[i].id.s != 0; i++) { - rig_debug(RIG_DEBUG_TRACE, "%s: i=%d\n", __func__, i); + rig_debug(RIG_DEBUG_TRACE, "%s: i=%d\n", __func__, i); + if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_LEVEL && cmd[i].id.s == level) { return icom_get_cmd(rig, vfo, (struct cmdparams *)&cmd[i], val); } } + rig_debug(RIG_DEBUG_TRACE, "%s: no extcmd found\n", __func__); rs = &rig->state; @@ -3189,7 +3191,7 @@ int icom_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) } else if (cfp[i].token == token) { - return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_LEVEL, token, val); + return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_LEVEL, token, val); } else { i++; } } @@ -3239,7 +3241,8 @@ int icom_get_ext_func(RIG *rig, vfo_t vfo, token_t token, int *status) } else if (cfp[i].token == token) { - return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_FUNC, token, (value_t *)status); + return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_FUNC, token, + (value_t *)status); } else { i++; } } @@ -3297,7 +3300,8 @@ int icom_get_ext_parm(RIG *rig, token_t token, value_t *val) return -RIG_EINVAL; } -int icom_get_ext_cmd(RIG *rig, vfo_t vfo, cmd_param_t cmdparamtype, token_t token, value_t *val) +int icom_get_ext_cmd(RIG *rig, vfo_t vfo, cmd_param_t cmdparamtype, + token_t token, value_t *val) { int i; diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 67959ac3..9ffcaf91 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -650,30 +650,40 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) switch (level) { - case RIG_LEVEL_RFPOWER_METER: - cmd = "ZZRM5"; - len = 5; - break; - default: - return kenwood_get_level(rig,vfo,level,val); + case RIG_LEVEL_RFPOWER_METER: + cmd = "ZZRM5"; + len = 5; + break; + + default: + return kenwood_get_level(rig, vfo, level, val); } + retval = kenwood_safe_transaction(rig, cmd, lvlbuf, 10, len + 3); + if (retval != RIG_OK) { return retval; } + int n; + switch (level) { - case RIG_LEVEL_RFPOWER_METER: - n = sscanf(lvlbuf + len, "%f", &val->f); - if (n != 1) { - rig_debug(RIG_DEBUG_ERR,"%s: Error parsing RFPOWER from lvlbuf='%s'\n",__func__,lvlbuf); - return -RIG_EPROTO; - } - val->f /= 100; - break; + case RIG_LEVEL_RFPOWER_METER: + n = sscanf(lvlbuf + len, "%f", &val->f); + + if (n != 1) + { + rig_debug(RIG_DEBUG_ERR, "%s: Error parsing RFPOWER from lvlbuf='%s'\n", + __func__, lvlbuf); + return -RIG_EPROTO; + } + + val->f /= 100; + break; } + return RIG_OK; } diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index f3f1df76..09f4788d 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -355,7 +355,8 @@ transaction_read: if (retval < 0) { rig_debug(RIG_DEBUG_WARN, - "%s: read_string retval < 0, retval = %d, retry_read=%d, rs->rigport.retry=%d\n", __func__, + "%s: read_string retval < 0, retval = %d, retry_read=%d, rs->rigport.retry=%d\n", + __func__, retval, retry_read, rs->rigport.retry); // only retry if we expect a response from the command @@ -476,8 +477,10 @@ transaction_read: rig_debug(RIG_DEBUG_ERR, "%s: wrong reply %c%c for command %c%c\n", __func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]); - rig_debug(RIG_DEBUG_ERR, "%s: retry_read=%d, rs->rigport.retry=%d\n", __func__, retry_read, rs->rigport.retry); - if (retry_read++ < rs->rigport.retry) + rig_debug(RIG_DEBUG_ERR, "%s: retry_read=%d, rs->rigport.retry=%d\n", __func__, + retry_read, rs->rigport.retry); + + if (retry_read++ < rs->rigport.retry) { goto transaction_write; } commit 6da8958787f110ec51eeb63dd4918b9662992ee9 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 14:45:36 2020 -0700 Fix icom LEVELs (cherry picked from commit 6267d2674e08ef7dc512831f2d241d7f50a76c9e) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 06edd785..7207ac77 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2344,7 +2344,7 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) for (i = 0; cmd && cmd[i].id.s != 0; i++) { - if (cmd[i].id.s == level) + if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_LEVEL && cmd[i].id.s == level) { return icom_set_cmd(rig, vfo, (struct cmdparams *)&cmd[i], val); } commit 39c8d186ef0a7eaa07a9c56d3978d5680f824f07 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 14:34:52 2020 -0700 Fix debug statement in ic7300.c (cherry picked from commit ebddade1dcdd588dcb4ce3f0dfa4616c82eb6037) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 6cc8486b..658099cc 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -1008,7 +1008,7 @@ int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val) return -RIG_ENIMPL; // How can we implement this? default: - rig_debug(RIG_DEBUG_TRACE, "%s: using icom routine for PARM=%s", __func__, rig_strparm(parm)); + rig_debug(RIG_DEBUG_TRACE, "%s: using icom routine for PARM=%s\n", __func__, rig_strparm(parm)); return icom_get_parm(rig,parm,val); } commit 28fa1835dc04e7c34aa089df5ec6d8868d9c5e4a Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 09:18:43 2020 -0700 Fix IC7300 set_parm PARM_TIME (cherry picked from commit 9c5b7499f6767ca75b8e7da52dc0e1d5b6abea60) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 3d2a0efc..6cc8486b 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -965,26 +965,25 @@ int ic7300_set_parm(RIG *rig, setting_t parm, value_t val) hr = (int)((float) val.i / 3600.0); min = (int)((float)(val.i - (hr * 3600)) / 60.0); - prmbuf[0] = 0x05; switch (rig->caps->rig_model) { case RIG_MODEL_IC7300: - prmbuf[2] = 0x00; - prmbuf[3] = 0x95; + prmbuf[0] = 0x00; + prmbuf[1] = 0x95; break; case RIG_MODEL_IC9700: - prmbuf[2] = 0x01; - prmbuf[3] = 0x80; + prmbuf[0] = 0x01; + prmbuf[1] = 0x80; break; case RIG_MODEL_IC705: - prmbuf[2] = 0x01; - prmbuf[3] = 0x66; + prmbuf[0] = 0x01; + prmbuf[1] = 0x66; break; default: return -RIG_ENIMPL; } - to_bcd_be(prmbuf + 3, (long long) hr, 2); - to_bcd_be(prmbuf + 4, (long long) min, 2); - return icom_set_raw(rig, C_CTL_MEM, S_MEM_PARM, 5, prmbuf, 0, 0); + to_bcd_be(prmbuf + 2, (long long) hr, 2); + to_bcd_be(prmbuf + 3, (long long) min, 2); + return icom_set_raw(rig, C_CTL_MEM, S_MEM_PARM, 4, prmbuf, 0, 0); default: rig_debug(RIG_DEBUG_ERR, "Unsupported set_parm %s\n", rig_strparm(parm)); diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 6fcd4f10..06edd785 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -5566,7 +5566,7 @@ int icom_set_parm(RIG *rig, setting_t parm, value_t val) for (i = 0; cmd && cmd[i].id.s != 0; i++) { - if (cmd[i].id.s == parm) + if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_PARM && cmd[i].id.s == parm) { return icom_set_cmd(rig, RIG_VFO_NONE, (struct cmdparams *)&cmd[i], val); } commit 05dd3e80157686bcde4690fb9524a679abd04943 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 11:08:38 2020 -0500 Add ic7300_get_parm and ic7300_set_parm (cherry picked from commit 15a879d5ea2d06a17ae88e1952ec14d05b78e105) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 880dd0bf..3d2a0efc 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -38,6 +38,10 @@ #include "bandplan.h" #include "tones.h" +static int ic7300_set_parm(RIG *rig, setting_t parm, value_t val); +static int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val); + + #define IC7300_ALL_RX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM) #define IC7300_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM) #define IC7300_NOT_TS_MODES (IC7300_ALL_RX_MODES &~IC7300_1HZ_TS_MODES) @@ -404,8 +408,8 @@ const struct rig_caps ic7300_caps = .get_ext_level = icom_get_ext_level, .set_func = icom_set_func, .get_func = icom_get_func, - .set_parm = icom_set_parm, - .get_parm = icom_get_parm, + .set_parm = ic7300_set_parm, + .get_parm = ic7300_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, @@ -885,3 +889,162 @@ const struct rig_caps ic705_caps = .send_morse = icom_send_morse, .send_voice_mem = icom_send_voice_mem }; + +int ic7300_set_parm(RIG *rig, setting_t parm, value_t val) +{ + unsigned char prmbuf[MAXFRAMELEN]; + int min, hr; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + switch (parm) + { + case RIG_PARM_ANN: + { + int ann_mode = -1; + int ann_lang = -1; + + switch (val.i) + { + case RIG_ANN_OFF: + ann_mode = S_ANN_ALL; + break; + + case RIG_ANN_FREQ: + ann_mode = S_ANN_FREQ; + break; + + case RIG_ANN_RXMODE: + ann_mode = S_ANN_MODE; + break; + + case RIG_ANN_ENG: + case RIG_ANN_JAP: + ann_lang = (val.i == RIG_ANN_ENG) ? 0 : 1; + break; + + default: + rig_debug(RIG_DEBUG_ERR, "Unsupported RIG_PARM_ANN %d\n", val.i); + return -RIG_EINVAL; + } + + if (ann_mode >= 0) + { + return icom_set_raw(rig, C_CTL_ANN, ann_mode, 0, NULL, 0, 0); + } + else if (ann_lang >= 0) + { + prmbuf[0] = 0x1a; + prmbuf[1] = 0x05; + switch (rig->caps->rig_model) { + case RIG_MODEL_IC7300: + prmbuf[2] = 0x00; + prmbuf[3] = 0x39; + break; + case RIG_MODEL_IC9700: + prmbuf[2] = 0x01; + prmbuf[3] = 0x77; + break; + case RIG_MODEL_IC705: + prmbuf[2] = 0x00; + prmbuf[3] = 0x53; + break; + default: + return -RIG_ENIMPL; + } + + prmbuf[4] = ann_lang; + return icom_set_raw(rig, C_CTL_MEM, S_MEM_MODE_SLCT, 5, prmbuf, 0, 0); + } + + rig_debug(RIG_DEBUG_ERR, "Unsupported RIG_PARM_ANN %d\n", val.i); + return -RIG_EINVAL; + } + + case RIG_PARM_TIME: + hr = (int)((float) val.i / 3600.0); + min = (int)((float)(val.i - (hr * 3600)) / 60.0); + + prmbuf[0] = 0x05; + switch (rig->caps->rig_model) { + case RIG_MODEL_IC7300: + prmbuf[2] = 0x00; + prmbuf[3] = 0x95; + break; + case RIG_MODEL_IC9700: + prmbuf[2] = 0x01; + prmbuf[3] = 0x80; + break; + case RIG_MODEL_IC705: + prmbuf[2] = 0x01; + prmbuf[3] = 0x66; + break; + default: + return -RIG_ENIMPL; + } + to_bcd_be(prmbuf + 3, (long long) hr, 2); + to_bcd_be(prmbuf + 4, (long long) min, 2); + return icom_set_raw(rig, C_CTL_MEM, S_MEM_PARM, 5, prmbuf, 0, 0); + + default: + rig_debug(RIG_DEBUG_ERR, "Unsupported set_parm %s\n", rig_strparm(parm)); + return -RIG_EINVAL; + } +} + +int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val) +{ + unsigned char prmbuf[MAXFRAMELEN], resbuf[MAXFRAMELEN]; + int prm_len, res_len; + int prm_cn, prm_sc; + int icom_val = 0; + int cmdhead; + int retval; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + switch (parm) + { + case RIG_PARM_ANN: + return -RIG_ENIMPL; // How can we implement this? + + default: + rig_debug(RIG_DEBUG_TRACE, "%s: using icom routine for PARM=%s", __func__, rig_strparm(parm)); + return icom_get_parm(rig,parm,val); + } + + retval = icom_transaction(rig, prm_cn, prm_sc, prmbuf, prm_len, resbuf, + &res_len); + + if (retval != RIG_OK) + { + return retval; + } + + cmdhead = 3; + res_len -= cmdhead; + + if (resbuf[0] != ACK && resbuf[0] != prm_cn) + { + rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), len=%d\n", __func__, resbuf[0], + res_len); + return -RIG_ERJCTED; + } + + switch (parm) + { + + case RIG_PARM_ANN: + rig_debug(RIG_DEBUG_WARN, "%s: not implemented\n", __func__); + return -RIG_ENIMPL; + default: + return icom_get_parm(rig,parm,val); + } + + + rig_debug(RIG_DEBUG_TRACE, "%s: %d %d %d %f\n", __func__, res_len, icom_val, + val->i, val->f); + + return RIG_OK; +} + commit bbc5e307d0b6c0f754bb7f991c04240a0097ac75 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 07:34:02 2020 -0500 Remove rptr functions from ic7300.c https://github.com/Hamlib/Hamlib/issues/373 (cherry picked from commit f41e07c0e68f70f95f8ba7e22dd488c20c3b0eda) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 68987aef..880dd0bf 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -270,7 +270,7 @@ const struct rig_caps ic7300_caps = RIG_MODEL(RIG_MODEL_IC7300), .model_name = "IC-7300", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -414,10 +414,10 @@ const struct rig_caps ic7300_caps = .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, - .set_rptr_shift = icom_set_rptr_shift, - .get_rptr_shift = icom_get_rptr_shift, - .set_rptr_offs = icom_set_rptr_offs, - .get_rptr_offs = icom_get_rptr_offs, + .set_rptr_shift = NULL, + .get_rptr_shift = NULL, + .set_rptr_offs = NULL, + .get_rptr_offs = NULL, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, commit 03a856642630bf64e4f6f49ae96fa06d061c9b44 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 08:02:42 2020 -0500 Make ic75 parm functions static (cherry picked from commit 52764221ca674e239cbf9254c4eb0c55e40d5ba7) diff --git a/rigs/icom/icr75.c b/rigs/icom/icr75.c index 955a7ab5..a813f557 100644 --- a/rigs/icom/icr75.c +++ b/rigs/icom/icr75.c @@ -93,8 +93,8 @@ static int icr75_set_channel(RIG *rig, const channel_t *chan); static int icr75_get_channel(RIG *rig, channel_t *chan, int read_only); -int icr75_set_parm(RIG *rig, setting_t parm, value_t val); -int icr75_get_parm(RIG *rig, setting_t parm, value_t *val); +static int icr75_set_parm(RIG *rig, setting_t parm, value_t val); +static int icr75_get_parm(RIG *rig, setting_t parm, value_t *val); static struct icom_priv_caps icr75_priv_caps = { commit 57704aacf952102269afb7684d4444b5a141da02 Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Sep 14 07:59:47 2020 -0500 Fix cppcheck warning in termios.c: (cherry picked from commit 12c2434dc7c925645950cd12c4b4ceee4c066098) diff --git a/lib/termios.c b/lib/termios.c index ac5ccb31..eb27729b 100644 --- a/lib/termios.c +++ b/lib/termios.c @@ -808,29 +808,27 @@ int win32_serial_close(int fd) first_tl = NULL; } - if (index) - { - if (index->rol.hEvent) { CloseHandle(index->rol.hEvent); } + if (index->rol.hEvent) { CloseHandle(index->rol.hEvent); } - if (index->wol.hEvent) { CloseHandle(index->wol.hEvent); } + if (index->wol.hEvent) { CloseHandle(index->wol.hEvent); } - if (index->sol.hEvent) { CloseHandle(index->sol.hEvent); } + if (index->sol.hEvent) { CloseHandle(index->sol.hEvent); } - if (index->hComm) { CloseHandle(index->hComm); } + if (index->hComm) { CloseHandle(index->hComm); } - if (index->ttyset) { free(index->ttyset); } + if (index->ttyset) { free(index->ttyset); } - if (index->astruct) { free(index->astruct); } + if (index->astruct) { free(index->astruct); } - if (index->sstruct) { free(index->sstruct); } + if (index->sstruct) { free(index->sstruct); } - if (index->sis) { free(index->sis); } + if (index->sis) { free(index->sis); } - /* had problems with strdup - if ( index->filename ) free( index->filename ); - */ - free(index); - } + /* had problems with strdup + if ( index->filename ) free( index->filename ); + */ + free(index); + LEAVE("serial_close"); return 0; @@ -1740,7 +1738,7 @@ int win32_serial_read(int fd, void *vb, int size) } } - sprintf(message, "end nBytes=%ld] ", nBytes); + sprintf(message, "end nBytes=%lu] ", nBytes); report(message); /* hl_usleep(1000); @@ -2497,8 +2495,10 @@ int tcgetattr(int fd, struct termios *s_termios) s_termios->c_cflag &= ~(PARENB | PARODD | CMSPAR); myDCB.fParity = 1; +#if 0 // redundant if (myDCB.fParity) { +#endif report("tcgetattr getting parity\n"); s_termios->c_cflag |= PARENB; @@ -2524,11 +2524,13 @@ int tcgetattr(int fd, struct termios *s_termios) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } +#if 0 // see redundant above } else { s_termios->c_cflag &= ~PARENB; } +#endif /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios(myDCB.ByteSize); @@ -2752,11 +2754,11 @@ int tcsetattr(int fd, int when, struct termios *s_termios) if (dcb.EofChar != '\0') { - dcb.fBinary = 0; + dcb.fBinary = FALSE; } else { - dcb.fBinary = 1; + dcb.fBinary = TRUE; } if (EV_BREAK | EV_CTS | EV_DSR | EV_ERR | EV_RING | (EV_RLSD & EV_RXFLAG)) @@ -3536,38 +3538,10 @@ int win32_serial_ioctl(int fd, int request, ...) return -1; } - if (sistruct->frame != index->sis->frame) - { - sistruct->frame = index->sis->frame; - /* - printf( "---------------frame = %i\n", sistruct->frame++ ); - */ - } - - if (sistruct->overrun != index->sis->overrun) - { - /* - printf( "---------------overrun\n" ); - */ - sistruct->overrun = index->sis->overrun; - /* ErrCode &= ~CE_OVERRUN; */ - } - - if (sistruct->parity != index->sis->parity) - { - /* - printf( "---------------parity\n" ); - */ - sistruct->parity = index->sis->parity; - } - - if (sistruct->brk != index->sis->brk) - { - /* - printf( "---------------brk\n" ); - */ - sistruct->brk = index->sis->brk; - } + sistruct->frame = index->sis->frame; + sistruct->overrun = index->sis->overrun; + sistruct->parity = index->sis->parity; + sistruct->brk = index->sis->brk; va_end(ap); return 0; @@ -3777,7 +3751,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds, termios_setflags(fd, eventflags); } - if (!index || !index->event_flag) + if (!index->event_flag) { /* still setting up the port? hold off for a Sec so things can fire up commit 5c906771038568f034ef82eea1a8e9fb42fc079c Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Sep 13 08:30:10 2020 -0500 Remove TODO files as they have been replaced with github issues (cherry picked from commit cb2c757c6230767fd1191aed47c6d11a9c1900b3) diff --git a/TODO b/TODO deleted file mode 100644 index 9f1abb2b..00000000 --- a/TODO +++ /dev/null @@ -1,61 +0,0 @@ -hamlib - (C) Frank Singleton 2000 - - -GENERAL PROJECT TODO --------------------- - -1. Implement more interfaces/backends [ongoing] -2. Write More extensive Test Suites [ongoing] -3. Document API's [ongoing] -4. Document Limitations/Assumptions. -6. Encourage people to build cool GUI's using - our libs. (any GTK wiz's out here ..) -8. More safe checking during function calls (in rig_* wrappers). -13. ~/.hamlibrc and /etc/hamlibrc preferences file -14. Write the list of all functions that should be in the API -18. rewrite the post_write_delay. Active delay is a waste of cycles! [need test] -23. add support in the API for additional filters, DSP bandpass control -25. Write aclocal .m4 macro helpers for autoconf support [need test] -26. Write rig protocol simulator so no hardware is involved with Hamlib testing -27. complete memory bank support -28. add rig_srch_ctcss, rig_srch_dcs, etc. -29. emulate get_stuff (caching) if backend has no support for it -30. Write perl/python/etc. modules [ongoing] - -DONE ----- - -5. Build top level Makefile for maintenance - -7. Move common routines to a common area - and avoid duplication. - -9. If read from rig takes > "n" seconds, then no longer - block on read, just return error. - -10. Improve Makefiles (autoconf?) - -12. Add general rig capabilities handling. see rig.h - -15. Handle retransmissions (no more than n) if timeout (->backends) -16. Write .spec (rpm) and .deb (debian) package files - -17a. Add support for a configurable debug level (none, function calls, - packet traces) - -17b. In serial.c (and non serial too), use buffered IO instead of read/write, - for better performance. Use flushing with fwrite. - -18. Get Git updates mailed to our hamlib-cvs-digest list -19. specify how to access Reverse modes (CWR, RTTYR). through set_mode? -22. handle nicely different versions of same rig coming for - ITU region1/region2 ham band (-> freq ranges in capabilities) - -11. Add some scanning routines [ 1.1.2? ] - -20. adapt API include files to support C++ (__BEGIN_DECLS/__END_DECLS, etc.) -21. grab cygwin and test portability under Win32 (what about MacOS?) -24. Should Hamlib (the library itself) be LGPL'ed ? -31. Add some antenna tuner support -33. Merge dumpmem/dumpcaps into rigctl -32. Document C++/tcltk bindings, complete Hamlib API documentation using doxygen diff --git a/TODO.skeleton b/TODO.skeleton deleted file mode 100644 index 1f7dac7c..00000000 --- a/TODO.skeleton +++ /dev/null @@ -1,15 +0,0 @@ -hamlib - (C) Frank Singleton 2000 - -TODO.<your rig> - (C) <your name> 2000 -This shared library provides an API for communicating -via serial interface to a <your rig> using the <your interface> interface. - -TODO ----- - -1. Complete pcodes -2. Write More extensive Test Suite -3. Document API -4. Document Limitations/Assumptions. -5. - commit a3caf7e400eb194234ffffb60e7a616d1b3f3f53 Author: Michael Black W9MDB <mdb...@ya...> Date: Sun Sep 13 08:08:23 2020 -0500 Adding phpdemo (cherry picked from commit fb9acd8b5eda50a0a89d3ac0f756f703317d48bc) diff --git a/bindings/phpdemo.php b/bindings/phpdemo.php new file mode 100644 index 00000000..a1eb33aa --- /dev/null +++ b/bindings/phpdemo.php @@ -0,0 +1,41 @@ +<?php +// This example needs to be improved by adding get_freq, set_freq functions and such. +// Need to parse the returns from rigctl +print("Hamlib demo\n"); +$descriptorspec = array( + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to +); + +$cmd = "rigctl -m 2"; +$process = proc_open($cmd, $descriptorspec, $pipes); + +if (is_resource($process)) { + // $pipes now looks like this: + // 0 => writeable handle connected to child stdin + // 1 => readable handle connected to child stdout + // Any error output will be appended to /tmp/error-output.txt + + echo fread($pipes[1], 32); + + echo "Main Freq: "; + fwrite($pipes[0], "f Main\n"); + fread($pipes[1],32); + echo fread($pipes[1],64); + echo "\n"; + echo "=====\n"; + + fwrite($pipes[0], "f Sub\n"); + echo "Sub Freq:" ; + echo fread($pipes[1],32); + echo "\n"; + + fclose($pipes[0]); + fclose($pipes[1]); + + $return_value = proc_close($process); + + echo "command returned $return_value\n"; +} +?> commit b396d60921bd92584a5cd94eb4fcb16fc72b10f4 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Sep 12 21:37:10 2020 -0700 Fix icom_get_parm to eliminate collisions (cherry picked from commit aeaa96bc3b471c8c09e86a1e436e14be92c49019) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index b25576ab..6fcd4f10 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2217,7 +2217,7 @@ int icom_set_cmd(RIG *rig, vfo_t vfo, struct cmdparams *par, value_t val) to_bcd_be(&cmdbuf[cmdlen], (int)(val.f * 255.0), (cmdlen * 2)); break; - case CMD_DAT_TIM: + case CMD_DAT_TIM: // returned as seconds since midnight to_bcd_be(&cmdbuf[cmdlen], ((((int)val.f / 3600) * 100) + (((int)val.f / 60) % 60)), (par->datlen * 2)); break; @@ -5628,7 +5628,7 @@ int icom_get_parm(RIG *rig, setting_t parm, value_t *val) for (i = 0; cmd && cmd[i].id.s != 0; i++) { - if (cmd[i].id.s == parm) + if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_PARM && cmd[i].id.s == parm) { return icom_get_cmd(rig, RIG_VFO_NONE, (struct cmdparams *)&cmd[i], val); } diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index a1e1903c..9c23d651 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -31,7 +31,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20200911" +#define BACKEND_VER "20200912" /* * defines used by comp_cal_str in rig.c commit aa352d1d14362d9392074e531aa81e305ca6dde3 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Sep 12 14:26:57 2020 -0700 Fix ic7300 VOXDELAY and other extcmd structures (cherry picked from commit 6e45a7ba785cccf756f086617f246fd0e3e5be36) diff --git a/rigs/icom/ic7100.c b/rigs/icom/ic7100.c index 5320c55e..42dce0ee 100644 --- a/rigs/icom/ic7100.c +++ b/rigs/icom/ic7100.c @@ -108,11 +108,11 @@ int ic7100_tokens[] = { TOK_DSTAR_CODE, TOK_DSTAR_DSQL, TOK_DSTAR_CALL_SIGN, TOK struct cmdparams ic7100_extcmds[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x03}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x04}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_KEYLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x05}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_TIME}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x21}, CMD_DAT_TIM, 2 }, - { {.s = RIG_LEVEL_VOXDELAY}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x65}, CMD_DAT_INT, 1 }, + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x03}, CMD_DAT_BOL, 1 }, + { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x04}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_KEYLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x05}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x21}, CMD_DAT_TIM, 2 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x65}, CMD_DAT_INT, 1 }, { {.s = RIG_PARM_NONE} } }; diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 9ce7b994..68987aef 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -62,7 +62,7 @@ struct cmdparams ic7300_extcmds[] = { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x23}, CMD_DAT_BOL, 1 }, { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x81}, CMD_DAT_LVL, 2 }, { {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x95}, CMD_DAT_TIM, 2 }, - { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x59}, CMD_DAT_INT, 1 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x59}, CMD_DAT_INT, 1 }, { {.s = RIG_PARM_NONE} } }; diff --git a/rigs/icom/ic7600.c b/rigs/icom/ic7600.c index f39e3e26..1b7add09 100644 --- a/rigs/icom/ic7600.c +++ b/rigs/icom/ic7600.c @@ -55,10 +55,10 @@ struct cmdparams ic7600_extcmds[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x59}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x38}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_TIME}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x54}, CMD_DAT_TIM, 2 }, - { {.s = RIG_LEVEL_VOXDELAY}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x67}, CMD_DAT_INT, 1 }, + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x59}, CMD_DAT_BOL, 1 }, + { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x38}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x54}, CMD_DAT_TIM, 2 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x67}, CMD_DAT_INT, 1 }, { {.s = RIG_PARM_NONE} } }; diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 68497030..b25576ab 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2700,13 +2700,16 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) const struct cmdparams *cmd = priv->extcmds; int i; + for (i = 0; cmd && cmd[i].id.s != 0; i++) { + rig_debug(RIG_DEBUG_TRACE, "%s: i=%d\n", __func__, i); if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_LEVEL && cmd[i].id.s == level) { return icom_get_cmd(rig, vfo, (struct cmdparams *)&cmd[i], val); } } + rig_debug(RIG_DEBUG_TRACE, "%s: no extcmd found\n", __func__); rs = &rig->state; commit d519f2a596a56ca7576604cb93280b5811efe8f6 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Sep 12 11:21:33 2020 -0500 Added CMD_PARAM_TYPE values for icom rigs to distinguish the different ext cmd types https://github.com/Hamlib/Hamlib/issues/373 (cherry picked from commit 83667f4c65bf3b2ccb685c979734a1710b811695) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 1cdcd0d1..9ce7b994 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -59,15 +59,15 @@ struct cmdparams ic7300_extcmds[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x23}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x81}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_TIME}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x95}, CMD_DAT_TIM, 2 }, + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x23}, CMD_DAT_BOL, 1 }, + { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x81}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x95}, CMD_DAT_TIM, 2 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x59}, CMD_DAT_INT, 1 }, { {.s = RIG_PARM_NONE} } }; struct cmdparams ic7300_extlevels[] = { - { {.s = RIG_LEVEL_VOXDELAY}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x59}, CMD_DAT_INT, 1 }, }; /* @@ -151,15 +151,11 @@ struct cmdparams ic7300_extlevels[] = struct cmdparams ic9700_extcmds[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x29}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x52}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_SCREENSAVER}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x67}, CMD_DAT_INT, 1 }, - { {.s = RIG_PARM_NONE} } -}; - -struct cmdparams ic9700_extlevels[] = -{ - { {.s = RIG_LEVEL_VOXDELAY}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x30}, CMD_DAT_INT, 1 }, + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x29}, CMD_DAT_BOL, 1 }, + { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x52}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_SCREENSAVER}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x67}, CMD_DAT_INT, 1 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x03, 0x30}, CMD_DAT_INT, 1 }, + { {0} } }; #define IC9700_STR_CAL { 7, \ @@ -233,7 +229,6 @@ static const struct icom_priv_caps IC7300_priv_caps = { .level = -1, .icom_level = 0 }, }, .extcmds = ic7300_extcmds, /* Custom op parameters */ - .extlevels = ic7300_extlevels, /* Custom parameters */ }; static const struct icom_priv_caps IC9700_priv_caps = @@ -251,7 +246,6 @@ static const struct icom_priv_caps IC9700_priv_caps = { .level = -1, .icom_level = 0 }, }, .extcmds = ic9700_extcmds, /* Custom op parameters */ - .extlevels = ic9700_extlevels, /* Custom op parameters */ }; static const struct icom_priv_caps IC705_priv_caps = @@ -269,7 +263,6 @@ static const struct icom_priv_caps IC705_priv_caps = { .level = -1, .icom_level = 0 }, }, .extcmds = ic7300_extcmds, /* Custom parameters */ - .extlevels = ic7300_extlevels, /* Custom parameters */ }; const struct rig_caps ic7300_caps = diff --git a/rigs/icom/ic756.c b/rigs/icom/ic756.c index 730b802d..95ae2684 100644 --- a/rigs/icom/ic756.c +++ b/rigs/icom/ic756.c @@ -64,11 +64,11 @@ struct cmdparams ic756pro_cmdparms[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x20}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x09}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_TIME}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x16}, CMD_DAT_TIM, 2 }, - { {.s = RIG_LEVEL_VOXDELAY}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x60}, CMD_DAT_INT, 1 }, - { {.s = RIG_PARM_NONE} } + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x20}, CMD_DAT_BOL, 1 }, + { {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x09}, CMD_DAT_LVL, 2 }, + { {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x16}, CMD_DAT_TIM, 2 }, + { {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x60}, CMD_DAT_INT, 1 }, + { {0} } }; #define IC756PRO_STR_CAL { 16, \ diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 275f59da..68497030 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -476,34 +476,34 @@ const struct confparams icom_ext_parms[] = const struct cmdparams icom_ext_cmd[] = { - { {.t = TOK_DSTAR_DSQL}, C_CTL_DIG, S_DIG_DSCSQL, SC_MOD_RW, 1, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_DSTAR_CALL_SIGN}, C_CTL_DIG, S_DIG_DSCALS, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 38 }, - { {.t = TOK_DSTAR_MESSAGE}, C_CTL_DIG, S_DIG_DSMESS, SC_MOD_RW12, 2, {0}, CMD_DAT_STR, 32 }, - { {.t = TOK_DSTAR_STATUS}, C_CTL_DIG, S_DIG_DSRSTS, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 1 }, - { {.t = TOK_DSTAR_GPS_DATA}, C_CTL_DIG, S_DIG_DSGPSD, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 52 }, - { {.t = TOK_DSTAR_GPS_MESS}, C_CTL_DIG, S_DIG_DSGPSM, SC_MOD_RW12, 2, {0}, CMD_DAT_STR, 52 }, - { {.t = TOK_DSTAR_CODE}, C_CTL_DIG, S_DIG_DSCSQL, SC_MOD_RW12, 2, {0}, CMD_DAT_FLT, 1 }, - { {.t = TOK_DSTAR_TX_DATA}, C_CTL_DSD, S_DSD_DSTXDT, SC_MOD_RW, 1, {0}, CMD_DAT_BUF, 30 }, - { {.t = TOK_DSTAR_MY_CS}, C_CTL_DVT, S_DVT_DSMYCS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 12 }, - { {.t = TOK_DSTAR_TX_CS}, C_CTL_DVT, S_DVT_DSTXCS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 24 }, - { {.t = TOK_DSTAR_TX_MESS}, C_CTL_DVT, S_DVT_DSTXMS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 20 }, - { {.t = TOK_DRIVE_GAIN}, C_CTL_LVL, S_LVL_DRIVE, SC_MOD_RW, 1, {0}, CMD_DAT_FLT, 2 }, - { {.t = TOK_DIGI_SEL_FUNC}, C_CTL_FUNC, S_FUNC_DIGISEL, SC_MOD_RW, 1, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_DIGI_SEL_LEVEL}, C_CTL_LVL, S_LVL_DIGI, SC_MOD_RW, 1, {0}, CMD_DAT_FLT, 2 }, - { {.t = TOK_SCOPE_DAT}, C_CTL_SCP, S_SCP_DAT, SC_MOD_RD, 0, {0}, CMD_DAT_BUF, 481 }, - { {.t = TOK_SCOPE_STS}, C_CTL_SCP, S_SCP_STS, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_SCOPE_DOP}, C_CTL_SCP, S_SCP_DOP, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_SCOPE_MSS}, C_CTL_SCP, S_SCP_MSS, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_SCOPE_MOD}, C_CTL_SCP, S_SCP_MOD, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, - { {.t = TOK_SCOPE_SPN}, C_CTL_SCP, S_SCP_SPN, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 6 }, - { {.t = TOK_SCOPE_EDG}, C_CTL_SCP, S_SCP_EDG, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, - { {.t = TOK_SCOPE_HLD}, C_CTL_SCP, S_SCP_HLD, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, - { {.t = TOK_SCOPE_REF}, C_CTL_SCP, S_SCP_REF, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 4 }, - { {.t = TOK_SCOPE_SWP}, C_CTL_SCP, S_SCP_SWP, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, - { {.t = TOK_SCOPE_STX}, C_CTL_SCP, S_SCP_STX, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, - { {.t = TOK_SCOPE_TYP}, C_CTL_SCP, S_SCP_TYP, SC_MOD_RW, 0, {0}, CMD_DAT_INT, 1 }, - { {.t = TOK_SCOPE_VBW}, C_CTL_SCP, S_SCP_VBW, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, - { {.t = TOK_SCOPE_FEF}, C_CTL_SCP, S_SCP_FEF, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 12 }, + { {.t = TOK_DSTAR_DSQL}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSCSQL, SC_MOD_RW, 1, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_DSTAR_CALL_SIGN}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSCALS, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 38 }, + { {.t = TOK_DSTAR_MESSAGE}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSMESS, SC_MOD_RW12, 2, {0}, CMD_DAT_STR, 32 }, + { {.t = TOK_DSTAR_STATUS}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSRSTS, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 1 }, + { {.t = TOK_DSTAR_GPS_DATA}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSGPSD, SC_MOD_RW12, 2, {0}, CMD_DAT_BUF, 52 }, + { {.t = TOK_DSTAR_GPS_MESS}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSGPSM, SC_MOD_RW12, 2, {0}, CMD_DAT_STR, 52 }, + { {.t = TOK_DSTAR_CODE}, CMD_PARAM_TYPE_TOKEN, C_CTL_DIG, S_DIG_DSCSQL, SC_MOD_RW12, 2, {0}, CMD_DAT_FLT, 1 }, + { {.t = TOK_DSTAR_TX_DATA}, CMD_PARAM_TYPE_TOKEN, C_CTL_DSD, S_DSD_DSTXDT, SC_MOD_RW, 1, {0}, CMD_DAT_BUF, 30 }, + { {.t = TOK_DSTAR_MY_CS}, CMD_PARAM_TYPE_TOKEN, C_CTL_DVT, S_DVT_DSMYCS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 12 }, + { {.t = TOK_DSTAR_TX_CS}, CMD_PARAM_TYPE_TOKEN, C_CTL_DVT, S_DVT_DSTXCS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 24 }, + { {.t = TOK_DSTAR_TX_MESS}, CMD_PARAM_TYPE_TOKEN, C_CTL_DVT, S_DVT_DSTXMS, SC_MOD_RW, 1, {0}, CMD_DAT_STR, 20 }, + { {.t = TOK_DRIVE_GAIN}, CMD_PARAM_TYPE_TOKEN, C_CTL_LVL, S_LVL_DRIVE, SC_MOD_RW, 1, {0}, CMD_DAT_FLT, 2 }, + { {.t = TOK_DIGI_SEL_FUNC}, CMD_PARAM_TYPE_TOKEN, C_CTL_FUNC, S_FUNC_DIGISEL, SC_MOD_RW, 1, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_DIGI_SEL_LEVEL}, CMD_PARAM_TYPE_TOKEN, C_CTL_LVL, S_LVL_DIGI, SC_MOD_RW, 1, {0}, CMD_DAT_FLT, 2 }, + { {.t = TOK_SCOPE_DAT}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_DAT, SC_MOD_RD, 0, {0}, CMD_DAT_BUF, 481 }, + { {.t = TOK_SCOPE_STS}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_STS, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_SCOPE_DOP}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_DOP, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_SCOPE_MSS}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_MSS, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_SCOPE_MOD}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_MOD, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, + { {.t = TOK_SCOPE_SPN}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_SPN, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 6 }, + { {.t = TOK_SCOPE_EDG}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_EDG, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, + { {.t = TOK_SCOPE_HLD}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_HLD, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, + { {.t = TOK_SCOPE_REF}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_REF, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 4 }, + { {.t = TOK_SCOPE_SWP}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_SWP, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, + { {.t = TOK_SCOPE_STX}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_STX, SC_MOD_RW, 0, {0}, CMD_DAT_BOL, 1 }, + { {.t = TOK_SCOPE_TYP}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_TYP, SC_MOD_RW, 0, {0}, CMD_DAT_INT, 1 }, + { {.t = TOK_SCOPE_VBW}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_VBW, SC_MOD_RW, 0, {0}, CMD_DAT_WRD, 2 }, + { {.t = TOK_SCOPE_FEF}, CMD_PARAM_TYPE_TOKEN, C_CTL_SCP, S_SCP_FEF, SC_MOD_RW, 0, {0}, CMD_DAT_BUF, 12 }, { {0} } }; @@ -2340,7 +2340,7 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - const struct cmdparams *cmd = priv_caps->extlevels; + const struct cmdparams *cmd = priv_caps->extcmds; for (i = 0; cmd && cmd[i].id.s != 0; i++) { @@ -2697,12 +2697,12 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); const struct icom_priv_caps *priv = rig->caps->priv; - const struct cmdparams *cmd = priv->extlevels; + const struct cmdparams *cmd = priv->extcmds; int i; for (i = 0; cmd && cmd[i].id.s != 0; i++) { - if (cmd[i].id.s == level) + if (cmd[i].cmdparamtype == CMD_PARAM_TYPE_LEVEL && cmd[i].id.s == level) { return icom_get_cmd(rig, vfo, (struct cmdparams *)&cmd[i], val); } @@ -3186,7 +3186,7 @@ int icom_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) } else if (cfp[i].token == token) { - return icom_get_ext_cmd(rig, vfo, token, val); + return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_LEVEL, token, val); } else { i++; } } @@ -3236,7 +3236,7 @@ int icom_get_ext_func(RIG *rig, vfo_t vfo, token_t token, int *status) } else if (cfp[i].token == token) { - return icom_get_ext_cmd(rig, vfo, token, (value_t *)status); + return icom_get_ext_cmd(rig, vfo, CMD_PARAM_TYPE_FUNC, token, (value_t *)status); } else { i++; } } @@ -3286,7 +3286,7 @@ int icom_get_ext_parm(RIG *rig, token_t token, value_t *val) } else if (cfp[i].token == token) { - return icom_get_ext_cmd(rig, RIG_VFO_NONE, token, val); + return icom_get_ext_cmd(rig, RIG_VFO_NONE, CMD_PARAM_TYPE_PARM, token, val); } else { i++; } } @@ -3294,7 +3294,7 @@ int icom_get_ext_parm(RIG *rig, token_t token, value_t *val) return -RIG_EINVAL; } -int icom_get_ext_cmd(RIG *rig, vfo_t vfo, token_t token, value_t *val) +int icom_get_ext_cmd(RIG *rig, vfo_t vfo, cmd_param_t cmdparamtype, token_t token, value_t *val) { int i; @@ -3316,7 +3316,7 @@ int icom_get_ext_cmd(RIG *rig, vfo_t vfo, token_t token, value_t *val) cmd = icom_ext_cmd; i = 0; } - else if (cmd[i].id.t == token) + else if (cmd[i].cmdparamtype == cmdparamtype && cmd[i].id.t == token) { return icom_get_cmd(rig, vfo, (struct cmdparams *)&cmd[i], val); } diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index fe259658..a1e1903c 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -106,11 +106,21 @@ struct icom_agc_level icom_level; /* Icom AGC level for C_CTL_FUNC (0x16), S_FUNC_AGC (0x12) command */ }; +typedef enum +{ + CMD_PARAM_TYPE_NONE, + CMD_PARAM_TYPE_LEVEL, + CMD_PARAM_TYPE_PARM, + CMD_PARAM_TYPE_TOKEN, + CMD_PARAM_TYPE_FUNC, +} cmd_param_t; + struct cmdparams { /* Lookup table item for levels & parms */ union { setting_t s; /* Level or parm */ token_t t; /* TOKEN_BACKEND */ } id; + cmd_param_t cmdparamtype; /* CMD_PARAM_TYPE_LEVEL or CMD_PARAM_TYPE_PARM */ int command; /* CI-V command */ int subcmd; /* CI-V Subcommand */ int submod; /* Subcommand modifier */ @@ -167,8 +177,6 @@ struct icom_priv_caps int agc_levels_present; /* Flag to indicate that agc_levels array is populated */ struct icom_agc_level agc_levels[RIG_AGC_LAST + 1]; /* Icom rig-specific AGC levels, the last entry should have level -1 */ struct cmdparams *extcmds; /* Pointer to extended operations array */ - struct cmdparams *extlevels; /* Pointer to extended operations array */ - struct cmdparams *extparms; /* Pointer to extended operations array */ }; @@ -282,7 +290,7 @@ int icom_get_parm(RIG *rig, setting_t parm, value_t *val); int icom_set_ext_parm(RIG *rig, token_t token, value_t val); int icom_get_ext_parm(RIG *rig, token_t token, value_t *val); int icom_set_ext_cmd(RIG *rig, vfo_t vfo, token_t token, value_t val); -int icom_get_ext_cmd(RIG *rig, vfo_t vfo, token_t token, value_t *val); +int icom_get_ext_cmd(RIG *rig, vfo_t vfo, cmd_param_t cmdparamtype, token_t token, value_t *val); int icom_set_conf(RIG *rig, token_t token, const char *val); int icom_get_conf(RIG *rig, token_t token, char *val); int icom_set_powerstat(RIG *rig, powerstat_t status); diff --git a/rigs/icom/icr30.c b/rigs/icom/icr30.c index 84014af0..6300b986 100644 --- a/rigs/icom/icr30.c +++ b/rigs/icom/icr30.c @@ -68,9 +68,9 @@ struct confparams icr30_ext[] = struct cmdparams icr30_extcmds[] = { - { {.t = TOK_ANL}, C_CTL_MEM, S_MEM_ANL, SC_MOD_RW, 0, {}, CMD_DAT_BOL, 1 }, - { {.t = TOK_EAR}, C_CTL_MEM, S_MEM_EAR, SC_MOD_RW, 0, {}, CMD_DAT_BOL, 1 }, - { {.t = TOK_REC}, C_CTL_MEM, S_MEM_REC, SC_MOD_WR, 0, {}, CMD_DAT_BOL, 1 }, + { {.t = TOK_ANL}, CMD_PARAM_TYPE_TOKEN, C_CTL_MEM, S_MEM_ANL, SC_MOD_RW, 0, {}, CMD_DAT_BOL, 1 }, + { {.t = TOK_EAR}, CMD_PARAM_TYPE_TOKEN, C_CTL_MEM, S_MEM_EAR, SC_MOD_RW, 0, {}, CMD_DAT_BOL, 1 }, + { {.t = TOK_REC}, CMD_PARAM_TYPE_TOKEN, C_CTL_MEM, S_MEM_REC, SC_MOD_WR, 0, {}, CMD_DAT_BOL, 1 }, { {0} } }; diff --git a/rigs/icom/icr8600.c b/rigs/icom/icr8600.c index 1cfe03ca..a945cc22 100644 --- a/rigs/icom/icr8600.c +++ b/rigs/icom/icr8600.c @@ -69,10 +69,10 @@ struct cmdparams icr8600_extcmds[] = { - { {.s = RIG_PARM_BEEP}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x38}, CMD_DAT_BOL, 1 }, - { {.s = RIG_PARM_BACKLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x15}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_KEYLIGHT}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x16}, CMD_DAT_LVL, 2 }, - { {.s = RIG_PARM_TIME}, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x32}, CMD_DAT_TIM, 2 }, + { {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_C... [truncated message content] |