X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fconrad-digi-35-cpu%2Fprotocol.c;h=732bec62c7805169daaa74a840950c2dab01b626;hb=d9a58763d66b761900fdc930d9cd580137ea3a5c;hp=cfabdc7b778a72c38397618e295cdec11587e633;hpb=55e32714f994aaf4841b59bc67c82d263aeb0a70;p=libsigrok.git diff --git a/src/hardware/conrad-digi-35-cpu/protocol.c b/src/hardware/conrad-digi-35-cpu/protocol.c index cfabdc7b..732bec62 100644 --- a/src/hardware/conrad-digi-35-cpu/protocol.c +++ b/src/hardware/conrad-digi-35-cpu/protocol.c @@ -23,6 +23,7 @@ * @internal */ +#include #include "protocol.h" /** @@ -48,8 +49,9 @@ SR_PRIV int send_msg1(const struct sr_dev_inst *sdi, char cmd, int param) sr_spew("send_msg1(): %c%c%c%c\\r", buf[0], buf[1], buf[2], buf[3]); - if (serial_write_blocking(serial, buf, sizeof(buf)) == -1) { - sr_err("Write error for cmd=%c: %d %s", cmd, errno, strerror(errno)); + if (serial_write_blocking(serial, buf, sizeof(buf), + serial_timeout(serial, sizeof(buf))) < (int)sizeof(buf)) { + sr_err("Write error for cmd=%c", cmd); return SR_ERR; } @@ -57,7 +59,7 @@ SR_PRIV int send_msg1(const struct sr_dev_inst *sdi, char cmd, int param) * Wait 50ms to ensure that the device does not swallow any of the * following commands. */ - g_usleep(50000); + g_usleep(50 * 1000); return SR_OK; }