From: Martin Ling Date: Sun, 21 Sep 2014 17:45:36 +0000 (+0100) Subject: gmc-mh-1x-2x: Remove SERIAL_NONBLOCK flag. X-Git-Tag: libsigrok-0.4.0~955 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;ds=inline;h=e13e354f892d25b0842790e420cceba1007d0823;p=libsigrok.git gmc-mh-1x-2x: Remove SERIAL_NONBLOCK flag. All calls in the driver are now explicitly (non)blocking. --- diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 1a969d11..a67fb0a8 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -198,7 +198,7 @@ static GSList *scan_1x_2x_rs232(GSList *options) if (!(serial = sr_serial_dev_inst_new(conn, serialcomm))) return NULL; - if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK) { + if (serial_open(serial, SERIAL_RDWR) != SR_OK) { sr_serial_dev_inst_free(serial); return NULL; } @@ -295,7 +295,7 @@ static GSList *scan_2x_bd232(GSList *options) if (!(serial = sr_serial_dev_inst_new(conn, serialcomm))) return NULL; - if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK) + if (serial_open(serial, SERIAL_RDWR) != SR_OK) goto exit_err; if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index d0cd1940..cfcbc4dc 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -1307,7 +1307,7 @@ int req_meas14(const struct sr_dev_inst *sdi) devc->cmd_idx = 0; create_cmd_14(devc->addr, 8, params, msg); devc->req_sent_at = g_get_monotonic_time(); - if (serial_write_blocking(serial, msg, sizeof(msg)) < 0) { + if (serial_write_blocking(serial, msg, sizeof(msg)) == -1) { return SR_ERR; } @@ -1350,7 +1350,7 @@ int req_stat14(const struct sr_dev_inst *sdi, gboolean power_on) /* Write message and wait for reply */ devc->req_sent_at = g_get_monotonic_time(); - if (serial_write_blocking(serial, msg, sizeof(msg)) < 0) { + if (serial_write_blocking(serial, msg, sizeof(msg)) == -1) { return SR_ERR; }