From b2b20af07e0e82aa98653fa6870d7b4e2b967685 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 8 Sep 2018 21:57:25 +0200 Subject: [PATCH 01/12] Ass support for CM108AH chipsets --- src/cm108.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cm108.c b/src/cm108.c index 22530194e..9c184d9b3 100644 --- a/src/cm108.c +++ b/src/cm108.c @@ -115,7 +115,8 @@ int cm108_open(hamlib_port_t *port) && ((hiddevinfo.product >= 0x0008 && hiddevinfo.product <= 0x000f) || hiddevinfo.product == 0x0012 - || hiddevinfo.product == 0x013a)) + || hiddevinfo.product == 0x013a + || hiddevinfo.product == 0x013c)) // SSS1621/23 || (hiddevinfo.vendor == 0x0c76 && (hiddevinfo.product == 0x1605 From 13317afb0eb14254623366ee973e1c56c2332735 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Thu, 13 Sep 2018 15:38:42 -0500 Subject: [PATCH 02/12] Update power reading values for FT900 --- yaesu/ft900.c | 23 +++++++++++++---------- yaesu/ft900.h | 21 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/yaesu/ft900.c b/yaesu/ft900.c index 5328080df..2175be2e9 100644 --- a/yaesu/ft900.c +++ b/yaesu/ft900.c @@ -1,4 +1,4 @@ -/* + /* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft900.c - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) @@ -37,6 +37,7 @@ #include "bandplan.h" #include "serial.h" #include "misc.h" +#include "cal.h" #include "yaesu.h" #include "ft900.h" @@ -138,7 +139,8 @@ struct ft900_priv_data { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT900_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT900_ALL_DATA_LENGTH]; /* returned data--max value, some are less */ - unsigned char current_mem; /* private memory channel number */ + unsigned char current_mem; /* private memory channel number */ + int ptt; /* ptt status needed for meter reading */ }; /* @@ -151,9 +153,9 @@ const struct rig_caps ft900_caps = { .rig_model = RIG_MODEL_FT900, .model_name = "FT-900", .mfg_name = "Yaesu", - .version = "0.1", + .version = "0.2", .copyright = "LGPL", - .status = RIG_STATUS_UNTESTED, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, @@ -903,9 +905,11 @@ static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { switch (ptt) { case RIG_PTT_OFF: cmd_index = FT900_NATIVE_PTT_OFF; + priv->ptt = 0; break; case RIG_PTT_ON: cmd_index = FT900_NATIVE_PTT_ON; + priv->ptt = 1; break; default: return -RIG_EINVAL; /* wrong PTT state! */ @@ -961,6 +965,7 @@ static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { default: /* Oops! */ return -RIG_EINVAL; /* Invalid PTT bit?! */ } + priv->ptt = *ptt; return RIG_OK; } @@ -1297,13 +1302,11 @@ static int ft900_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { * is life when mapping non-linear S-meters to a linear scale. * */ - if (*p > 160) { - val->i = 60; - } else if (*p <= 72) { - val->i = ((72 - *p) / 1.3333) * -1; - } else { - val->i = ((*p - 72) / 1.4667); + cal_table_t cal=FT900_STR_CAL_SMETER; + if (priv->ptt) { + cal = (cal_table_t)FT900_STR_CAL_POWER; } + val->i = (int)rig_raw2val(*p,&cal); rig_debug(RIG_DEBUG_TRACE, "%s: calculated level = %i\n", __func__, val->i); diff --git a/yaesu/ft900.h b/yaesu/ft900.h index b424c7163..0c84f3b06 100644 --- a/yaesu/ft900.h +++ b/yaesu/ft900.h @@ -71,7 +71,7 @@ #define FT900_PACING_INTERVAL 5 #define FT900_PACING_DEFAULT_VALUE 0 -#define FT900_WRITE_DELAY 50 +#define FT900_WRITE_DELAY 5 /* Delay sequential fast writes */ @@ -315,6 +315,25 @@ typedef enum ft900_native_cmd_e ft900_native_cmd_t; #define P3 1 #define P4 0 +/* + * Two calibration sets for the smeter/power readings + */ + +#define FT900_STR_CAL_SMETER { 3, \ + { \ + { 0, -54 }, /* S0 */ \ + {0x44, 0 }, /* S9 */ \ + {0x9d, 60 }, /* +60dB */ \ + } } + +#define FT900_STR_CAL_POWER { 5, \ + { \ + { 0, 0 }, /* 0W */ \ + {0x44, 10 }, /* 10W */ \ + {0x69, 25 }, /* 25W */ \ + {0x92, 50 }, /* 50W */ \ + {0xCE, 100 }, /* 100W */ \ + } } /* * API local implementation From 9dad9624731cb7c18c3869058b1cd947f7e29830 Mon Sep 17 00:00:00 2001 From: "Brian G. Lucas" Date: Fri, 14 Sep 2018 16:16:29 -0500 Subject: [PATCH 03/12] Some calls to thd72_get_menu_item where passing wrong values for range check. --- kenwood/thd72.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kenwood/thd72.c b/kenwood/thd72.c index 13e3f09fc..8bfea64c7 100644 --- a/kenwood/thd72.c +++ b/kenwood/thd72.c @@ -657,14 +657,14 @@ static int thd72_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } break; case RIG_LEVEL_VOXGAIN: - retval = thd72_get_menu_item(rig, 8, '9', &l); + retval = thd72_get_menu_item(rig, 8, 9, &l); if (retval != RIG_OK) return retval; /* FIXME - if VOX is off, what do we return */ val->f = l / 9.0; break; case RIG_LEVEL_VOXDELAY: - retval = thd72_get_menu_item(rig, 9, '7', &l); + retval = thd72_get_menu_item(rig, 9, 7, &l); if (retval != RIG_OK) return retval; /* FIXME - if VOX is off, what do we return */ @@ -683,7 +683,7 @@ static int thd72_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) val->f = thd72sqlevel[l]; break; case RIG_LEVEL_BALANCE: - retval = thd72_get_menu_item(rig, 13, '4', &l); + retval = thd72_get_menu_item(rig, 13, 4, &l); if (retval != RIG_OK) return retval; /* FIXME - is balance 0.0 .. 1.0 or -1.0 .. 1.0? */ @@ -782,7 +782,7 @@ static int thd72_get_parm(RIG *rig, setting_t parm, value_t *val) switch (parm) { case RIG_PARM_APO: - retval = thd72_get_menu_item(rig, 3, '3', &l); + retval = thd72_get_menu_item(rig, 3, 3, &l); if (retval != RIG_OK) return retval; val->i = thd72apo[l]; From d5968a3e9a8a5081e79a48514b00621df10b179e Mon Sep 17 00:00:00 2001 From: phaethon Date: Mon, 1 Oct 2018 16:54:29 +0300 Subject: [PATCH 04/12] Improving reliability working with radios cloning FT817 protocol (increase timeout, double reading frequency, checking ptt status after setting it) --- yaesu/ft817.c | 49 +++++++++++++++++++++++++++++++++++++------------ yaesu/ft817.h | 2 +- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/yaesu/ft817.c b/yaesu/ft817.c index e3cf62cc4..589a9120e 100644 --- a/yaesu/ft817.c +++ b/yaesu/ft817.c @@ -177,7 +177,7 @@ const struct rig_caps ft817_caps = { .write_delay = FT817_WRITE_DELAY, .post_write_delay = FT817_POST_WRITE_DELAY, .timeout = FT817_TIMEOUT, - .retry = 3, + .retry = 5, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER, @@ -456,17 +456,27 @@ int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; + freq_t f1 = 0, f2 = 0; + int retries = rig->state.rigport.retry + 1; // +1 because, because 2 steps are needed even in best scenario if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; - if (check_cache_timeout(&p->fm_status_tv)) - if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) - return n; + while ((f1 == 0 || f1 != f2) && retries-- > 0) { + if (check_cache_timeout(&p->fm_status_tv)) + if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) + return n; + f1 = f2; + f2 = from_bcd_be(p->fm_status, 8); + } - *freq = from_bcd_be(p->fm_status, 8) * 10; + if (retries >= 0) { + *freq = f1 * 10; + return RIG_OK; + } else { + return -RIG_EIO; + } - return RIG_OK; } int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) @@ -842,6 +852,8 @@ int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int index, n; + ptt_t ptt_response = -1; + int retries = rig->state.rigport.retry; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; @@ -859,15 +871,28 @@ int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) return -RIG_EINVAL; } - n = ft817_send_cmd(rig, index); - rig_force_cache_timeout( - &((struct ft817_priv_data *)rig->state.priv)->tx_status_tv); + do { + n = ft817_send_cmd(rig, index); - if (n < 0 && n != -RIG_ERJCTED) - return n; + rig_force_cache_timeout( + &((struct ft817_priv_data *)rig->state.priv)->tx_status_tv); + + if (n < 0 && n != -RIG_ERJCTED) + return n; + + if (ft817_get_ptt(rig, vfo, &ptt_response) != RIG_OK) { + ptt_response = -1; + } + + } while (ptt_response != ptt && retries-- > 0); + + if (retries >=0) { + return RIG_OK; + } else { + return -RIG_EIO; + } - return RIG_OK; } int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status) diff --git a/yaesu/ft817.h b/yaesu/ft817.h index 78aad0ba9..607a2d315 100644 --- a/yaesu/ft817.h +++ b/yaesu/ft817.h @@ -50,7 +50,7 @@ /* * Read timeout. */ -#define FT817_TIMEOUT 1000 +#define FT817_TIMEOUT 3000 /* * The time the TX, RX and FREQ/MODE status are cached (in millisec). From a95d1f1c87d814ad3f1c2a62d9055e469e206103 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Wed, 3 Oct 2018 11:29:15 -0500 Subject: [PATCH 05/12] Fix multi-mode-mapping --- dummy/flrig.c | 61 ++++++++++++++++++++++++++++++++------------------- dummy/flrig.h | 2 +- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/dummy/flrig.c b/dummy/flrig.c index 25fd22cc9..b067c5f5d 100644 --- a/dummy/flrig.c +++ b/dummy/flrig.c @@ -168,33 +168,31 @@ const struct rig_caps flrig_caps = { // Structure for mapping flrig dynmamic modes to hamlib modes // flrig displays modes as the rig displays them -// hamlib displays modes in generic form -#define MAXMODELEN 8 struct s_modeMap { int mode_hamlib; - char mode_flrig[MAXMODELEN]; + char *mode_flrig; }; // FLRig will provide us the modes for the selected rig // We will then put them in this struct static struct s_modeMap modeMap[]= { - {RIG_MODE_USB,""}, - {RIG_MODE_LSB,""}, - {RIG_MODE_PKTUSB,""}, - {RIG_MODE_PKTLSB,""}, - {RIG_MODE_PKTUSB,""}, - {RIG_MODE_PKTLSB,""}, - {RIG_MODE_AM,""}, - {RIG_MODE_FM,""}, - {RIG_MODE_FMN,""}, - {RIG_MODE_WFM,""}, - {RIG_MODE_CW,""}, - {RIG_MODE_CW,""}, - {RIG_MODE_CWR,""}, - {RIG_MODE_CWR,""}, - {RIG_MODE_RTTY,""}, - {RIG_MODE_RTTYR,""}, - {0,""} + {RIG_MODE_USB,NULL}, + {RIG_MODE_LSB,NULL}, + {RIG_MODE_PKTUSB,NULL}, + {RIG_MODE_PKTLSB,NULL}, + {RIG_MODE_PKTUSB,NULL}, + {RIG_MODE_PKTLSB,NULL}, + {RIG_MODE_AM,NULL}, + {RIG_MODE_FM,NULL}, + {RIG_MODE_FMN,NULL}, + {RIG_MODE_WFM,NULL}, + {RIG_MODE_CW,NULL}, + {RIG_MODE_CW,NULL}, + {RIG_MODE_CWR,NULL}, + {RIG_MODE_CWR,NULL}, + {RIG_MODE_RTTY,NULL}, + {RIG_MODE_RTTYR,NULL}, + {0,NULL} }; /* @@ -463,9 +461,11 @@ static char * modeMapGetFLRig(unsigned int modeHamlib) static unsigned int modeMapGetHamlib(const char *modeFLRig) { int i; + char modeFLRigCheck[64]; + snprintf(modeFLRigCheck,sizeof(modeFLRigCheck),"|%.32s|",modeFLRig); rig_debug(RIG_DEBUG_VERBOSE,"%s: get hamlib mode from %s\n",__FUNCTION__,modeFLRig); for(i=0; modeMap[i].mode_hamlib!=0; ++i) { - if (streq(modeMap[i].mode_flrig,modeFLRig)) { + if (strstr(modeMap[i].mode_flrig,modeFLRigCheck)) { rig_debug(RIG_DEBUG_VERBOSE,"%s: got hamlib mode %s\n",__FUNCTION__,rig_strrmode(modeMap[i].mode_hamlib)); return modeMap[i].mode_hamlib; } @@ -482,10 +482,26 @@ static unsigned int modeMapGetHamlib(const char *modeFLRig) static void modeMapAdd(unsigned int *modes,int mode_hamlib,char *mode_flrig) { int i; + rig_debug(RIG_DEBUG_VERBOSE,"%s:mode_flrig=%s\n",__FUNCTION__,mode_flrig); + int len1 = strlen(mode_flrig)+3; /* bytes needed for allocating */ for(i=0; modeMap[i].mode_hamlib!=0; ++i) { if (modeMap[i].mode_hamlib==mode_hamlib) { *modes |= modeMap[i].mode_hamlib; - strncpy(modeMap[i].mode_flrig,mode_flrig,sizeof(modeMap[i].mode_flrig)); + /* we will pipe delimit all the entries for easier matching */ + /* all entries will have pipe symbol on both sides */ + if (modeMap[i].mode_flrig == NULL) { + modeMap[i].mode_flrig = calloc(1,len1); + if (modeMap[i].mode_flrig == NULL) { + rig_debug(RIG_DEBUG_ERR,"%s: error allocating memory for modeMap\n",__FUNCTION__); + return; + } + } + int len2 = strlen(modeMap[i].mode_flrig); /* current len w/o null */ + modeMap[i].mode_flrig = realloc(modeMap[i].mode_flrig,strlen(modeMap[i].mode_flrig)+len1); + if (strlen(modeMap[i].mode_flrig)==0) modeMap[i].mode_flrig[0]='|'; + strncat(modeMap[i].mode_flrig,mode_flrig,len1+len2); + strncat(modeMap[i].mode_flrig,"|",len1+len2); + rig_debug(RIG_DEBUG_VERBOSE,"%s: Adding mode=%s at %d, index=%d, result=%s\n",__FUNCTION__,mode_flrig, mode_hamlib, i, modeMap[i].mode_flrig); return; } } @@ -617,6 +633,7 @@ static int flrig_open(RIG *rig) { else if (streq(p,"RTTY-L")) modeMapAdd(&modes,RIG_MODE_RTTYR,p); else if (streq(p,"RTTY(U)")) modeMapAdd(&modes,RIG_MODE_RTTY,p); else if (streq(p,"RTTY(R")) modeMapAdd(&modes,RIG_MODE_RTTYR,p); + else if (streq(p,"DIG")) modeMapAdd(&modes,RIG_MODE_PKTUSB,p); else rig_debug(RIG_DEBUG_ERR,"%s: Unknown mode for this rig='%s'\n",__FUNCTION__,p); } rig->state.mode_list = modes; diff --git a/dummy/flrig.h b/dummy/flrig.h index 0c5153199..10ede864a 100644 --- a/dummy/flrig.h +++ b/dummy/flrig.h @@ -28,7 +28,7 @@ #include #endif -#define BACKEND_VER "1.4" +#define BACKEND_VER "1.5" #define EOM "\r" #define TRUE 1 From aadd458b99e4defc9867f775a6fe9243e8336b1e Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sun, 7 Oct 2018 07:51:13 -0500 Subject: [PATCH 06/12] Ensure read_string value is terminated --- src/iofunc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iofunc.c b/src/iofunc.c index 8cd0966a9..432375cae 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -692,6 +692,8 @@ int HAMLIB_API read_string(hamlib_port_t *p, /* Store the time of the read loop start */ gettimeofday(&start_time, NULL); + rxbuffer[0] = 0; /* ensure string is terminated */ + while (total_count < rxmax - 1) { tv = tv_timeout; /* select may have updated it */ From a3ea2864a77d6b768770b8f5dbb7474151d2b198 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sun, 7 Oct 2018 08:11:30 -0500 Subject: [PATCH 07/12] Fix icmarine duplicate read --- icmarine/icm802.c | 4 +-- icmarine/icmarine.c | 83 +++++++++++++++++++++++++++++++++------------ icmarine/icmarine.h | 2 +- 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/icmarine/icm802.c b/icmarine/icm802.c index 56b914ea8..391c11f34 100644 --- a/icmarine/icm802.c +++ b/icmarine/icm802.c @@ -58,9 +58,9 @@ const struct rig_caps icm802_caps = { .rig_model = RIG_MODEL_IC_M802, .model_name = "IC-M802", .mfg_name = "Icom", -.version = BACKEND_VER, +.version = BACKEND_VER".1", .copyright = "LGPL", -.status = RIG_STATUS_UNTESTED, +.status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, diff --git a/icmarine/icmarine.c b/icmarine/icmarine.c index 0d20d3a15..969265df7 100644 --- a/icmarine/icmarine.c +++ b/icmarine/icmarine.c @@ -220,14 +220,14 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param, char *res int cmd_len = 0; unsigned csum = 0; + rig_debug(RIG_DEBUG_TRACE, "%s: cmd='%s', param=%s\n",__FUNCTION__,cmd,param); + rs = &rig->state; priv = (struct icmarine_priv_data *)rs->priv; serial_flush(&rs->rigport); /* command formating */ - cmdbuf[BUFSZ]='\0'; - cmd_len = snprintf(cmdbuf, BUFSZ, "$PICOA,%02u,%02u,%s", CONTROLLER_ID, priv->remote_id, @@ -258,8 +258,6 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param, char *res if (retval < OFFSET_CMD+5) return -RIG_EPROTO; - respbuf[retval] = 0; - /* check response */ if (memcmp(respbuf, "$PICOA,", strlen("$PICOA,"))) return -RIG_EPROTO; @@ -274,20 +272,22 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param, char *res return -RIG_ERJCTED; } - /* So this is a query */ - retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF)); - if (retval < 0) - return retval; - - /* strip *checksum and CR/LF from string */ - respbuf[retval-5] = 0; - - p = strchr(respbuf+OFFSET_CMD, ','); + /* strip from *checksum and after */ + char *strip = strrchr(respbuf,'*'); + if (strip) { + *strip = 0; + } + else { + rig_debug(RIG_DEBUG_ERR, "%s: checksum not in response? response='%s'\n",__FUNCTION__,respbuf); + return -RIG_EPROTO; + } + p = strrchr(respbuf, ','); if (p) strncpy(response, p+1, BUFSZ); else return -RIG_EPROTO; + rig_debug(RIG_DEBUG_VERBOSE, "%s: returning response='%s'\n", __FUNCTION__,response); return RIG_OK; } @@ -297,6 +297,8 @@ int icmarine_set_freq(RIG *rig, vfo_t vfo, freq_t freq) char freqbuf[BUFSZ]; struct icmarine_priv_data *priv; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + priv = (struct icmarine_priv_data*)rig->state.priv; sprintf(freqbuf, "%.6f", freq/MHz(1)); @@ -318,6 +320,8 @@ int icmarine_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) char freqbuf[BUFSZ] = ""; double d; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + retval = icmarine_transaction (rig, CMD_RXFREQ, NULL, freqbuf); if (retval != RIG_OK) return retval; @@ -325,8 +329,10 @@ int icmarine_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (freqbuf[0] == '\0') { *freq = 0; } else { - if (sscanf(freqbuf, "%lf", &d) != 1) + if (sscanf(freqbuf, "%lf", &d) != 1) { + rig_debug(RIG_DEBUG_ERR,"%s: sscanf('%s') failed\n",__FUNCTION__,freqbuf); return -RIG_EPROTO; + } *freq = (freq_t)(d*MHz(1)); } @@ -338,6 +344,8 @@ int icmarine_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + sprintf(freqbuf, "%.6f", freq/MHz(1)); return icmarine_transaction (rig, CMD_TXFREQ, freqbuf, NULL); @@ -349,6 +357,8 @@ int icmarine_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq) char freqbuf[BUFSZ] = ""; double d; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + retval = icmarine_transaction (rig, CMD_TXFREQ, NULL, freqbuf); if (retval != RIG_OK) return retval; @@ -369,8 +379,9 @@ int icmarine_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo) { struct icmarine_priv_data *priv; - priv = (struct icmarine_priv_data *)rig->state.priv; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + priv = (struct icmarine_priv_data *)rig->state.priv; /* when disabling split mode */ if (RIG_SPLIT_ON == priv->split && @@ -390,6 +401,8 @@ int icmarine_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo { struct icmarine_priv_data *priv; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + priv = (struct icmarine_priv_data *)rig->state.priv; *split = priv->split; @@ -403,6 +416,8 @@ int icmarine_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { const char *pmode; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + switch (mode) { case RIG_MODE_CW: pmode = MD_CW; break; case RIG_MODE_USB: pmode = MD_USB; break; @@ -424,11 +439,12 @@ int icmarine_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) int retval; char modebuf[BUFSZ]; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + retval = icmarine_transaction (rig, CMD_MODE, NULL, modebuf); if (retval != RIG_OK) return retval; - if (!memcmp(modebuf, MD_LSB, strlen(MD_LSB))) *mode = RIG_MODE_LSB; else if (!memcmp(modebuf, MD_USB, strlen(MD_USB))) @@ -453,8 +469,15 @@ int icmarine_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) */ int icmarine_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { - return icmarine_transaction (rig, CMD_PTT, + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + + int retval = icmarine_transaction (rig, CMD_PTT, ptt == RIG_PTT_ON ? "TX" : "RX", NULL); + if (retval != RIG_OK) { + rig_debug(RIG_DEBUG_ERR, "%s: transaction failed\n",__FUNCTION__); + return retval; + } + return RIG_OK; } int icmarine_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) @@ -462,17 +485,23 @@ int icmarine_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) char pttbuf[BUFSZ]; int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + retval = icmarine_transaction (rig, CMD_PTT, NULL, pttbuf); - if (retval != RIG_OK) + if (retval != RIG_OK) { + rig_debug(RIG_DEBUG_ERR, "%s: transaction failed\n",__FUNCTION__); return retval; + } - if (!strcmp(pttbuf, "TX")) + if (strncmp(pttbuf, "TX",2)==0) *ptt = RIG_PTT_ON; - else if (!strcmp(pttbuf, "RX")) + else if (strncmp(pttbuf, "RX",2)==0) *ptt = RIG_PTT_OFF; - else + else { + rig_debug(RIG_DEBUG_ERR, "%s: invalid pttbuf='%s'\n",__FUNCTION__,pttbuf); retval = -RIG_EPROTO; + } return retval; } @@ -482,6 +511,8 @@ int icmarine_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) char dcdbuf[BUFSZ]; int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + retval = icmarine_transaction (rig, CMD_SQLS, NULL, dcdbuf); if (retval != RIG_OK) @@ -499,6 +530,8 @@ int icmarine_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) int icmarine_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + if (RIG_OP_TUNE != op && RIG_OP_NONE != op) return -RIG_EINVAL; @@ -510,6 +543,8 @@ int icmarine_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + switch(func) { case RIG_FUNC_NB: retval = icmarine_transaction (rig, CMD_NB, status ? "ON":"OFF", NULL); @@ -527,6 +562,8 @@ int icmarine_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) char funcbuf[BUFSZ]; int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + switch(func) { case RIG_FUNC_NB: retval = icmarine_transaction (rig, CMD_NB, NULL, funcbuf); @@ -547,6 +584,8 @@ int icmarine_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) char lvlbuf[BUFSZ]; int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + switch(level) { case RIG_LEVEL_AF: sprintf(lvlbuf, "%u", (unsigned)(val.f * 255)); @@ -580,6 +619,8 @@ int icmarine_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) char lvlbuf[BUFSZ]; int retval; + rig_debug(RIG_DEBUG_TRACE, "%s:\n",__FUNCTION__); + switch(level) { case RIG_LEVEL_RAWSTR: retval = icmarine_transaction (rig, CMD_SMETER, NULL, lvlbuf); diff --git a/icmarine/icmarine.h b/icmarine/icmarine.h index dd002a4d1..ca097eea8 100644 --- a/icmarine/icmarine.h +++ b/icmarine/icmarine.h @@ -30,7 +30,7 @@ #include #endif -#define BACKEND_VER "0.1" +#define BACKEND_VER "0.2" struct icmarine_priv_caps { unsigned char default_remote_id; /* the remote default equipment's ID */ From 2d7d3d21df5d2ae2113a588032d260c3ba51981f Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 25 Oct 2018 16:36:41 -0500 Subject: [PATCH 08/12] Quell gcc 8.2.0 warning of possible truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following warning: CC ft991.lo ../../hamlib/yaesu/ft991.c: In function ‘ft991_set_split_mode’: ../../hamlib/yaesu/ft991.c:336:5: warning: ‘strncat’ output may be truncated copying 128 bytes from a string of length 128 [-Wstringop-truncation] strncat (restore_commands, priv->ret_data, NEWCAT_DATA_LEN-1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ At least now the warning is gone... --- yaesu/ft991.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yaesu/ft991.c b/yaesu/ft991.c index deaebbb22..7b052df22 100644 --- a/yaesu/ft991.c +++ b/yaesu/ft991.c @@ -289,7 +289,7 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wi * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * - * Comments: Passs band is not set here nor does it make sense as the + * Comments: Pass band is not set here nor does it make sense as the * FT991 cannot receive on VFO B. The FT991 cannot set * VFO B mode directly so we'll just set A and swap A * into B but we must preserve the VFO A mode and VFO B @@ -333,7 +333,7 @@ int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_widt { return err; } - strncat (restore_commands, priv->ret_data, NEWCAT_DATA_LEN-1); + strncpy(restore_commands, priv->ret_data, NEWCAT_DATA_LEN); /* Change mode on VFOA */ if (RIG_OK != (err = newcat_set_mode (rig, RIG_VFO_A, tx_mode, RIG_PASSBAND_NOCHANGE))) From ac540c82ccb5225d06f364335fd84531c744c5b1 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 25 Oct 2018 16:58:51 -0500 Subject: [PATCH 09/12] Quell gcc 8.2.0 warning of possible truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following warning: CC network.lo ../../hamlib/src/network.c: In function ‘network_open’: ../../hamlib/src/network.c:245:46: warning: ‘%s’ directive output may be truncated writing up to 511 bytes into a region of size 139 [-Wformat-truncation=] snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname); ^~ ../../hamlib/src/network.c:245:9: note: ‘snprintf’ output between 44 and 555 bytes into a destination of size 150 snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Raising the size of the msg buffer to 1024 quelled the warning. --- src/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network.c b/src/network.c index fc011fe4c..143f59c4f 100644 --- a/src/network.c +++ b/src/network.c @@ -241,7 +241,7 @@ int network_open(hamlib_port_t *rp, int default_port) { break; } - char msg[150]; + char msg[1024]; snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname); handle_error(RIG_DEBUG_WARN, msg); From b0ebeaeda44f18943dcf93db7bb5537a22bf7401 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 25 Oct 2018 18:26:25 -0500 Subject: [PATCH 10/12] Quell gcc 8.2.0 defined but not used warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following warning: CC rigctl.o ../../hamlib/tests/rigctl.c:125:18: warning: ‘have_rl’ defined but not used [-Wunused-const-variable=] static const int have_rl = 0; ^~~~~~~ and: CC rotctl.o ../../hamlib/tests/rotctl.c:113:18: warning: ‘have_rl’ defined but not used [-Wunused-const-variable=] static const int have_rl = 0; ^~~~~~~ Turns out I didn't have the readline-dev package installed. As the have_rl variable is wrapped in CPP macros, it indeed is not used when readline is not available. --- tests/rigctl.c | 16 ++++++++-------- tests/rotctl.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/rigctl.c b/tests/rigctl.c index 1f5582a68..c79b4628d 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -121,8 +121,6 @@ static struct option long_options[] = /* variable for readline support */ #ifdef HAVE_LIBREADLINE static const int have_rl = 1; -#else /* no readline */ -static const int have_rl = 0; #endif @@ -143,6 +141,7 @@ int main(int argc, char *argv[]) int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; + #ifdef HAVE_READLINE_HISTORY int rd_hist = 0; int sv_hist = 0; @@ -150,7 +149,8 @@ int main(int argc, char *argv[]) const char hist_file[] = "/.rigctl_history"; char *hist_path = NULL; struct stat hist_dir_stat; -#endif +#endif /* HAVE_READLINE_HISTORY */ + const char *rig_file = NULL, *ptt_file = NULL, *dcd_file = NULL; ptt_type_t ptt_type = RIG_PTT_NONE; dcd_type_t dcd_type = RIG_DCD_NONE; @@ -389,7 +389,7 @@ int main(int argc, char *argv[]) case 'I': sv_hist++; break; -#endif +#endif /* HAVE_READLINE_HISTORY */ case 'v': verbose++; @@ -570,7 +570,7 @@ int main(int argc, char *argv[]) } } -#endif +#endif /* HAVE_READLINE_HISTORY */ } #endif /* HAVE_LIBREADLINE */ @@ -608,11 +608,11 @@ int main(int argc, char *argv[]) hist_path = (char *)NULL; } -#endif +#endif /* HAVE_READLINE_HISTORY */ } -#endif - rig_close(my_rig); /* close port */ +#endif /* HAVE_LIBREADLINE */ + rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ return exitcode; diff --git a/tests/rotctl.c b/tests/rotctl.c index 0474d0cb0..0d79f562a 100644 --- a/tests/rotctl.c +++ b/tests/rotctl.c @@ -109,8 +109,6 @@ static struct option long_options[] = /* variable for readline support */ #ifdef HAVE_LIBREADLINE static const int have_rl = 1; -#else /* no readline */ -static const int have_rl = 0; #endif @@ -131,6 +129,7 @@ int main(int argc, char *argv[]) int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; + #ifdef HAVE_READLINE_HISTORY int rd_hist = 0; int sv_hist = 0; @@ -138,7 +137,8 @@ int main(int argc, char *argv[]) const char hist_file[] = "/.rotctl_history"; char *hist_path = NULL; struct stat hist_dir_stat; -#endif +#endif /* HAVE_READLINE_HISTORY */ + const char *rot_file = NULL; int serial_rate = 0; char conf_parms[MAXCONFLEN] = ""; @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) case 'I': sv_hist++; break; -#endif +#endif /* HAVE_READLINE_HISTORY */ case 'v': verbose++; @@ -395,7 +395,7 @@ int main(int argc, char *argv[]) } } -#endif +#endif /* HAVE_READLINE_HISTORY */ } #endif /* HAVE_LIBREADLINE */ @@ -433,11 +433,11 @@ int main(int argc, char *argv[]) hist_path = (char *)NULL; } -#endif +#endif /* HAVE_READLINE_HISTORY */ } -#endif - rot_close(my_rot); /* close port */ +#endif /* HAVE_LIBREADLINE */ + rot_close(my_rot); /* close port */ rot_cleanup(my_rot); /* if you care about memory */ return exitcode; From 82e31653a1a3a2bf6972dbbe783c1cf03969f370 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 25 Oct 2018 20:44:59 -0500 Subject: [PATCH 11/12] Quell gcc 8.2.0 warning of uninitialized value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following warnings: CC funcube.lo ../../hamlib/kit/funcube.c: In function ‘funcubepro_get_level’: ../../hamlib/kit/funcube.c:783:87: warning: ‘au8BufOut[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized] __func__, au8BufOut[0] & 0xFF, au8BufOut[1] & 0xFF, au8BufOut[2] & 0xFF, au8BufOut[3] & 0xFF); ~~~~~~~~~^~~ ../../hamlib/kit/funcube.c:783:66: warning: ‘au8BufOut[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized] __func__, au8BufOut[0] & 0xFF, au8BufOut[1] & 0xFF, au8BufOut[2] & 0xFF, au8BufOut[3] & 0xFF); ~~~~~~~~~^~~ ../../hamlib/kit/funcube.c:783:45: warning: ‘au8BufOut[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized] __func__, au8BufOut[0] & 0xFF, au8BufOut[1] & 0xFF, au8BufOut[2] & 0xFF, au8BufOut[3] & 0xFF); ~~~~~~~~~^~~ ../../hamlib/kit/funcube.c: In function ‘funcubepro_set_level’: ../../hamlib/kit/funcube.c:730:87: warning: ‘au8BufOut[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized] __func__, au8BufOut[0] & 0xFF, au8BufOut[1] & 0xFF, au8BufOut[2] & 0xFF, au8BufOut[3] & 0xFF); ~~~~~~~~~^~~ ../../hamlib/kit/funcube.c:730:66: warning: ‘au8BufOut[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized] __func__, au8BufOut[0] & 0xFF, au8BufOut[1] & 0xFF, au8BufOut[2] & 0xFF, au8BufOut[3] & 0xFF); ~~~~~~~~~^~~ Initialize au8BufOut and au8BufIn to 0 to quell the warning. --- kit/funcube.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kit/funcube.c b/kit/funcube.c index c44a8588d..9fc1adb9d 100644 --- a/kit/funcube.c +++ b/kit/funcube.c @@ -174,12 +174,12 @@ const struct rig_caps funcubeplus_caps = { .has_get_level = RIG_LEVEL_ATT | RIG_LEVEL_PREAMP | RIG_LEVEL_RF, // RIG_LEVEL_ATT: Mixer gain on/off // RIG_LEVEL_PREAMP: LNA gain on/off // RIG_LEVEL_RF 0..1 : IF gain 0 .. 59 dB - - + + .has_set_level = RIG_LEVEL_ATT | RIG_LEVEL_PREAMP | RIG_LEVEL_RF, // RIG_LEVEL_ATT: Mixer gain on/off // RIG_LEVEL_PREAMP: LNA gain on/off // RIG_LEVEL_RF 0..1 : IF gain 0 .. 59 dB - // so values have to be mapped + // so values have to be mapped .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, @@ -700,8 +700,8 @@ int funcubepro_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) libusb_device_handle *udh = rig->state.rigport.handle; int ret; int actual_length; - unsigned char au8BufOut[64]; // endpoint size - unsigned char au8BufIn[64]; // endpoint size + unsigned char au8BufOut[64] = { 0 }; // endpoint size + unsigned char au8BufIn[64] = { 0 }; // endpoint size switch (level) { case RIG_LEVEL_PREAMP: @@ -719,7 +719,7 @@ int funcubepro_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) if( au8BufOut[1] > 59 ) au8BufOut[1]= 59; break; - + default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported level %d\n", __func__, level); @@ -761,8 +761,8 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) libusb_device_handle *udh = rig->state.rigport.handle; int ret; int actual_length; - unsigned char au8BufOut[64]; // endpoint size - unsigned char au8BufIn[64]; // endpoint size + unsigned char au8BufOut[64] = { 0 }; // endpoint size + unsigned char au8BufIn[64] = { 0 }; // endpoint size switch (level) { case RIG_LEVEL_ATT: @@ -773,7 +773,7 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; case RIG_LEVEL_RF: au8BufOut[0] = REQUEST_GET_IF_GAIN; - break; + break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported level %d\n", __func__, level); return -RIG_EINVAL; @@ -809,7 +809,7 @@ int funcubepro_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) switch (level) { case RIG_LEVEL_PREAMP: case RIG_LEVEL_ATT: - val->i = au8BufIn[2] &0x01; + val->i = au8BufIn[2] &0x01; break; case RIG_LEVEL_RF: From 1ecadcc59440d3cf10ba55d1b2ddb0b4d1c025d6 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Sat, 27 Oct 2018 20:49:20 -0500 Subject: [PATCH 12/12] Quell various defined but not used warnings from MinGW Enclose various variable and function definitions in CPP macro blocks to quell warnings when cross-compiling for Microsoft Windows using MinGW. --- src/microham.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/microham.c b/src/microham.c index b440a6d35..631104fd4 100644 --- a/src/microham.c +++ b/src/microham.c @@ -78,8 +78,10 @@ #define PATH_MAX 256 #endif +#if !(defined(WIN32) || !defined(HAVE_GLOB_H)) static char uh_device_path[PATH_MAX]; // use PATH_MAX since udev names can be VERY long! +#endif static int uh_device_fd = -1; static int uh_is_initialized = 0; @@ -106,14 +108,18 @@ static pthread_t readthread; #define freelock() #endif +#if defined(HAVE_SELECT) // // time of last heartbeat. Updated by heartbeat() // static time_t lastbeat = 0; +#endif + +#if defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT) static time_t starttime; #define TIME ((int) (time(NULL) - starttime)) - +#endif // // close all sockets and mark them free @@ -205,9 +211,12 @@ static void close_microham() * number begins with MK, M2, CK, DK, D2, 2R, 2P or UR. Then, open the serial * line with correct serial speed etc. and put a valid fd into uh_device_fd. */ -static void finddevices() -{ -} +/* Commenting out the following dummy function to quell the warning from + * MinGW's GCC of a defined but not used function. + */ +/* static void finddevices() */ +/* { */ +/* } */ #else @@ -381,6 +390,7 @@ static void finddevices() #endif +#if defined(HAVE_SELECT) // // parse a frame received from the keyer // This is called from the "device reading" thread @@ -500,8 +510,10 @@ static void parseFrame(unsigned char *frame) } } } +#endif /* HAVE_SELECT */ +#if defined(HAVE_SELECT) // // Send radio bytes to microHam device // @@ -548,6 +560,7 @@ static void writeRadio(unsigned char *bytes, int len) freelock(); } +#endif /* HAVE_SELECT */ // @@ -585,6 +598,7 @@ static void writeFlags() } +#if defined(HAVE_SELECT) // // Send bytes to the WinKeyer within microHam device // @@ -639,6 +653,7 @@ static void writeWkey(unsigned char *bytes, int len) freelock(); } +#endif /* HAVE_SELECT */ // @@ -701,6 +716,7 @@ static void writeControl(unsigned char *data, int len) } +#if defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT) // // send a heartbeat and record time // The "last heartbeat" time is recorded in a global variable @@ -716,8 +732,10 @@ static void heartbeat() writeControl(seq, 2); lastbeat = time(NULL); } +#endif /* defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT) */ +#if defined(HAVE_SELECT) // // This thread reads from the microHam device and puts data on the sockets // it also issues periodic heartbeat messages @@ -725,7 +743,6 @@ static void heartbeat() // static void *read_device(void *p) { -#if defined(HAVE_SELECT) unsigned char frame[4]; int framepos = 0; int ret; @@ -862,9 +879,9 @@ static void *read_device(void *p) } } -#endif - return NULL; +// return NULL; } +#endif /*