#include "libsigrok-internal.h"
#include "protocol.h"
-#define NUM_PROBES 2
-
static const int hwcaps[] = {
- SR_HWCAP_OSCILLOSCOPE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_TIMEBASE,
- SR_HWCAP_TRIGGER_SOURCE,
- SR_HWCAP_TRIGGER_SLOPE,
- SR_HWCAP_HORIZ_TRIGGERPOS,
- SR_HWCAP_VDIV,
- SR_HWCAP_COUPLING,
+ SR_CONF_OSCILLOSCOPE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_TIMEBASE,
+ SR_CONF_TRIGGER_SOURCE,
+ SR_CONF_TRIGGER_SLOPE,
+ SR_CONF_HORIZ_TRIGGERPOS,
+ SR_CONF_VDIV,
+ SR_CONF_COUPLING,
0,
};
continue;
g_free(devc->device);
+ g_slist_free(devc->enabled_probes);
close(devc->fd);
sr_dev_inst_free(sdi);
*data = coupling;
break;
default:
- sr_err("Unknown info_id: %d.", info_id);
return SR_ERR_ARG;
}
ret = SR_OK;
switch (hwcap) {
- case SR_HWCAP_LIMIT_FRAMES:
+ case SR_CONF_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
- case SR_HWCAP_TRIGGER_SLOPE:
+ case SR_CONF_TRIGGER_SLOPE:
tmp_u64 = *(const int *)value;
rigol_ds1xx2_send_data(devc->fd, ":TRIG:EDGE:SLOP %s\n",
tmp_u64 ? "POS" : "NEG");
break;
- case SR_HWCAP_HORIZ_TRIGGERPOS:
+ case SR_CONF_HORIZ_TRIGGERPOS:
tmp_float = *(const float *)value;
rigol_ds1xx2_send_data(devc->fd, ":TIM:OFFS %.9f\n", tmp_float);
break;
- case SR_HWCAP_TIMEBASE:
+ case SR_CONF_TIMEBASE:
tmp_rat = *(const struct sr_rational *)value;
rigol_ds1xx2_send_data(devc->fd, ":TIM:SCAL %.9f\n",
(float)tmp_rat.p / tmp_rat.q);
break;
- case SR_HWCAP_TRIGGER_SOURCE:
+ case SR_CONF_TRIGGER_SOURCE:
if (!strcmp(value, "CH1"))
channel = "CHAN1";
else if (!strcmp(value, "CH2"))
}
rigol_ds1xx2_send_data(devc->fd, ":TRIG:EDGE:SOUR %s\n", channel);
break;
- case SR_HWCAP_VDIV:
+ case SR_CONF_VDIV:
/* TODO: Not supporting vdiv per channel yet. */
tmp_rat = *(const struct sr_rational *)value;
for (i = 0; vdivs[i].p && vdivs[i].q; i++) {
if (vdivs[i].p == 0 && vdivs[i].q == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_COUPLING:
+ case SR_CONF_COUPLING:
/* TODO: Not supporting coupling per channel yet. */
for (i = 0; coupling[i]; i++) {
if (!strcmp(value, coupling[i])) {
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- struct sr_datafeed_meta_analog meta;
char buf[256];
int len;
gettimeofday(&header.starttime, NULL);
sr_session_send(cb_data, &packet);
- /* Send metadata about the SR_DF_ANALOG packets to come. */
- packet.type = SR_DF_META_ANALOG;
- packet.payload = &meta;
- meta.num_probes = NUM_PROBES;
- sr_session_send(cb_data, &packet);
-
+ /* Hardcoded to CH1 only. */
+ devc->enabled_probes = g_slist_append(NULL, sdi->probes->data);
rigol_ds1xx2_send_data(devc->fd, ":CHAN1:SCAL?\n");
len = read(devc->fd, buf, sizeof(buf));
buf[len] = 0;