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.
This commit is contained in:
Bert Vermeulen 2012-12-24 10:40:04 +01:00
parent d92faf6cac
commit d4b11de09a
3 changed files with 8 additions and 6 deletions

View File

@ -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 },
};

View File

@ -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. */

View File

@ -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;