X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffluke-dmm%2Fapi.c;h=dc55aa4143cf3ad16727907945e222f09f4c6d35;hb=700d6b64d578ce10e57f6a2289e37a5564eccf1c;hp=216c6359c83c721e0eab3805cd2985b0885cca08;hpb=329733d92c5004f0fe308eff26b9537fded2cdf3;p=libsigrok.git diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index 216c6359..dc55aa41 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -17,13 +17,13 @@ * along with this program. If not, see . */ +#include #include #include #include #include #include -#include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #include "fluke-dmm.h" @@ -56,6 +56,7 @@ static const struct flukedmm_profile supported_flukedmm[] = { { FLUKE_189, "189", 100, 1000 }, { FLUKE_287, "287", 100, 1000 }, { FLUKE_190, "199B", 1000, 3500 }, + { FLUKE_289, "289", 100, 1000 }, }; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) @@ -79,7 +80,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn, if (serial_open(serial, SERIAL_RDWR) != SR_OK) return NULL; - drvc = di->priv; + drvc = di->context; b = buf; retry = 0; devices = NULL; @@ -181,7 +182,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) break; /* The Scopemeter 199B, at least, requires this * after all the 115k/9.6k confusion. */ - g_usleep(5000); + g_usleep(5 * 1000); } } @@ -190,12 +191,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; -} - -static int cleanup(const struct sr_dev_driver *di) -{ - return std_dev_clear(di, NULL); + return ((struct drv_context *)(di->context))->instances; } static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, @@ -216,18 +212,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd switch (key) { case SR_CONF_LIMIT_MSEC: /* TODO: not yet implemented */ - if (g_variant_get_uint64(data) == 0) { - sr_err("LIMIT_MSEC can't be 0."); - return SR_ERR; - } devc->limit_msec = g_variant_get_uint64(data); - sr_dbg("Setting time limit to %" PRIu64 "ms.", - devc->limit_msec); break; case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); - sr_dbg("Setting sample limit to %" PRIu64 ".", - devc->limit_samples); break; default: return SR_ERR_NA; @@ -258,7 +246,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_OK; } -static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_serial_dev_inst *serial; @@ -266,15 +254,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!(devc = sdi->priv)) { - sr_err("sdi->priv was NULL."); - return SR_ERR_BUG; - } - - devc->cb_data = cb_data; + devc = sdi->priv; - /* Send header packet to the session bus. */ - std_session_send_df_header(cb_data, LOG_PREFIX); + std_session_send_df_header(sdi, LOG_PREFIX); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -291,9 +273,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_OK; } -static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_stop(struct sr_dev_inst *sdi) { - return std_serial_dev_acquisition_stop(sdi, cb_data, std_serial_dev_close, + return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, sdi->conn, LOG_PREFIX); } @@ -302,7 +284,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = { .longname = "Fluke 18x/28x series DMMs", .api_version = 1, .init = init, - .cleanup = cleanup, + .cleanup = std_cleanup, .scan = scan, .dev_list = dev_list, .dev_clear = NULL, @@ -313,5 +295,5 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = { .dev_close = std_serial_dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };