kopia lustrzana https://github.com/Hamlib/Hamlib
Fix flrig for 64-bit mode
rodzic
d6a72d15bf
commit
4ca11325b5
|
@ -169,7 +169,7 @@ const struct rig_caps flrig_caps = {
|
||||||
// Structure for mapping flrig dynmamic modes to hamlib modes
|
// Structure for mapping flrig dynmamic modes to hamlib modes
|
||||||
// flrig displays modes as the rig displays them
|
// flrig displays modes as the rig displays them
|
||||||
struct s_modeMap {
|
struct s_modeMap {
|
||||||
int mode_hamlib;
|
rmode_t mode_hamlib;
|
||||||
char *mode_flrig;
|
char *mode_flrig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -378,7 +378,6 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
|
||||||
{
|
{
|
||||||
int try=rig->caps->retry;
|
int try=rig->caps->retry;
|
||||||
int retval=-RIG_EPROTO;
|
int retval=-RIG_EPROTO;
|
||||||
char xmltmp[MAXXMLLEN];
|
|
||||||
|
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = &rig->state;
|
||||||
|
|
||||||
|
@ -386,6 +385,7 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
|
||||||
// We need to avoid and empty write as rigctld replies with blank line
|
// We need to avoid and empty write as rigctld replies with blank line
|
||||||
if (xml_len == 0) {
|
if (xml_len == 0) {
|
||||||
rig_debug(RIG_DEBUG_ERR,"%s: len==0??\n",__FUNCTION__);
|
rig_debug(RIG_DEBUG_ERR,"%s: len==0??\n",__FUNCTION__);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// appears we can lose sync if we don't clear things out
|
// appears we can lose sync if we don't clear things out
|
||||||
|
@ -398,7 +398,6 @@ static int write_transaction(RIG *rig, char *xml, int xml_len)
|
||||||
return -RIG_EIO;
|
return -RIG_EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy(xml,xmltmp);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +445,7 @@ static int flrig_init(RIG *rig)
|
||||||
* Assumes mode!=NULL
|
* Assumes mode!=NULL
|
||||||
* Return the string for FLRig for the given hamlib mode
|
* Return the string for FLRig for the given hamlib mode
|
||||||
*/
|
*/
|
||||||
static const char * modeMapGetFLRig(unsigned int modeHamlib)
|
static const char * modeMapGetFLRig(rmode_t modeHamlib)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
||||||
|
@ -463,14 +462,14 @@ static const char * modeMapGetFLRig(unsigned int modeHamlib)
|
||||||
* Assumes mode!=NULL
|
* Assumes mode!=NULL
|
||||||
* Return the hamlib mode from the given FLRig string
|
* Return the hamlib mode from the given FLRig string
|
||||||
*/
|
*/
|
||||||
static unsigned int modeMapGetHamlib(const char *modeFLRig)
|
static rmode_t modeMapGetHamlib (const char *modeFLRig)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char modeFLRigCheck[64];
|
char modeFLRigCheck[64];
|
||||||
snprintf(modeFLRigCheck,sizeof(modeFLRigCheck),"|%.32s|",modeFLRig);
|
snprintf(modeFLRigCheck,sizeof(modeFLRigCheck),"|%s|",modeFLRig);
|
||||||
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
||||||
if (modeMap[i].mode_flrig)
|
rig_debug(RIG_DEBUG_TRACE,"%s: find '%s' in '%s'\n", __FUNCTION__, modeFLRigCheck, modeMap[i].mode_flrig);
|
||||||
if (modeMap[i].mode_flrig && strstr(modeMap[i].mode_flrig,modeFLRigCheck)) {
|
if (modeMap[i].mode_flrig && strcmp(modeMap[i].mode_flrig,modeFLRigCheck)==0) {
|
||||||
return modeMap[i].mode_hamlib;
|
return modeMap[i].mode_hamlib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,10 +482,14 @@ static unsigned int modeMapGetHamlib(const char *modeFLRig)
|
||||||
* modeMapAdd
|
* modeMapAdd
|
||||||
* Assumes modes!=NULL
|
* Assumes modes!=NULL
|
||||||
*/
|
*/
|
||||||
static void modeMapAdd(unsigned int *modes,int mode_hamlib,char *mode_flrig)
|
static void modeMapAdd(rmode_t *modes,rmode_t mode_hamlib,char *mode_flrig)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
rig_debug(RIG_DEBUG_TRACE,"%s:mode_flrig=%s\n",__FUNCTION__,mode_flrig);
|
rig_debug(RIG_DEBUG_TRACE,"%s:mode_flrig=%s\n",__FUNCTION__,mode_flrig);
|
||||||
|
|
||||||
|
// if we already have it just return
|
||||||
|
if (modeMapGetHamlib(mode_flrig)!=-RIG_EINVAL) return;
|
||||||
|
|
||||||
int len1 = strlen(mode_flrig)+3; /* bytes needed for allocating */
|
int len1 = strlen(mode_flrig)+3; /* bytes needed for allocating */
|
||||||
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
for(i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
||||||
if (modeMap[i].mode_hamlib==mode_hamlib) {
|
if (modeMap[i].mode_hamlib==mode_hamlib) {
|
||||||
|
@ -583,7 +586,7 @@ static int flrig_open(RIG *rig) {
|
||||||
read_transaction(rig, xml, sizeof(xml));
|
read_transaction(rig, xml, sizeof(xml));
|
||||||
xml_parse(xml, value, sizeof(value));
|
xml_parse(xml, value, sizeof(value));
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: modes=%s\n",__FUNCTION__, value);
|
rig_debug(RIG_DEBUG_TRACE, "%s: modes=%s\n",__FUNCTION__, value);
|
||||||
unsigned int modes = 0;
|
rmode_t modes = 0;
|
||||||
char *p;
|
char *p;
|
||||||
for(p=strtok(value,"|"); p!=NULL; p=strtok(NULL,"|")) {
|
for(p=strtok(value,"|"); p!=NULL; p=strtok(NULL,"|")) {
|
||||||
if (streq(p,"USB")) modeMapAdd(&modes,RIG_MODE_USB,p);
|
if (streq(p,"USB")) modeMapAdd(&modes,RIG_MODE_USB,p);
|
||||||
|
@ -667,6 +670,10 @@ static int flrig_cleanup(RIG *rig) {
|
||||||
free(rig->state.priv);
|
free(rig->state.priv);
|
||||||
rig->state.priv = NULL;
|
rig->state.priv = NULL;
|
||||||
|
|
||||||
|
for(int i=0; modeMap[i].mode_hamlib!=0; ++i) {
|
||||||
|
if (modeMap[i].mode_flrig) free(modeMap[i].mode_flrig);
|
||||||
|
}
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BACKEND_VER "1.6"
|
#define BACKEND_VER "1.7"
|
||||||
|
|
||||||
#define EOM "\r"
|
#define EOM "\r"
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
|
|
Ładowanie…
Reference in New Issue