norma-dmm: Fix blocking serial write timeout.

This fixes bug #434.
This commit is contained in:
Uwe Hermann 2015-09-14 00:00:22 +02:00
parent 936b1c00e8
commit d545c81c96
2 changed files with 4 additions and 2 deletions

View File

@ -120,7 +120,8 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
nmadmm_requests[NMADMM_REQ_IDN].req_str);
g_usleep(150 * 1000); /* Wait a little to allow serial port to settle. */
for (cnt = 0; cnt < 7; cnt++) {
if (serial_write_blocking(serial, req, strlen(req), 0) < 0) {
if (serial_write_blocking(serial, req, strlen(req),
serial_timeout(serial, strlen(req))) < 0) {
sr_err("Unable to send identification request.");
return NULL;
}

View File

@ -51,7 +51,8 @@ static int nma_send_req(const struct sr_dev_inst *sdi, int req, char *params)
devc->last_req = req;
devc->last_req_pending = TRUE;
if (serial_write_blocking(serial, buf, len, 0) < 0) {
if (serial_write_blocking(serial, buf, len,
serial_timeout(serial, len)) < 0) {
sr_err("Unable to send request.");
devc->last_req_pending = FALSE;
return SR_ERR;