+ float vdivlog = log10f(ch_bit[ch]);
+ int digits = -(int)vdivlog + (vdivlog < 0.0);
+ analog.encoding->digits = digits;
+ analog.spec->spec_digits = digits;
+ analog.meaning->channels = g_slist_append(NULL, channels->data);
+
+ for (int i = 0; i < num_samples; i++) {
+ /*
+ * The device always sends data for both channels. If a channel
+ * is disabled, it contains a copy of the enabled channel's
+ * data. However, we only send the requested channels to
+ * the bus.
+ *
+ * Voltage values are encoded as a value 0-255, where the
+ * value is a point in the range represented by the vdiv
+ * setting. There are 10 vertical divs, so e.g. 500mV/div
+ * represents 5V peak-to-peak where 0 = -2.5V and 255 = +2.5V.
+ */
+ ((float *)analog.data)[i] = ch_bit[ch] * *(buf + i * 2 + ch) - ch_center[ch];
+ }
+
+ sr_session_send(sdi, &packet);
+ g_slist_free(analog.meaning->channels);
+
+ channels = channels->next;
+ }