+ case SR_CONF_LOGIC_THRESHOLD:
+ if (!cg)
+ return SR_ERR_CHANNEL_GROUP;
+ if (cg_type != CG_DIGITAL)
+ return SR_ERR_NA;
+ if (!model)
+ return SR_ERR_ARG;
+ if ((idx = std_str_idx(data, *model->logic_threshold, model->num_logic_threshold)) < 0)
+ return SR_ERR_ARG;
+ if ((j = std_cg_idx(cg, devc->digital_groups, model->digital_pods)) < 0)
+ return SR_ERR_ARG;
+ g_snprintf(command, sizeof(command),
+ (*model->scpi_dialect)[SCPI_CMD_SET_DIG_POD_THRESHOLD],
+ j + 1, (*model->logic_threshold)[idx]);
+ if (sr_scpi_send(sdi->conn, command) != SR_OK ||
+ sr_scpi_get_opc(sdi->conn) != SR_OK)
+ return SR_ERR;
+ state->digital_pods[j].threshold = idx;
+ ret = SR_OK;
+ break;
+ case SR_CONF_LOGIC_THRESHOLD_CUSTOM:
+ if (!cg)
+ return SR_ERR_CHANNEL_GROUP;
+ if (cg_type != CG_DIGITAL)
+ return SR_ERR_NA;
+ if (!model)
+ return SR_ERR_ARG;
+ if ((j = std_cg_idx(cg, devc->digital_groups, model->digital_pods)) < 0)
+ return SR_ERR_ARG;
+ tmp_d = g_variant_get_double(data);
+ if (tmp_d < -2.0 || tmp_d > 8.0)
+ return SR_ERR;
+ g_ascii_formatd(float_str, sizeof(float_str), "%E", tmp_d);
+ g_snprintf(command, sizeof(command),
+ (*model->scpi_dialect)[SCPI_CMD_SET_DIG_POD_USER_THRESHOLD],
+ j + 1, 2, float_str); // USER2 for custom logic_threshold setting
+ if (sr_scpi_send(sdi->conn, command) != SR_OK ||
+ sr_scpi_get_opc(sdi->conn) != SR_OK)
+ return SR_ERR;
+ g_snprintf(command, sizeof(command),
+ (*model->scpi_dialect)[SCPI_CMD_SET_DIG_POD_THRESHOLD],
+ j + 1, "USER2");
+ if (sr_scpi_send(sdi->conn, command) != SR_OK ||
+ sr_scpi_get_opc(sdi->conn) != SR_OK)
+ return SR_ERR;
+ state->digital_pods[j].user_threshold = tmp_d;
+ ret = SR_OK;
+ break;