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:
parent
d92faf6cac
commit
d4b11de09a
|
@ -50,8 +50,9 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info;
|
||||||
static struct sr_dev_driver *di = &flukedmm_driver_info;
|
static struct sr_dev_driver *di = &flukedmm_driver_info;
|
||||||
|
|
||||||
static const struct flukedmm_profile supported_flukedmm[] = {
|
static const struct flukedmm_profile supported_flukedmm[] = {
|
||||||
{ FLUKE_187, "187", 100 },
|
{ FLUKE_187, "187", 100, 1000 },
|
||||||
{ FLUKE_287, "287", 100 },
|
{ FLUKE_287, "287", 100, 1000 },
|
||||||
|
{ FLUKE_190, "199B", 1000, 3500 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ struct flukedmm_profile {
|
||||||
const char *modelname;
|
const char *modelname;
|
||||||
/* How often to poll, in ms. */
|
/* How often to poll, in ms. */
|
||||||
int poll_period;
|
int poll_period;
|
||||||
|
/* If no response received, how long to wait before retrying. */
|
||||||
|
int timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private, per-device-instance driver context. */
|
/* Private, per-device-instance driver context. */
|
||||||
|
|
|
@ -346,11 +346,10 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data)
|
||||||
now = g_get_monotonic_time() / 1000;
|
now = g_get_monotonic_time() / 1000;
|
||||||
elapsed = now - devc->cmd_sent_at;
|
elapsed = now - devc->cmd_sent_at;
|
||||||
/* Send query command at poll_period interval, or after 1 second
|
/* Send query command at poll_period interval, or after 1 second
|
||||||
* has elapsed. This will make it recover from any out-of-sync
|
* has elapsed. This will make it easier to recover from any
|
||||||
* or temporary disconnect issues. */
|
* out-of-sync or temporary disconnect issues. */
|
||||||
if ((devc->expect_response == FALSE && elapsed > devc->profile->poll_period)
|
if ((devc->expect_response == FALSE && elapsed > devc->profile->poll_period)
|
||||||
|| elapsed > 1000) {
|
|| elapsed > devc->profile->timeout) {
|
||||||
sr_spew("Sending QM.");
|
|
||||||
if (serial_write(devc->serial, "QM\r", 3) == -1)
|
if (serial_write(devc->serial, "QM\r", 3) == -1)
|
||||||
sr_err("Unable to send QM: %s.", strerror(errno));
|
sr_err("Unable to send QM: %s.", strerror(errno));
|
||||||
devc->cmd_sent_at = now;
|
devc->cmd_sent_at = now;
|
||||||
|
|
Loading…
Reference in New Issue