From: Bert Vermeulen Date: Mon, 24 Dec 2012 09:40:04 +0000 (+0100) Subject: fluke-dmm: make poll timeout configurable X-Git-Tag: dsupstream~423 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d4b11de09a42710c1c043693d5bda0fc8bc72f90;p=libsigrok.git fluke-dmm: make poll timeout configurable Defaulted to 1s before, but a simple "QM" command on a 199B in scope mode takes 1.7s to come through. --- diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 154479cc..7ac86fc8 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -50,8 +50,9 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info; static struct sr_dev_driver *di = &flukedmm_driver_info; static const struct flukedmm_profile supported_flukedmm[] = { - { FLUKE_187, "187", 100 }, - { FLUKE_287, "287", 100 }, + { FLUKE_187, "187", 100, 1000 }, + { FLUKE_287, "287", 100, 1000 }, + { FLUKE_190, "199B", 1000, 3500 }, }; diff --git a/hardware/fluke-dmm/fluke-dmm.h b/hardware/fluke-dmm/fluke-dmm.h index 2dc6af57..1d77ac85 100644 --- a/hardware/fluke-dmm/fluke-dmm.h +++ b/hardware/fluke-dmm/fluke-dmm.h @@ -44,6 +44,8 @@ struct flukedmm_profile { const char *modelname; /* How often to poll, in ms. */ int poll_period; + /* If no response received, how long to wait before retrying. */ + int timeout; }; /* Private, per-device-instance driver context. */ diff --git a/hardware/fluke-dmm/fluke.c b/hardware/fluke-dmm/fluke.c index 078ada1d..eb7cfdc1 100644 --- a/hardware/fluke-dmm/fluke.c +++ b/hardware/fluke-dmm/fluke.c @@ -346,11 +346,10 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data) now = g_get_monotonic_time() / 1000; elapsed = now - devc->cmd_sent_at; /* Send query command at poll_period interval, or after 1 second - * has elapsed. This will make it recover from any out-of-sync - * or temporary disconnect issues. */ + * has elapsed. This will make it easier to recover from any + * out-of-sync or temporary disconnect issues. */ if ((devc->expect_response == FALSE && elapsed > devc->profile->poll_period) - || elapsed > 1000) { - sr_spew("Sending QM."); + || elapsed > devc->profile->timeout) { if (serial_write(devc->serial, "QM\r", 3) == -1) sr_err("Unable to send QM: %s.", strerror(errno)); devc->cmd_sent_at = now;