+ return t;
+}
+
+/* Get the input stream's list of channels and their types, once. */
+static void props_get_channels(struct df_arg_desc *args,
+ const struct sr_dev_inst *sdi)
+{
+ struct input_stream_props *props;
+ GSList *l;
+ const struct sr_channel *ch;
+
+ if (!args)
+ return;
+ props = &args->props;
+ if (props->channels)
+ return;
+
+ props->channels = g_slist_copy(sr_dev_inst_channels_get(sdi));
+ if (!props->channels)
+ return;
+ for (l = props->channels; l; l = l->next) {
+ ch = l->data;
+ if (!ch->enabled)
+ continue;
+ if (ch->type != SR_CHANNEL_ANALOG)
+ continue;
+ props->first_analog_channel = ch;
+ break;
+ }
+}
+
+static gboolean props_chk_1st_channel(struct df_arg_desc *args,
+ const struct sr_datafeed_analog *analog)
+{
+ struct sr_channel *ch;
+
+ if (!args || !analog || !analog->meaning)
+ return FALSE;
+ ch = g_slist_nth_data(analog->meaning->channels, 0);
+ if (!ch)
+ return FALSE;
+ return ch == args->props.first_analog_channel;
+}
+
+static void props_dump_details(struct df_arg_desc *args)
+{
+ struct input_stream_props *props;
+ size_t ch_count;
+ GSList *l;
+ const struct sr_channel *ch;
+ const char *type;
+
+ if (!args)
+ return;
+ props = &args->props;
+ if (props->samplerate)
+ printf("Samplerate: %" PRIu64 "\n", props->samplerate);
+ if (props->channels) {
+ ch_count = g_slist_length(props->channels);
+ printf("Channels: %zu\n", ch_count);
+ for (l = props->channels; l; l = l->next) {
+ ch = l->data;
+ if (ch->type == SR_CHANNEL_ANALOG)
+ type = "analog";
+ else
+ type = "logic";
+ printf("- %s: %s\n", ch->name, type);
+ }
+ }
+ if (props->unitsize)
+ printf("Logic unitsize: %zu\n", props->unitsize);
+ if (props->sample_count_logic)
+ printf("Logic sample count: %" PRIu64 "\n", props->sample_count_logic);
+ if (props->sample_count_analog)
+ printf("Analog sample count: %" PRIu64 "\n", props->sample_count_analog);
+ if (props->frame_count)
+ printf("Frame count: %" PRIu64 "\n", props->frame_count);
+ if (props->triggered)
+ printf("Trigger count: %" PRIu64 "\n", props->triggered);
+}
+
+static void props_cleanup(struct df_arg_desc *args)
+{
+ struct input_stream_props *props;
+
+ if (!args)
+ return;
+ props = &args->props;
+ g_slist_free(props->channels);
+ props->channels = NULL;
+ props->first_analog_channel = NULL;