X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fscpi-dmm%2Fapi.c;h=c6753860b866a072443e9221acd04179bd48ebe9;hp=7867ebc2acd48b336e47a6efd9c591a7ec607550;hb=ddeaa49d431f3cb79a4d3e9f07fcc636797944ca;hpb=7d95afb9bec585335be5a5bd47621b8376a03a5b diff --git a/src/hardware/scpi-dmm/api.c b/src/hardware/scpi-dmm/api.c index 7867ebc2..c6753860 100644 --- a/src/hardware/scpi-dmm/api.c +++ b/src/hardware/scpi-dmm/api.c @@ -168,42 +168,42 @@ SR_PRIV const struct scpi_dmm_model models[] = { 1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a), scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), - 0, + 0, 0, }, { "Agilent", "34410A", 1, 6, cmdset_hp, ARRAY_AND_SIZE(mqopts_agilent_34405a), scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), - 0, + 0, 0, }, { "GW", "GDM8251A", 1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a), scpi_dmm_get_meas_gwinstek, ARRAY_AND_SIZE(devopts_generic), - 1000 * 2500, + 1000 * 2500, 0, }, { "GW", "GDM8255A", 1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a), scpi_dmm_get_meas_gwinstek, ARRAY_AND_SIZE(devopts_generic), - 1000 * 2500, + 1000 * 2500, 0, }, { "GWInstek", "GDM9060", 1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x), scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), - 0, + 0, 0, }, { "GWInstek", "GDM9061", 1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x), scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), - 0, + 0, 0, }, { "HP", "34401A", @@ -211,14 +211,14 @@ SR_PRIV const struct scpi_dmm_model models[] = { scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), /* 34401A: typ. 1020ms for AC readings (default is 1000ms). */ - 1000 * 1500, + 1000 * 1500, 0, }, { "Keysight", "34465A", 1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a), scpi_dmm_get_meas_agilent, ARRAY_AND_SIZE(devopts_generic), - 0, + 0, 0, }, }; @@ -241,6 +241,25 @@ static const struct scpi_dmm_model *is_compatible(const char *vendor, const char return NULL; } +/* + * Some devices (such as Owon XDM2041) do not support the standard + * OPeration Complete? command. This function tests the command with + * a short timeout, and returns TRUE if any reply (busy or not) is received. + */ +static gboolean probe_opc_support(struct sr_scpi_dev_inst *scpi) +{ + gboolean result; + GString *response; + + response = g_string_sized_new(128); + result = TRUE; + if (sr_scpi_get_data(scpi, SCPI_CMD_OPC, &response) != SR_OK) + result = FALSE; + g_string_free(response, TRUE); + + return result; +} + static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) { struct sr_scpi_hw_info *hw_info; @@ -253,6 +272,9 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) gchar *channel_name; const char *command; + if (!probe_opc_support(scpi)) + scpi->no_opc_command = TRUE; + scpi_dmm_cmd_delay(scpi); ret = sr_scpi_get_hw_id(scpi, &hw_info); if (ret != SR_OK) {