- 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.
+ */
+ s = g_variant_get_string(*data, NULL);
+ if (!strcmp(s, "VOLT")) {
+ g_variant_unref(*data);
+ *data = g_variant_new_string("CV");
+ } else if (!strcmp(s, "CURR")) {
+ g_variant_unref(*data);
+ *data = g_variant_new_string("CC");
+ }
+
+ s = g_variant_get_string(*data, NULL);
+ if (strcmp(s, "CV") && strcmp(s, "CC") && strcmp(s, "UR")) {
+ sr_dbg("Unknown response to SCPI_CMD_GET_OUTPUT_REGULATION: %s", s);
+ ret = SR_ERR_DATA;
+ }
+ }