#define NUM_TIMEBASE 12
#define NUM_VDIV 8
+static const int32_t hwopts[] = {
+ SR_CONF_CONN,
+};
+
static const int32_t hwcaps[] = {
SR_CONF_OSCILLOSCOPE,
SR_CONF_TIMEBASE,
SR_CONF_TRIGGER_SOURCE,
SR_CONF_TRIGGER_SLOPE,
SR_CONF_HORIZ_TRIGGERPOS,
- SR_CONF_VDIV,
- SR_CONF_COUPLING,
SR_CONF_NUM_TIMEBASE,
+};
+
+static const int32_t analog_hwcaps[] = {
SR_CONF_NUM_VDIV,
+ SR_CONF_VDIV,
+ SR_CONF_COUPLING,
};
static const uint64_t timebases[][2] = {
static const char *supported_models[] = {
"DS1052E",
"DS1102E",
+ "DS1152E",
"DS1052D",
"DS1102D",
+ "DS1152D",
};
SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info;
static struct sr_dev_driver *di = &rigol_ds1xx2_driver_info;
-/* Properly close and free all devices. */
-static int clear_instances(void)
+static void clear_helper(void *priv)
{
- struct sr_dev_inst *sdi;
- struct drv_context *drvc;
struct dev_context *devc;
- GSList *l;
-
- if (!(drvc = di->priv))
- return SR_OK;
-
- for (l = drvc->instances; l; l = l->next) {
- if (!(sdi = l->data))
- continue;
- if (!(devc = sdi->priv))
- continue;
-
- g_free(devc->device);
- g_free(devc->coupling[0]);
- g_free(devc->coupling[1]);
- g_free(devc->trigger_source);
- g_free(devc->trigger_slope);
- close(devc->fd);
-
- sr_dev_inst_free(sdi);
- }
- g_slist_free(drvc->instances);
- drvc->instances = NULL;
+ devc = priv;
+ g_free(devc->coupling[0]);
+ g_free(devc->coupling[1]);
+ g_free(devc->trigger_source);
+ g_free(devc->trigger_slope);
+ g_slist_free(devc->analog_groups[0].probes);
+ g_slist_free(devc->analog_groups[1].probes);
+ g_slist_free(devc->digital_group.probes);
+}
- return SR_OK;
+static int dev_clear(void)
+{
+ return std_dev_clear(di, clear_helper);
}
static int set_cfg(const struct sr_dev_inst *sdi, const char *format, ...)
{
- struct dev_context *devc;
va_list args;
char buf[256];
- devc = sdi->priv;
-
va_start(args, format);
vsnprintf(buf, 255, format, args);
va_end(args);
- if (rigol_ds1xx2_send(devc, buf) != SR_OK)
+ if (rigol_ds1xx2_send(sdi, buf) != SR_OK)
return SR_ERR;
/* When setting a bunch of parameters in a row, the DS1052E scrambles
* some of them unless there is at least 100ms delay in between. */
sr_spew("delay %dms", 100);
- g_usleep(100);
+ g_usleep(100000);
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
- return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
+ return std_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static int probe_port(const char *port, GSList **devices)
{
- struct drv_context *drvc;
- struct sr_dev_inst *sdi;
struct dev_context *devc;
+ struct sr_dev_inst *sdi;
+ struct sr_serial_dev_inst *serial;
struct sr_probe *probe;
- GSList *devices;
- GDir *dir;
- const gchar *dev_name;
- const gchar *dev_dir = "/dev/";
- const gchar *prefix = "usbtmc";
- gchar *device;
- const gchar *idn_query = "*IDN?";
unsigned int i;
- int len, num_tokens, fd;
- const gchar *delimiter = ",";
- gchar **tokens;
+ int len, num_tokens;
+ gboolean matched, has_digital;
const char *manufacturer, *model, *version;
- gboolean matched = FALSE;
- gboolean has_digital = FALSE;
char buf[256];
- gchar *channel_name;
+ gchar **tokens, *channel_name;
- (void)options;
+ *devices = NULL;
+ if (!(serial = sr_serial_dev_inst_new(port, NULL)))
+ return SR_ERR_MALLOC;
- drvc = di->priv;
- drvc->instances = NULL;
-
- devices = NULL;
+ if (serial_open(serial, SERIAL_RDWR) != SR_OK)
+ return SR_ERR;
+ len = serial_write(serial, "*IDN?", 5);
+ len = serial_read(serial, buf, sizeof(buf));
+ if (serial_close(serial) != SR_OK)
+ return SR_ERR;
- dir = g_dir_open("/sys/class/usb/", 0, NULL);
+ sr_serial_dev_inst_free(serial);
- if (dir == NULL)
- return NULL;
+ if (len == 0)
+ return SR_ERR_NA;
- while ((dev_name = g_dir_read_name(dir)) != NULL) {
- if (strncmp(dev_name, prefix, strlen(prefix)))
- continue;
+ buf[len] = 0;
+ tokens = g_strsplit(buf, ",", 0);
+ sr_dbg("response: %s [%s]", port, buf);
- device = g_strconcat(dev_dir, dev_name, NULL);
+ for (num_tokens = 0; tokens[num_tokens] != NULL; num_tokens++);
- fd = open(device, O_RDWR);
- len = write(fd, idn_query, strlen(idn_query));
- len = read(fd, buf, sizeof(buf));
- close(fd);
- if (len == 0) {
- g_free(device);
- return NULL;
- }
+ if (num_tokens < 4) {
+ g_strfreev(tokens);
+ return SR_ERR_NA;
+ }
- buf[len] = 0;
- tokens = g_strsplit(buf, delimiter, 0);
- close(fd);
- sr_dbg("response: %s %d [%s]", device, len, buf);
+ manufacturer = tokens[0];
+ model = tokens[1];
+ version = tokens[3];
- for (num_tokens = 0; tokens[num_tokens] != NULL; num_tokens++);
+ if (strcmp(manufacturer, "Rigol Technologies")) {
+ g_strfreev(tokens);
+ return SR_ERR_NA;
+ }
- if (num_tokens < 4) {
- g_strfreev(tokens);
- g_free(device);
- return NULL;
+ matched = has_digital = FALSE;
+ for (i = 0; i < ARRAY_SIZE(supported_models); i++) {
+ if (!strcmp(model, supported_models[i])) {
+ matched = TRUE;
+ has_digital = g_str_has_suffix(model, "D");
+ break;
}
+ }
- manufacturer = tokens[0];
- model = tokens[1];
- version = tokens[3];
+ if (!matched || !(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
+ manufacturer, model, version))) {
+ g_strfreev(tokens);
+ return SR_ERR_NA;
+ }
- if (strcmp(manufacturer, "Rigol Technologies")) {
- g_strfreev(tokens);
- g_free(device);
- return NULL;
- }
+ g_strfreev(tokens);
+
+ if (!(sdi->conn = sr_serial_dev_inst_new(port, NULL)))
+ return SR_ERR_MALLOC;
+ sdi->driver = di;
+ sdi->inst_type = SR_INST_SERIAL;
+
+ if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
+ return SR_ERR_MALLOC;
+ devc->limit_frames = 0;
+ devc->has_digital = has_digital;
+
+ for (i = 0; i < 2; i++) {
+ channel_name = (i == 0 ? "CH1" : "CH2");
+ if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel_name)))
+ return SR_ERR_MALLOC;
+ sdi->probes = g_slist_append(sdi->probes, probe);
+ devc->analog_groups[i].name = channel_name;
+ devc->analog_groups[i].probes = g_slist_append(NULL, probe);
+ sdi->probe_groups = g_slist_append(sdi->probe_groups,
+ &devc->analog_groups[i]);
+ }
- for (i = 0; i < ARRAY_SIZE(supported_models); i++) {
- if (!strcmp(model, supported_models[i])) {
- matched = 1;
- has_digital = g_str_has_suffix(model, "D");
- break;
- }
+ if (devc->has_digital) {
+ for (i = 0; i < 16; i++) {
+ if (!(channel_name = g_strdup_printf("D%d", i)))
+ return SR_ERR_MALLOC;
+ probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, channel_name);
+ g_free(channel_name);
+ if (!probe)
+ return SR_ERR_MALLOC;
+ sdi->probes = g_slist_append(sdi->probes, probe);
+ devc->digital_group.probes = g_slist_append(
+ devc->digital_group.probes, probe);
+ devc->digital_group.name = "LA";
+ sdi->probe_groups = g_slist_append(sdi->probe_groups,
+ &devc->digital_group);
}
+ }
+ sdi->priv = devc;
- if (!matched || !(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
- manufacturer, model, version))) {
- g_strfreev(tokens);
- g_free(device);
- return NULL;
- }
+ *devices = g_slist_append(NULL, sdi);
- g_strfreev(tokens);
+ return SR_OK;
+}
- if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
- sr_err("Device context malloc failed.");
- g_free(device);
- return NULL;
- }
- devc->limit_frames = 0;
- devc->device = device;
- devc->has_digital = has_digital;
- sdi->priv = devc;
- sdi->driver = di;
+static GSList *scan(GSList *options)
+{
+ struct drv_context *drvc;
+ struct sr_config *src;
+ GSList *l, *devices;
+ GDir *dir;
+ int ret;
+ const gchar *dev_name;
+ gchar *port = NULL;
- for (i = 0; i < 2; i++) {
- if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
- i == 0 ? "CH1" : "CH2")))
- return NULL;
- sdi->probes = g_slist_append(sdi->probes, probe);
+ drvc = di->priv;
+
+ for (l = options; l; l = l->next) {
+ src = l->data;
+ if (src->key == SR_CONF_CONN) {
+ port = (char *)g_variant_get_string(src->data, NULL);
+ break;
}
+ }
- if (devc->has_digital) {
- for (i = 0; i < 16; i++) {
- if (!(channel_name = g_strdup_printf("D%d", i)))
- return NULL;
- probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, channel_name);
- g_free(channel_name);
- if (!probe)
- return NULL;
- sdi->probes = g_slist_append(sdi->probes, probe);
+ devices = NULL;
+ if (port) {
+ if (probe_port(port, &devices) == SR_ERR_MALLOC)
+ return NULL;
+ } else {
+ if (!(dir = g_dir_open("/sys/class/usbmisc/", 0, NULL)))
+ if (!(dir = g_dir_open("/sys/class/usb/", 0, NULL)))
+ return NULL;
+ while ((dev_name = g_dir_read_name(dir))) {
+ if (strncmp(dev_name, "usbtmc", 6))
+ continue;
+ port = g_strconcat("/dev/", dev_name, NULL);
+ ret = probe_port(port, &devices);
+ g_free(port);
+ if (ret == SR_ERR_MALLOC) {
+ g_dir_close(dir);
+ return NULL;
}
}
-
- drvc->instances = g_slist_append(drvc->instances, sdi);
- devices = g_slist_append(devices, sdi);
+ g_dir_close(dir);
}
- g_dir_close(dir);
+ /* Tack a copy of the newly found devices onto the driver list. */
+ l = g_slist_copy(devices);
+ drvc->instances = g_slist_concat(drvc->instances, l);
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
- struct dev_context *devc;
- int fd;
- devc = sdi->priv;
-
- if ((fd = open(devc->device, O_RDWR)) == -1)
+ if (serial_open(sdi->conn, SERIAL_RDWR) != SR_OK)
return SR_ERR;
- devc->fd = fd;
if (rigol_ds1xx2_get_dev_cfg(sdi) != SR_OK)
- /* TODO: force configuration? */
return SR_ERR;
+ sdi->status = SR_ST_ACTIVE;
+
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
- struct dev_context *devc;
-
- devc = sdi->priv;
+ struct sr_serial_dev_inst *serial;
- close(devc->fd);
+ serial = sdi->conn;
+ if (serial && serial->fd != -1) {
+ serial_close(serial);
+ sdi->status = SR_ST_INACTIVE;
+ }
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
- clear_instances();
-
- return SR_OK;
+ return dev_clear();
}
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+ const struct sr_probe_group *probe_group)
{
+ struct dev_context *devc;
+ unsigned int i;
+
+ if (!sdi || !(devc = sdi->priv))
+ return SR_ERR_ARG;
- (void)sdi;
+ /* If a probe group is specified, it must be a valid one. */
+ if (probe_group) {
+ if (probe_group != &devc->analog_groups[0]
+ && probe_group != &devc->analog_groups[1]) {
+ sr_err("Invalid probe group specified.");
+ return SR_ERR;
+ }
+ }
switch (id) {
case SR_CONF_NUM_TIMEBASE:
*data = g_variant_new_int32(NUM_TIMEBASE);
break;
case SR_CONF_NUM_VDIV:
- *data = g_variant_new_int32(NUM_VDIV);
- break;
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
+ }
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ *data = g_variant_new_int32(NUM_VDIV);
+ return SR_OK;
+ }
+ }
+ return SR_ERR_NA;
default:
return SR_ERR_NA;
}
return SR_OK;
}
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
+static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+ const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
uint64_t tmp_u64, p, q;
double t_dbl;
- unsigned int i;
+ unsigned int i, j;
int ret;
const char *tmp_str;
- devc = sdi->priv;
+ if (!(devc = sdi->priv))
+ return SR_ERR_ARG;
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("Device inactive, can't set config options.");
- return SR_ERR;
+ if (sdi->status != SR_ST_ACTIVE)
+ return SR_ERR_DEV_CLOSED;
+
+ /* If a probe group is specified, it must be a valid one. */
+ if (probe_group) {
+ if (probe_group != &devc->analog_groups[0]
+ && probe_group != &devc->analog_groups[1]) {
+ sr_err("Invalid probe group specified.");
+ return SR_ERR;
+ }
}
ret = SR_OK;
ret = SR_ERR_ARG;
break;
case SR_CONF_VDIV:
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
+ }
g_variant_get(data, "(tt)", &p, &q);
- for (i = 0; i < ARRAY_SIZE(vdivs); i++) {
- if (vdivs[i][0] != p || vdivs[i][1] != q)
- continue;
- devc->vdiv[0] = devc->vdiv[1] = (float)p / q;
- set_cfg(sdi, ":CHAN1:SCAL %.3f", devc->vdiv[0]);
- ret = set_cfg(sdi, ":CHAN2:SCAL %.3f", devc->vdiv[1]);
- break;
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ for (j = 0; j < ARRAY_SIZE(vdivs); j++) {
+ if (vdivs[j][0] != p || vdivs[j][1] != q)
+ continue;
+ devc->vdiv[i] = (float)p / q;
+ return set_cfg(sdi, ":CHAN%d:SCAL %.3f", i + 1,
+ devc->vdiv[i]);
+ }
+ return SR_ERR_ARG;
+ }
}
- if (i == ARRAY_SIZE(vdivs))
- ret = SR_ERR_ARG;
- break;
+ return SR_ERR_NA;
case SR_CONF_COUPLING:
- /* TODO: Not supporting coupling per channel yet. */
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
+ }
tmp_str = g_variant_get_string(data, NULL);
- for (i = 0; i < ARRAY_SIZE(coupling); i++) {
- if (!strcmp(tmp_str, coupling[i])) {
- g_free(devc->coupling[0]);
- g_free(devc->coupling[1]);
- devc->coupling[0] = g_strdup(coupling[i]);
- devc->coupling[1] = g_strdup(coupling[i]);
- set_cfg(sdi, ":CHAN1:COUP %s", devc->coupling[0]);
- ret = set_cfg(sdi, ":CHAN2:COUP %s", devc->coupling[1]);
- break;
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ for (j = 0; j < ARRAY_SIZE(coupling); j++) {
+ if (!strcmp(tmp_str, coupling[j])) {
+ g_free(devc->coupling[i]);
+ devc->coupling[i] = g_strdup(coupling[j]);
+ return set_cfg(sdi, ":CHAN%d:COUP %s", i + 1,
+ devc->coupling[i]);
+ }
+ }
+ return SR_ERR_ARG;
}
}
- if (i == ARRAY_SIZE(coupling))
- ret = SR_ERR_ARG;
- break;
+ return SR_ERR_NA;
default:
ret = SR_ERR_NA;
break;
return ret;
}
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+ const struct sr_probe_group *probe_group)
{
GVariant *tuple, *rational[2];
GVariantBuilder gvb;
unsigned int i;
struct dev_context *devc;
- switch (key) {
- case SR_CONF_DEVICE_OPTIONS:
+ if (key == SR_CONF_SCAN_OPTIONS) {
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
- hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
+ hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
+ return SR_OK;
+ } else if (key == SR_CONF_DEVICE_OPTIONS && probe_group == NULL) {
+ *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
+ hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
+ return SR_OK;
+ }
+
+ /* Every other option requires a valid device instance. */
+ if (!sdi || !(devc = sdi->priv))
+ return SR_ERR_ARG;
+
+ /* If a probe group is specified, it must be a valid one. */
+ if (probe_group) {
+ if (probe_group != &devc->analog_groups[0]
+ && probe_group != &devc->analog_groups[1]) {
+ sr_err("Invalid probe group specified.");
+ return SR_ERR;
+ }
+ }
+
+ switch (key) {
break;
+ case SR_CONF_DEVICE_OPTIONS:
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
+ }
+ if (probe_group == &devc->digital_group) {
+ *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
+ NULL, 0, sizeof(int32_t));
+ return SR_OK;
+ } else {
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
+ analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t));
+ return SR_OK;
+ }
+ }
+ return SR_ERR_NA;
+ }
case SR_CONF_COUPLING:
- *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
- break;
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
+ return SR_OK;
+ }
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
+ }
+ return SR_ERR_NA;
case SR_CONF_VDIV:
- g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
- for (i = 0; i < ARRAY_SIZE(vdivs); i++) {
- rational[0] = g_variant_new_uint64(vdivs[i][0]);
- rational[1] = g_variant_new_uint64(vdivs[i][1]);
- tuple = g_variant_new_tuple(rational, 2);
- g_variant_builder_add_value(&gvb, tuple);
+ for (i = 0; i < 2; i++) {
+ if (probe_group == &devc->analog_groups[i]) {
+ rational[0] = g_variant_new_uint64(vdivs[i][0]);
+ rational[1] = g_variant_new_uint64(vdivs[i][1]);
+ *data = g_variant_new_tuple(rational, 2);
+ return SR_OK;
+ }
+ if (!probe_group) {
+ sr_err("No probe group specified.");
+ return SR_ERR_PROBE_GROUP;
}
- *data = g_variant_builder_end(&gvb);
- break;
+ return SR_ERR_NA;
case SR_CONF_TIMEBASE:
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
for (i = 0; i < ARRAY_SIZE(timebases); i++) {
*data = g_variant_builder_end(&gvb);
break;
case SR_CONF_TRIGGER_SOURCE:
- if (!sdi || !sdi->priv)
- /* Can't know this until we have the exact model. */
- return SR_ERR_ARG;
- devc = sdi->priv;
*data = g_variant_new_strv(trigger_sources,
devc->has_digital ? ARRAY_SIZE(trigger_sources) : 4);
break;
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
+ struct sr_serial_dev_inst *serial;
struct dev_context *devc;
struct sr_probe *probe;
GSList *l;
char cmd[256];
- (void)cb_data;
+ if (sdi->status != SR_ST_ACTIVE)
+ return SR_ERR_DEV_CLOSED;
+ serial = sdi->conn;
devc = sdi->priv;
for (l = sdi->probes; l; l = l->next) {
/* Enabled channel is currently disabled, or vice versa. */
sprintf(cmd, ":CHAN%d:DISP %s", probe->index + 1,
probe->enabled ? "ON" : "OFF");
- if (rigol_ds1xx2_send(devc, cmd) != SR_OK)
+ if (rigol_ds1xx2_send(sdi, cmd) != SR_OK)
return SR_ERR;
}
} else if (probe->type == SR_PROBE_LOGIC) {
/* Enabled channel is currently disabled, or vice versa. */
sprintf(cmd, ":DIG%d:TURN %s", probe->index,
probe->enabled ? "ON" : "OFF");
- if (rigol_ds1xx2_send(devc, cmd) != SR_OK)
+ if (rigol_ds1xx2_send(sdi, cmd) != SR_OK)
return SR_ERR;
}
}
if (!devc->enabled_analog_probes && !devc->enabled_digital_probes)
return SR_ERR;
- sr_source_add(devc->fd, G_IO_IN, 50, rigol_ds1xx2_receive, (void *)sdi);
+ sr_source_add(serial->fd, G_IO_IN, 50, rigol_ds1xx2_receive, (void *)sdi);
/* Send header packet to the session bus. */
- std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
+ std_session_send_df_header(cb_data, LOG_PREFIX);
/* Fetch the first frame. */
if (devc->enabled_analog_probes) {
devc->channel_frame = devc->enabled_analog_probes->data;
- if (rigol_ds1xx2_send(devc, ":WAV:DATA? CHAN%d",
+ if (rigol_ds1xx2_send(sdi, ":WAV:DATA? CHAN%d",
devc->channel_frame->index + 1) != SR_OK)
return SR_ERR;
} else {
devc->channel_frame = devc->enabled_digital_probes->data;
- if (rigol_ds1xx2_send(devc, ":WAV:DATA? DIG") != SR_OK)
+ if (rigol_ds1xx2_send(sdi, ":WAV:DATA? DIG") != SR_OK)
return SR_ERR;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
+ struct sr_serial_dev_inst *serial;
(void)cb_data;
g_slist_free(devc->enabled_digital_probes);
devc->enabled_analog_probes = NULL;
devc->enabled_digital_probes = NULL;
- sr_source_remove(devc->fd);
+ serial = sdi->conn;
+ sr_source_remove(serial->fd);
return SR_OK;
}
.name = "rigol-ds1xx2",
.longname = "Rigol DS1xx2",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
- .dev_clear = clear_instances,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
+ .dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,