The SCPI standard requires OPeration Complete command,
but some Owon meters do not implement it. This commit
makes the probe try OPC once, and if it gets no reply
it assumes it is not supported.
+/*
+ * 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;
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
{
struct sr_scpi_hw_info *hw_info;
gchar *channel_name;
const char *command;
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) {
scpi_dmm_cmd_delay(scpi);
ret = sr_scpi_get_hw_id(scpi, &hw_info);
if (ret != SR_OK) {
{
if (WITH_CMD_DELAY)
g_usleep(WITH_CMD_DELAY * 1000);
{
if (WITH_CMD_DELAY)
g_usleep(WITH_CMD_DELAY * 1000);
+
+ if (!scpi->no_opc_command)
+ sr_scpi_get_opc(scpi);
}
SR_PRIV const struct mqopt_item *scpi_dmm_lookup_mq_number(
}
SR_PRIV const struct mqopt_item *scpi_dmm_lookup_mq_number(
uint64_t firmware_version;
GMutex scpi_mutex;
char *actual_channel_name;
uint64_t firmware_version;
GMutex scpi_mutex;
char *actual_channel_name;
+ gboolean no_opc_command;
};
SR_PRIV GSList *sr_scpi_scan(struct drv_context *drvc, GSList *options,
};
SR_PRIV GSList *sr_scpi_scan(struct drv_context *drvc, GSList *options,