- if (gvtype) {
- if (cg)
- select_channel(sdi, cg->channels->data);
- ret = scpi_cmd_resp(sdi, data, gvtype, cmd);
-
- if (gvtype == G_VARIANT_TYPE_STRING && ret == SR_OK) {
- /* Non-standard data type responses. */
- switch (key) {
- case SCPI_CMD_GET_OUTPUT_REGULATION:
- /*
- * This is specific to the Rigol DP800 series.
- * We return the same string for now until more
- * models with this key are supported. Do a check
- * just for the hell of it.
- */
- s = g_variant_get_string(*data, NULL);
- if (strcmp(s, "CC") && strcmp(s, "CV") && strcmp(s, "UR")) {
- sr_dbg("Unknown response to SCPI_CMD_GET_OUTPUT_REGULATION: %s", s);
- ret = SR_ERR_DATA;
- }
- break;
- }
+ if (!gvtype)
+ return SR_ERR_NA;
+
+ channel_group_cmd = 0;
+ channel_group_name = NULL;
+ if (cg) {
+ channel_group_cmd = SCPI_CMD_SELECT_CHANNEL;
+ channel_group_name = g_strdup(cg->name);
+ }
+
+ ret = sr_scpi_cmd_resp(sdi, devc->device->commands,
+ channel_group_cmd, channel_group_name, data, gvtype, cmd);
+ g_free(channel_group_name);
+
+ 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");