agilent-dmm: Fix blocking serial write timeout.
This commit is contained in:
parent
4ab01c3564
commit
95779b43b8
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#define AGDMM_BUFSIZE 256
|
#define AGDMM_BUFSIZE 256
|
||||||
|
|
||||||
|
/* Always USB-serial, 1ms is plenty. */
|
||||||
|
#define SERIAL_WRITE_TIMEOUT_MS 1
|
||||||
|
|
||||||
/* Supported models */
|
/* Supported models */
|
||||||
enum {
|
enum {
|
||||||
AGILENT_U1231 = 1,
|
AGILENT_U1231 = 1,
|
||||||
|
|
|
@ -116,7 +116,7 @@ static GSList *scan(GSList *options)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
serial_flush(serial);
|
serial_flush(serial);
|
||||||
if (serial_write_blocking(serial, "*IDN?\r\n", 7, 0) < 7) {
|
if (serial_write_blocking(serial, "*IDN?\r\n", 7, SERIAL_WRITE_TIMEOUT_MS) < 7) {
|
||||||
sr_err("Unable to send identification string.");
|
sr_err("Unable to send identification string.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd)
|
||||||
strcat(buf, "\r\n");
|
strcat(buf, "\r\n");
|
||||||
else
|
else
|
||||||
strcat(buf, "\n\r\n");
|
strcat(buf, "\n\r\n");
|
||||||
if (serial_write_blocking(serial, buf, strlen(buf), 0) < (int)strlen(buf)) {
|
if (serial_write_blocking(serial, buf, strlen(buf), SERIAL_WRITE_TIMEOUT_MS) < (int)strlen(buf)) {
|
||||||
sr_err("Failed to send.");
|
sr_err("Failed to send.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue