kopia lustrzana https://github.com/Hamlib/Hamlib
Fixed type mismatches between signed and unsigned char.
There are a few very suspicious 'if' statements in icom.c and frame.c git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2134 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.6rc1
rodzic
2f2909b6a9
commit
4f086db73f
56
icom/frame.c
56
icom/frame.c
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - low level communication routines
|
||||
* Copyright (c) 2000-2006 by Stephane Fillod
|
||||
*
|
||||
* $Id: frame.c,v 1.30 2006-09-22 19:55:58 n0nb Exp $
|
||||
* $Id: frame.c,v 1.31 2006-10-07 20:45:40 csete 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
|
||||
|
@ -66,11 +66,11 @@ int make_cmd_frame(char frame[], char re_id, char cmd, int subcmd, const unsigne
|
|||
if (subcmd != -1) {
|
||||
#ifdef MULTIB_SUBCMD
|
||||
register int j;
|
||||
if (j = subcmd & 0xff0000) { /* allows multi-byte subcmd for dsp rigs */
|
||||
if ((j = subcmd & 0xff0000)) { /* allows multi-byte subcmd for dsp rigs */
|
||||
frame[i++] = j >> 16;
|
||||
frame[i++] = (subcmd & 0xff00) >> 8;
|
||||
}
|
||||
else if (j = subcmd & 0xff00) frame[i++] = j >> 8;
|
||||
else if ((j = subcmd & 0xff00)) frame[i++] = j >> 8;
|
||||
#endif
|
||||
frame[i++] = subcmd & 0xff;
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *pa
|
|||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data*)rs->priv;
|
||||
|
||||
frm_len = make_cmd_frame(sendbuf, priv->re_civ_addr, cmd, subcmd,
|
||||
payload, payload_len);
|
||||
frm_len = make_cmd_frame((char *) sendbuf, priv->re_civ_addr, cmd, subcmd,
|
||||
payload, payload_len);
|
||||
|
||||
/*
|
||||
* should check return code and that write wrote cmd_len chars!
|
||||
|
@ -117,7 +117,7 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *pa
|
|||
|
||||
serial_flush(&rs->rigport);
|
||||
|
||||
retval = write_block(&rs->rigport, sendbuf, frm_len);
|
||||
retval = write_block(&rs->rigport, (char *) sendbuf, frm_len);
|
||||
if (retval != RIG_OK) {
|
||||
Unhold_Decode(rig);
|
||||
return retval;
|
||||
|
@ -272,7 +272,7 @@ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[])
|
|||
{
|
||||
int i;
|
||||
|
||||
i = read_string(p, rxbuffer, MAXFRAMELEN,
|
||||
i = read_string(p, (char *) rxbuffer, MAXFRAMELEN,
|
||||
icom_block_end, icom_block_end_length);
|
||||
|
||||
return i;
|
||||
|
@ -372,23 +372,39 @@ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t
|
|||
*mode = RIG_MODE_NONE;
|
||||
}
|
||||
|
||||
/* Most rigs return 1-wide, 2-narrow; or if it has 3 filters: 1-wide, 2-middle, 3-narrow. (Except for the 706 mkIIg 0-wide, 1-middle, 2-narrow.) For DSP rigs these are presets, which can be programmed for 30 - 41 bandwidths, depending on mode */
|
||||
/* Most rigs return 1-wide, 2-narrow; or if it has 3 filters: 1-wide, 2-middle,
|
||||
3-narrow. (Except for the 706 mkIIg 0-wide, 1-middle, 2-narrow.) For DSP
|
||||
rigs these are presets, which can be programmed for 30 - 41 bandwidths,
|
||||
depending on mode */
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC706MKIIG || rig->caps->rig_model == RIG_MODEL_IC706 || rig->caps->rig_model == RIG_MODEL_IC706MKII) pd--;
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC706MKIIG ||
|
||||
rig->caps->rig_model == RIG_MODEL_IC706 ||
|
||||
rig->caps->rig_model == RIG_MODEL_IC706MKII) pd--;
|
||||
|
||||
switch (pd) {
|
||||
case 0x01: if (!(*width = rig_passband_wide(rig, *mode))) /* if no wide filter defined it's the default */
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
break;
|
||||
case 0x02: if (*width = rig_passband_wide(rig, *mode))
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
else *width = rig_passband_narrow(rig, *mode); /* This really just depends on how you program the table. */
|
||||
break;
|
||||
case 0x03: *width = rig_passband_narrow(rig, *mode); break;
|
||||
case -1: break; /* no passband data */
|
||||
case 0x01:
|
||||
/* if no wide filter defined it's the default */
|
||||
if (!(*width = rig_passband_wide(rig, *mode)))
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
if ((*width = rig_passband_wide(rig, *mode)))
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
else
|
||||
/* This really just depends on how you program the table. */
|
||||
*width = rig_passband_narrow(rig, *mode);
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
*width = rig_passband_narrow(rig, *mode);
|
||||
break;
|
||||
|
||||
case -1:
|
||||
break; /* no passband data */
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode width %#.2x\n", pd);
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode width %#.2x\n", pd);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
|
22
icom/icom.c
22
icom/icom.c
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - main file
|
||||
* Copyright (c) 2000-2005 by Stephane Fillod
|
||||
*
|
||||
* $Id: icom.c,v 1.97 2006-09-22 19:55:58 n0nb Exp $
|
||||
* $Id: icom.c,v 1.98 2006-10-07 20:45:40 csete 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
|
||||
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -513,8 +512,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
if (priv->civ_731_mode || rig->caps->rig_model == RIG_MODEL_OS456)
|
||||
icmode_ext = -1;
|
||||
|
||||
retval = icom_transaction (rig, C_SET_MODE, icmode, &icmode_ext,
|
||||
(icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len);
|
||||
retval = icom_transaction (rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext,
|
||||
(icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
|
@ -564,7 +563,8 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
/* Most rigs return 1-wide, 2-normal,3-narrow For DSP rigs these are presets, can be programmed for 30 - 41 bandwidths, depending on mode Lets check for dsp filters */
|
||||
|
||||
if (retval = icom_get_dsp_flt(rig, *mode)) *width = retval;
|
||||
if ((retval = icom_get_dsp_flt(rig, *mode)))
|
||||
*width = retval;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2713,11 +2713,11 @@ DECLARE_PROBERIG_BACKEND(icom)
|
|||
*/
|
||||
for (civ_addr=0x01; civ_addr<=0x7f; civ_addr++) {
|
||||
|
||||
frm_len = make_cmd_frame(buf, civ_addr, C_RD_TRXID, S_RD_TRXID,
|
||||
NULL, 0);
|
||||
frm_len = make_cmd_frame((char *) buf, civ_addr, C_RD_TRXID, S_RD_TRXID,
|
||||
NULL, 0);
|
||||
|
||||
serial_flush(port);
|
||||
write_block(port, buf, frm_len);
|
||||
write_block(port, (char *) buf, frm_len);
|
||||
|
||||
/* read out the bytes we just sent
|
||||
* TODO: check this is what we expect
|
||||
|
@ -2772,11 +2772,11 @@ DECLARE_PROBERIG_BACKEND(icom)
|
|||
*/
|
||||
for (civ_addr=0x80; civ_addr<=0x8f; civ_addr++) {
|
||||
|
||||
frm_len = make_cmd_frame(buf, civ_addr, C_CTL_MISC, S_OPTO_RDID,
|
||||
NULL, 0);
|
||||
frm_len = make_cmd_frame((char *) buf, civ_addr, C_CTL_MISC, S_OPTO_RDID,
|
||||
NULL, 0);
|
||||
|
||||
serial_flush(port);
|
||||
write_block(port, buf, frm_len);
|
||||
write_block(port, (char *) buf, frm_len);
|
||||
|
||||
/* read out the bytes we just sent
|
||||
* TODO: check this is what we expect
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - main header
|
||||
* Copyright (c) 2000-2004 by Stephane Fillod
|
||||
*
|
||||
* $Id: icom.h,v 1.72 2006-09-22 19:55:59 n0nb Exp $
|
||||
* $Id: icom.h,v 1.73 2006-10-07 20:45:40 csete 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
|
||||
|
@ -31,7 +31,7 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND_VER "0.3"
|
||||
#define BACKEND_VER "0.4"
|
||||
|
||||
/*
|
||||
* defines used by comp_cal_str in rig.c
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - description of IC-R75
|
||||
* Copyright (c) 2000-2004 by Stephane Fillod
|
||||
*
|
||||
* $Id: icr75.c,v 1.8 2005-04-03 19:53:52 fillods Exp $
|
||||
* $Id: icr75.c,v 1.9 2006-10-07 20:45:40 csete 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
|
||||
|
@ -282,7 +282,7 @@ int icr75_set_channel(RIG *rig, const channel_t *chan)
|
|||
|
||||
to_bcd_be(chanbuf+chan_len++,chan->ant,2);
|
||||
memset(chanbuf+chan_len, 0, 8);
|
||||
strncpy(chanbuf+chan_len, chan->channel_desc, 8);
|
||||
strncpy((char *) (chanbuf+chan_len), chan->channel_desc, 8);
|
||||
chan_len += 8;
|
||||
|
||||
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT,
|
||||
|
@ -386,7 +386,7 @@ int icr75_get_channel(RIG *rig, channel_t *chan)
|
|||
if (from_bcd_be(chanbuf+chan_len++,2) != 0)
|
||||
chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 20;
|
||||
chan->ant = from_bcd_be(chanbuf+chan_len++,2);
|
||||
strncpy(chan->channel_desc, chanbuf+chan_len, 8);
|
||||
strncpy(chan->channel_desc, (char *) (chanbuf+chan_len), 8);
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Hamlib CI-V backend - OptoScan extensions
|
||||
* Copyright (c) 2000-2005 by Stephane Fillod
|
||||
*
|
||||
* $Id: optoscan.c,v 1.13 2005-04-03 12:27:15 fillods Exp $
|
||||
* $Id: optoscan.c,v 1.14 2006-10-07 20:45:40 csete 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
|
||||
|
@ -694,7 +694,7 @@ static int optoscan_send_freq(RIG *rig,pltstate_t *state)
|
|||
|
||||
to_bcd(buff,freq,5*2); /* to_bcd requires nibble len */
|
||||
|
||||
rig2icom_mode(rig,mode,0,&md,&pd);
|
||||
rig2icom_mode(rig,mode,0,(unsigned char *) &md, (signed char *) &pd);
|
||||
buff[5]=md;
|
||||
|
||||
/* read echo'd chars only...there will be no ACK from this command
|
||||
|
|
Ładowanie…
Reference in New Issue