X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcem-dt-885x%2Fprotocol.c;h=0366b29d95b5ac7a0832614dc53a4ce115a06ac2;hb=da2cb50d7311fe66a50169e33ee1be9f7b901709;hp=88fa8b7fbc68dfa26b8e1bbf6d67919143ac31eb;hpb=d9251a2c9f1ca4380c27240ccca90c9f9ed46d3f;p=libsigrok.git diff --git a/src/hardware/cem-dt-885x/protocol.c b/src/hardware/cem-dt-885x/protocol.c index 88fa8b7f..0366b29d 100644 --- a/src/hardware/cem-dt-885x/protocol.c +++ b/src/hardware/cem-dt-885x/protocol.c @@ -147,7 +147,7 @@ static void process_mset(const struct sr_dev_inst *sdi) devc->num_samples++; if (devc->limit_samples && devc->num_samples >= devc->limit_samples) - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi); + sr_dev_acquisition_stop((struct sr_dev_inst *)sdi); break; case TOKEN_RECORDING_ON: devc->recording = TRUE; @@ -208,7 +208,7 @@ static void send_data(const struct sr_dev_inst *sdi, unsigned char *data, devc->num_samples += analog.num_samples; if (devc->limit_samples && devc->num_samples >= devc->limit_samples) - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi); + sr_dev_acquisition_stop((struct sr_dev_inst *)sdi); return; } @@ -321,7 +321,7 @@ static void process_byte(const struct sr_dev_inst *sdi, const unsigned char c, * records. Otherwise the frontend would have no * way to tell where stored data ends and live * measurements begin. */ - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi); + sr_dev_acquisition_stop((struct sr_dev_inst *)sdi); } else if (c == RECORD_DATA) { devc->buf_len = 0; devc->state = ST_GET_LOG_RECORD_DATA; @@ -346,7 +346,8 @@ static void process_byte(const struct sr_dev_inst *sdi, const unsigned char c, g_variant_new_uint64(devc->buf[7] * 1000)); meta.config = g_slist_append(NULL, src); sr_session_send(sdi, &packet); - g_free(src); + g_slist_free(meta.config); + sr_config_free(src); devc->buf_len = 0; } } else if (devc->state == ST_GET_LOG_RECORD_DATA) { @@ -400,7 +401,7 @@ SR_PRIV int cem_dt_885x_receive_data(int fd, int revents, void *cb_data) } else { /* Tell device to start transferring from memory. */ cmd = CMD_TRANSFER_MEMORY; - serial_write_nonblocking(serial, &cmd, 1); + serial_write_blocking(serial, &cmd, 1, 0); } } } @@ -456,7 +457,7 @@ static int cem_dt_885x_toggle(const struct sr_dev_inst *sdi, uint8_t cmd, * only thing to do is wait for the token that will confirm * whether the command worked or not, and resend if needed. */ while (TRUE) { - if (serial_write_nonblocking(serial, (const void *)&cmd, 1) != 1) + if (serial_write_blocking(serial, (const void *)&cmd, 1, 0) < 0) return SR_ERR; if (wait_for_token(sdi, tokens, timeout) == SR_ERR) return SR_ERR; @@ -817,7 +818,7 @@ SR_PRIV int cem_dt_885x_power_off(const struct sr_dev_inst *sdi) cmd = CMD_TOGGLE_POWER_OFF; while (TRUE) { serial_flush(serial); - if (serial_write_nonblocking(serial, (const void *)&cmd, 1) != 1) + if (serial_write_blocking(serial, (const void *)&cmd, 1, 0) < 0) return SR_ERR; /* It never takes more than 23ms for the next token to arrive. */ g_usleep(25 * 1000);