Re: [Hamlib-developer] Spid rotator crash
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Black M. <mdb...@ya...> - 2024-08-16 11:56:42
|
Ahhh...good catch....fixed it for good now....thanks for finding this. diff --git a/rotators/spid/spid.c b/rotators/spid/spid.cindex ad4ce13db..703856a77 100644 --- a/rotators/spid/spid.c +++ b/rotators/spid/spid.c @@ -198,6 +198,7 @@ static int spid_rot_init(ROT *rot) } if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG || + rot->caps->rot_model == ROT_MODEL_SPID_ROT1PROG || rot->caps->rot_model == ROT_MODEL_SPID_MD01_ROT2PROG) { struct spid_rot2prog_priv_data *priv; @@ -216,6 +217,10 @@ static int spid_rot_init(ROT *rot) priv->el_resolution = 0; priv->dir = 0; } + else + { + rig_debug(RIG_DEBUG_ERR, "%s: Unknown SPID model=%s\n", __func__, rot->caps->model_name); + } return RIG_OK; } Mike W9MDB On Friday, August 16, 2024 at 03:43:51 AM CDT, G0GJV <g0...@go...> wrote: Except in spid_rot_init if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG || rot->caps->rot_model == ROT_MODEL_SPID_MD01_ROT2PROG) { struct spid_rot2prog_priv_data *priv; priv = (struct spid_rot2prog_priv_data *)calloc(1, sizeof(struct spid_rot2prog_priv_data)); i.e. if NOT Rot2Prog, the priv data is never allocated. Thanks for adding the patch. Mike G0GJV > priv should never be null unless you are calling these functions directly > instead of going through the API. > But I added the patch anyways. > Mike W9MDB > > > > On Thursday, August 15, 2024 at 12:58:54 PM CDT, G0GJV <g0...@go...> > wrote: > > I've found that very recently my rotator control code is crashing when > I tell a Spid Rot1Prog controller to "stop". > > Building a debug version of Hamlib on a Mac has isolated this to line > 538 of spid.c > > priv->dir = 0; > > This is because "priv" is only going to be valid for a Rot2Prog (az/el) > controller' > > My "simple" (and working) fix is just > > Â Â if (priv) > Â Â { > Â Â Â Â priv->dir = 0; > Â Â } > Â Â > I think this is the only place this mistake has been made; I'd offer a > patch, but I'm not confident without some background as to why this > code was fairly recently added. > > Mike G0GJV _______________________________________________ Hamlib-developer mailing list Ham...@li... https://lists.sourceforge.net/lists/listinfo/hamlib-developer |