diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 0c9283255..be4959702 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1341,7 +1341,6 @@ typedef struct { int retry; /*!< Maximum number of retries, 0 to disable */ char pathname[FILPATHLEN]; /*!< Port pathname */ - int ptt_bitnum; /*< Bit number for CM108 GPIO PTT */ union { struct { int rate; /*!< Serial baud rate */ @@ -1355,6 +1354,9 @@ typedef struct { struct { int pin; /*!< Parallel port pin number */ } parallel; /*!< parallel attributes */ + struct { + int ptt_bitnum; /*< Bit number for CM108 GPIO PTT */ + } cm108; /*!< CM108 attributes */ struct { int vid; /*!< Vendor ID */ int pid; /*!< Product ID */ diff --git a/src/Makefile.am b/src/Makefile.am index 60bbc618e..cc07f4538 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,7 +6,7 @@ RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \ lib_LTLIBRARIES = libhamlib.la libhamlib_la_SOURCES = $(RIGSRC) -libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:15:0 +libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:16:0 libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(pkglibdir)\" libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la \ @NET_LIBS@ @MATH_LIBS@ $(LIBUSB_LIBS) diff --git a/src/cm108.c b/src/cm108.c index ec8434ca1..ae1059e9c 100644 --- a/src/cm108.c +++ b/src/cm108.c @@ -1,6 +1,6 @@ /* * Hamlib Interface - CM108 HID communication low-level support - * Copyright (c) 2000-2010 by Stephane Fillod + * Copyright (c) 2000-2012 by Stephane Fillod * Copyright (c) 2011 by Andrew Errington * CM108 detection code Copyright (c) Thomas Sailer used with permission * @@ -119,6 +119,7 @@ int cm108_open(hamlib_port_t *port) } else { + close(fd); rig_debug(RIG_DEBUG_VERBOSE,"cm108:No cm108 (or compatible) device detected \n"); return -RIG_EINVAL; } @@ -172,14 +173,14 @@ int cm108_ptt_set(hamlib_port_t *p, ptt_t pttx) // byte 3: xxxx xxxx SPDIF rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_ptt_set bit number %d to state %d\n", - p->ptt_bitnum, (pttx == RIG_PTT_ON) ? 1 : 0); + p->parm.cm108.ptt_bitnum, (pttx == RIG_PTT_ON) ? 1 : 0); char out_rep[] = { 0x00, // report number // HID output report 0x00, - (pttx == RIG_PTT_ON) ? (1 << p->ptt_bitnum) : 0, // set GPIO - 1 << p->ptt_bitnum, // Data direction register (1=output) + (pttx == RIG_PTT_ON) ? (1 << p->parm.cm108.ptt_bitnum) : 0, // set GPIO + 1 << p->parm.cm108.ptt_bitnum, // Data direction register (1=output) 0x00 }; @@ -217,7 +218,6 @@ int cm108_ptt_get(hamlib_port_t *p, ptt_t *pttx) switch(p->type.ptt) { case RIG_PTT_CM108: { - unsigned char ctl; int status; return -RIG_ENIMPL; return status; @@ -248,7 +248,6 @@ int cm108_dcd_get(hamlib_port_t *p, dcd_t *dcdx) switch(p->type.dcd) { case RIG_DCD_CM108: { - unsigned char reg; int status; return -RIG_ENIMPL; return status; diff --git a/src/conf.c b/src/conf.c index c5c07afef..456b6d9e2 100644 --- a/src/conf.c +++ b/src/conf.c @@ -7,7 +7,7 @@ * \file src/conf.c * \brief Rig configuration interface * \author Stephane Fillod - * \date 2000-2010 + * \date 2000-2012 */ /* * Hamlib Interface - configuration interface @@ -310,7 +310,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } - rs->pttport.ptt_bitnum=val_i; + rs->pttport.parm.cm108.ptt_bitnum=val_i; break; case TOK_DCD_TYPE: diff --git a/src/rig.c b/src/rig.c index 63fc9e23b..0e2dfc6a9 100644 --- a/src/rig.c +++ b/src/rig.c @@ -327,7 +327,7 @@ RIG * HAMLIB_API rig_init(rig_model_t rig_model) */ case RIG_PORT_CM108: strncpy(rs->rigport.pathname, DEFAULT_CM108_PORT, FILPATHLEN); - rs->rigport.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; + rs->rigport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; break; case RIG_PORT_NETWORK: