- if (gvtype) {
- if (cg)
- select_channel(sdi, cg->channels->data);
- ret = scpi_cmd_resp(sdi, data, gvtype, cmd);
- } else
- ret = SR_ERR_NA;
+ if (!gvtype)
+ return SR_ERR_NA;
+
+ if (cg)
+ select_channel(sdi, cg->channels->data);
+ ret = scpi_cmd_resp(sdi, devc->device->commands, data, gvtype, cmd);
+
+ if (cmd == SCPI_CMD_GET_OUTPUT_REGULATION) {
+ /*
+ * The Rigol DP800 series return CV/CC/UR, Philips PM2800
+ * return VOLT/CURR. We always return a GVariant string in
+ * the Rigol notation.
+ */
+ if ((ret = sr_scpi_get_string(sdi->conn, NULL, &s)) != SR_OK)
+ return ret;
+ if (!strcmp(s, "CV") || !strcmp(s, "VOLT")) {
+ *data = g_variant_new_string("CV");
+ } else if (!strcmp(s, "CC") || !strcmp(s, "CURR")) {
+ *data = g_variant_new_string("CC");
+ } else if (!strcmp(s, "UR")) {
+ *data = g_variant_new_string("UR");
+ } else {
+ sr_dbg("Unknown response to SCPI_CMD_GET_OUTPUT_REGULATION: %s", s);
+ ret = SR_ERR_DATA;
+ }
+ g_free(s);
+ }