kopia lustrzana https://github.com/Hamlib/Hamlib
Add some more memcpy's to sync hamlib_port_t_deprecated
https://github.com/Hamlib/Hamlib/issues/894pull/948/head
rodzic
b9d6ba4585
commit
2028d4d1fa
|
@ -398,8 +398,6 @@ int HAMLIB_API amp_open(AMP *amp)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
memcpy(&rs->ampport_deprecated, &rs->ampport, sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
add_opened_amp(amp);
|
||||
|
||||
rs->comm_state = 1;
|
||||
|
@ -418,6 +416,8 @@ int HAMLIB_API amp_open(AMP *amp)
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(&rs->ampport_deprecated, &rs->ampport, sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -496,12 +496,13 @@ int HAMLIB_API amp_close(AMP *amp)
|
|||
|
||||
rs->ampport.fd = -1;
|
||||
}
|
||||
memcpy(&->state.ampport_deprecated, &->state.ampport, sizeof(amp->state.ampport_deprecated));
|
||||
|
||||
remove_opened_amp(amp);
|
||||
|
||||
rs->comm_state = 0;
|
||||
|
||||
memcpy(&->state.ampport_deprecated, &->state.ampport, sizeof(amp->state.ampport_deprecated));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
23
src/rig.c
23
src/rig.c
|
@ -459,7 +459,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
rs->rigport.fd = -1;
|
||||
rs->pttport.fd = -1;
|
||||
rs->comm_state = 0;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rs->comm_state==0?=%d\n", __func__,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %p rs->comm_state==0?=%d\n", __func__, __LINE__, &rs->comm_state,
|
||||
rs->comm_state);
|
||||
rs->rigport.type.rig = caps->port_type; /* default from caps */
|
||||
#if defined(ASYNC_BUG) && defined(HAVE_PTHREAD)
|
||||
|
@ -681,6 +681,8 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
// Clients built on older 4.X versions will use the old structure
|
||||
// Clients built on newer 4.5 versions will use the new structure
|
||||
memcpy(&rig->state.rigport_deprecated, &rig->state.rigport, sizeof(rig->state.rigport_deprecated));
|
||||
memcpy(&rig->state.pttport_deprecated, &rig->state.pttport, sizeof(rig->state.pttport_deprecated));
|
||||
memcpy(&rig->state.dcdport_deprecated, &rig->state.dcdport, sizeof(rig->state.dcdport_deprecated));
|
||||
|
||||
return (rig);
|
||||
}
|
||||
|
@ -779,7 +781,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
|
||||
if (rs->comm_state)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rs->comm_state==1?=%d\n", __func__,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %p rs->comm_state==1?=%d\n", __func__, __LINE__, &rs->comm_state,
|
||||
rs->comm_state);
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
rs->comm_state = 0;
|
||||
|
@ -827,7 +829,6 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
}
|
||||
|
||||
status = port_open(&rs->rigport);
|
||||
memcpy(&rs->rigport_deprecated,&rs->rigport,sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
|
@ -1048,7 +1049,6 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
if (status < 0)
|
||||
{
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
memcpy(&rs->rigport_deprecated,&rs->rigport,sizeof(hamlib_port_t_deprecated));
|
||||
RETURNFUNC(status);
|
||||
}
|
||||
|
||||
|
@ -1058,16 +1058,14 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
if (status < 0)
|
||||
{
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
memcpy(&rs->rigport_deprecated,&rs->rigport,sizeof(hamlib_port_t_deprecated));
|
||||
RETURNFUNC(status);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
add_opened_rig(rig);
|
||||
|
||||
rs->comm_state = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rs->comm_state==1?=%d\n", __func__,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: %p rs->comm_state==1?=%d\n", __func__, &rs->comm_state,
|
||||
rs->comm_state);
|
||||
|
||||
/*
|
||||
|
@ -1150,6 +1148,8 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
// freq_t freq;
|
||||
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_A, &freq);
|
||||
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_B, &freq);
|
||||
memcpy(&(rs->rigport_deprecated),&(rs->rigport),sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -1303,14 +1303,17 @@ int HAMLIB_API rig_close(RIG *rig)
|
|||
rs->dcdport.fd = rs->pttport.fd = -1;
|
||||
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
memcpy(&rs->rigport_deprecated,&rs->rigport,sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
remove_opened_rig(rig);
|
||||
|
||||
rs->comm_state = 0;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rs->comm_state==0?=%d\n", __func__,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %p rs->comm_state==0?=%d\n", __func__, __LINE__, &rs->comm_state,
|
||||
rs->comm_state);
|
||||
|
||||
memcpy(&rs->rigport_deprecated,&rs->rigport,sizeof(hamlib_port_t_deprecated));
|
||||
memcpy(&rs->pttport_deprecated,&rs->pttport,sizeof(hamlib_port_t_deprecated));
|
||||
memcpy(&rs->dcdport_deprecated,&rs->dcdport,sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
@ -2892,6 +2895,8 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: return code=%d\n", __func__, retcode); }
|
||||
|
||||
memcpy(&rs->pttport_deprecated,&rs->pttport,sizeof(hamlib_port_t_deprecated));
|
||||
|
||||
ELAPSED2;
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
|
|
|
@ -490,6 +490,8 @@ int HAMLIB_API rot_open(ROT *rot)
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(&rot->state.rotport_deprecated, &rot->state.rotport, sizeof(rot->state.rotport_deprecated));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -569,12 +571,12 @@ int HAMLIB_API rot_close(ROT *rot)
|
|||
|
||||
rs->rotport.fd = -1;
|
||||
}
|
||||
memcpy(&rot->state.rotport_deprecated, &rot->state.rotport, sizeof(rot->state.rotport_deprecated));
|
||||
|
||||
remove_opened_rot(rot);
|
||||
|
||||
rs->comm_state = 0;
|
||||
|
||||
memcpy(&rot->state.rotport_deprecated, &rot->state.rotport, sizeof(rot->state.rotport_deprecated));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1682,7 +1682,7 @@ readline_repeat:
|
|||
|
||||
if (my_rig->state.comm_state == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: rig not open...trying to reopen\n", __func__);
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: %p rig not open...trying to reopen\n", __func__, &my_rig->state.comm_state);
|
||||
rig_open(my_rig);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue