X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=hardware%2Frigol-ds%2Fprotocol.c;h=5ede6d7cab562e081226d65b622bca38a54c2f40;hb=9806c2d573a3fde4c26a38eaab265c7a78962e94;hp=fc938e9d93763ff95dfc9ff00c4198a145201fed;hpb=05c644ea081f5973fcbb2429318b808b931edfe3;p=libsigrok.git diff --git a/hardware/rigol-ds/protocol.c b/hardware/rigol-ds/protocol.c index fc938e9d..5ede6d7c 100644 --- a/hardware/rigol-ds/protocol.c +++ b/hardware/rigol-ds/protocol.c @@ -423,7 +423,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) scpi = sdi->conn; - if (revents == G_IO_IN) { + if (revents == G_IO_IN || revents == 0) { if (devc->model->protocol == PROTOCOL_IEEE488_2) { switch(devc->wait_event) { case WAIT_NONE: @@ -457,13 +457,17 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) probe = devc->channel_entry->data; + if (devc->num_block_bytes == 0 && + devc->model->protocol == PROTOCOL_IEEE488_2) { + if (sr_scpi_send(sdi->conn, ":WAV:DATA?") != SR_OK) + return TRUE; + } + if (devc->num_block_bytes == 0) { if (sr_scpi_read_begin(scpi) != SR_OK) return TRUE; if (devc->model->protocol == PROTOCOL_IEEE488_2) { sr_dbg("New block header expected"); - if (sr_scpi_send(sdi->conn, ":WAV:DATA?") != SR_OK) - return TRUE; len = rigol_ds_read_header(scpi); if (len == -1) return TRUE; @@ -698,14 +702,14 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi) if (devc->model->has_digital) { sr_dbg("Current digital channel state:"); for (i = 0; i < 16; i++) { - cmd = g_strdup_printf(":DIG%d:TURN?", i + 1); + cmd = g_strdup_printf(":DIG%d:TURN?", i); res = get_cfg_string(sdi, cmd, &t_s); g_free(cmd); if (res != SR_OK) return SR_ERR; devc->digital_channels[i] = !strcmp(t_s, "ON") ? TRUE : FALSE; g_free(t_s); - sr_dbg("D%d: %s", i + 1, devc->digital_channels[i] ? "on" : "off"); + sr_dbg("D%d: %s", i, devc->digital_channels[i] ? "on" : "off"); } }