-SR_PRIV int select_channel(const struct sr_dev_inst *sdi, struct sr_channel *ch)
-{
- struct dev_context *devc;
- struct pps_channel *cur_pch, *new_pch;
- int ret;
-
- if (g_slist_length(sdi->channels) == 1)
- return SR_OK;
-
- devc = sdi->priv;
- if (ch == devc->cur_channel)
- return SR_OK;
-
- new_pch = ch->priv;
- if (devc->cur_channel) {
- cur_pch = devc->cur_channel->priv;
- if (cur_pch->hw_output_idx == new_pch->hw_output_idx) {
- /* Same underlying output channel. */
- devc->cur_channel = ch;
- return SR_OK;
- }
- }
-
- if ((ret = sr_scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SELECT_CHANNEL,
- new_pch->hwname)) >= 0)
- devc->cur_channel = ch;
-
- return ret;
-}
-