diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index a7d78a1df..cacb11d77 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main file * Copyright (c) 2000-2003 by Stephane Fillod and others * - * $Id: kenwood.c,v 1.61 2003-04-16 22:30:41 fillods Exp $ + * $Id: kenwood.c,v 1.62 2003-06-23 17:48:27 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -264,40 +264,39 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) /* - * kenwood_get_vfo + * kenwood_get_vfo using byte 31 of the IF information field * Assumes rig!=NULL, !vfo */ int kenwood_get_vfo(RIG *rig, vfo_t *vfo) { - unsigned char vfobuf[50]; - int vfo_len, retval; + unsigned char infobuf[50]; + int info_len, retval; - - /* query RX VFO */ - vfo_len = 50; - retval = kenwood_transaction (rig, "FR;", 3, vfobuf, &vfo_len); + info_len = 50; + retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; - if (vfo_len != 4 || vfobuf[1] != 'R') { - rig_debug(RIG_DEBUG_ERR,"kenwood_get_vfo: unexpected answer %s, " - "len=%d\n", vfobuf, vfo_len); - return -RIG_ERJCTED; - } + if (info_len != 38 || infobuf[1] != 'F') { + rig_debug(RIG_DEBUG_ERR,"kenwood_get_vfo: wrong answer len=%d\n", + info_len); + return -RIG_ERJCTED; - /* TODO: replace 0,1,2,.. constants by defines */ - switch (vfobuf[2]) { + } + switch (infobuf[30]) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; case '2': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"kenwood_get_vfo: unsupported VFO %c\n", - vfobuf[2]); + infobuf[30]); return -RIG_EPROTO; } return RIG_OK; + } + /* * kenwood_old_set_vfo * Assumes rig!=NULL diff --git a/kenwood/ts870s.c b/kenwood/ts870s.c index 3945ea87d..4635c5c83 100644 --- a/kenwood/ts870s.c +++ b/kenwood/ts870s.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS870S description * Copyright (c) 2000-2002 by Stephane Fillod * - * $Id: ts870s.c,v 1.35 2003-01-06 22:12:01 fillods Exp $ + * $Id: ts870s.c,v 1.36 2003-06-23 17:48:27 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -55,6 +55,38 @@ static const struct kenwood_priv_caps ts870s_priv_caps = { .cmdtrm = EOM_KEN, }; +/* only the ts870s and ts2000 support get_vfo with the 'FR;' command + NOTE: using byte 31 in 'IF' will also work. TODO: check other rigs */ +int ts870s_get_vfo(RIG *rig, vfo_t *vfo) +{ + unsigned char vfobuf[50]; + int vfo_len, retval; + + + /* query RX VFO */ + vfo_len = 50; + retval = kenwood_transaction (rig, "FR;", 3, vfobuf, &vfo_len); + if (retval != RIG_OK) + return retval; + + if (vfo_len != 4 || vfobuf[1] != 'R') { + rig_debug(RIG_DEBUG_ERR,"ts870s_get_vfo: unexpected answer %s, " + "len=%d\n", vfobuf, vfo_len); + return -RIG_ERJCTED; + } + + /* TODO: replace 0,1,2,.. constants by defines */ + switch (vfobuf[2]) { + case '0': *vfo = RIG_VFO_A; break; + case '1': *vfo = RIG_VFO_B; break; + case '2': *vfo = RIG_VFO_MEM; break; + default: + rig_debug(RIG_DEBUG_ERR,"ts870s_get_vfo: unsupported VFO %c\n", + vfobuf[2]); + return -RIG_EPROTO; + } + return RIG_OK; +} int ts870s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { @@ -158,7 +190,7 @@ const struct rig_caps ts870s_caps = { .rig_model = RIG_MODEL_TS870S, .model_name = "TS-870S", .mfg_name = "Kenwood", -.version = "0.3.2", +.version = "0.3.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -299,7 +331,7 @@ const struct rig_caps ts870s_caps = { .set_mode = ts870s_set_mode, .get_mode = ts870s_get_mode, .set_vfo = kenwood_set_vfo, -.get_vfo = kenwood_get_vfo, +.get_vfo = ts870s_get_vfo, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, diff --git a/kenwood/ts950.c b/kenwood/ts950.c index d51f353f6..6c2ec3ddc 100644 --- a/kenwood/ts950.c +++ b/kenwood/ts950.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS950 description * Copyright (c) 2002 by Stephane Fillod * - * $Id: ts950.c,v 1.10 2002-11-04 22:40:55 fillods Exp $ + * $Id: ts950.c,v 1.11 2003-06-23 17:48:27 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -38,10 +38,12 @@ #define TS950_VFO (RIG_VFO_A|RIG_VFO_B) +#define cmd_trm(rig) ((struct kenwood_priv_caps *)(rig)->caps->priv)->cmdtrm const struct kenwood_priv_caps ts950_priv_caps = { .cmdtrm = EOM_KEN, }; + /* * ts950sdx rig capabilities. * @@ -51,17 +53,17 @@ const struct rig_caps ts950sdx_caps = { .rig_model = RIG_MODEL_TS950SDX, .model_name = "TS-950SDX", .mfg_name = "Kenwood", -.version = "0.2", +.version = "0.2.4", .copyright = "LGPL", -.status = RIG_STATUS_UNTESTED, +.status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, -.serial_rate_max = 57600, +.serial_rate_max = 4800, .serial_data_bits = 8, -.serial_stop_bits = 1, +.serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0,