gmc-mh-1x-2x: Make serial write call block, and fix error handling.

This call was previously nonblocking, but there is no handling of partial
writes. It is called from config_set where it is free to block.

Also fix error handling: serial_write can return any negative error code,
not just -1.
This commit is contained in:
Martin Ling 2014-09-21 18:40:47 +01:00 committed by Uwe Hermann
parent 4a0eda2b70
commit e1960467ce
1 changed files with 1 additions and 1 deletions

View File

@ -1529,7 +1529,7 @@ SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *s
params[0] = 5;
params[1] = 5;
create_cmd_14(devc->addr, 6, params, msg);
if (serial_write(sdi->conn, msg, sizeof(msg)) == -1)
if (serial_write_blocking(sdi->conn, msg, sizeof(msg)) < 0)
return SR_ERR;
else
g_usleep(2000000); /* Wait to ensure transfer before interface switched off. */