+ /*
+ * Enable counter if it was not already running.
+ * Some devices cannot use channel 2 and the counter
+ * at the same time. Some cannot respond right after
+ * enabling the counter and need a delay.
+ */
+
+ need_quirk = devc->quirks & RIGOL_DG_COUNTER_CH2_CONFLICT;
+ need_quirk &= devc->device->num_channels > 1;
+ if (need_quirk) {
+ sr_scpi_get_opc(scpi);
+ ret = sr_scpi_cmd_resp(sdi, devc->cmdset,
+ PSG_CMD_SELECT_CHANNEL, "2",
+ &data, G_VARIANT_TYPE_BOOLEAN,
+ PSG_CMD_GET_ENABLED, "2");
+ if (ret != SR_OK)
+ return SR_ERR_NA;
+ ch_active = g_variant_get_boolean(data);
+ g_variant_unref(data);
+ if (ch_active) {
+ sr_scpi_get_opc(scpi);
+ ret = sr_scpi_cmd(sdi, devc->cmdset,
+ PSG_CMD_SELECT_CHANNEL, "2",
+ PSG_CMD_SET_DISABLE, "2");
+ if (ret != SR_OK)
+ return SR_ERR_NA;
+ }
+ }
+