GString *tmp_str, *devicename, *version;
gchar tmp_c;
- sdi = sr_device_instance_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
+ sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
ols = ols_device_new();
sdi->priv = ols;
sdi->index = final_devcnt;
} else {
/* not an OLS -- some other board that uses the sump protocol */
- sdi = sr_device_instance_new(final_devcnt, SR_ST_INACTIVE,
+ sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
"Sump", "Logic Analyzer", "v1.0");
ols = ols_device_new();
ols->num_probes = 32;
sdi->priv = ols;
}
- ols->serial = sr_serial_device_instance_new(device_names[i], -1);
+ ols->serial = sr_serial_dev_inst_new(device_names[i], -1);
device_instances = g_slist_append(device_instances, sdi);
final_devcnt++;
serial_close(fds[i].fd);
struct sr_device_instance *sdi;
struct ols_device *ols;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
struct sr_device_instance *sdi;
struct ols_device *ols;
- if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("ols: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
return SR_OK;
}
-static void hw_cleanup(void)
+static int hw_cleanup(void)
{
GSList *l;
struct sr_device_instance *sdi;
struct ols_device *ols;
+ int ret = SR_OK;
/* Properly close and free all devices. */
for (l = device_instances; l; l = l->next) {
- sdi = l->data;
- ols = sdi->priv;
+ if (!(sdi = l->data)) {
+ /* Log error, but continue cleaning up the rest. */
+ sr_err("ols: %s: sdi was NULL, continuing", __func__);
+ ret = SR_ERR_BUG;
+ continue;
+ }
+ if (!(ols = sdi->priv)) {
+ /* Log error, but continue cleaning up the rest. */
+ sr_err("ols: %s: sdi->priv was NULL, continuing",
+ __func__);
+ ret = SR_ERR_BUG;
+ continue;
+ }
+ /* TODO: Check for serial != NULL. */
if (ols->serial->fd != -1)
serial_close(ols->serial->fd);
- sr_serial_device_instance_free(ols->serial);
- sr_device_instance_free(sdi);
+ sr_serial_dev_inst_free(ols->serial);
+ sr_dev_inst_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
+
+ return ret;
}
static void *hw_get_device_info(int device_index, int device_info_id)
struct ols_device *ols;
void *info;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL;
ols = sdi->priv;
{
struct sr_device_instance *sdi;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ST_NOT_FOUND;
return sdi->status;
int ret;
uint64_t *tmp_u64;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;
int num_channels;
int i;
- if (!(sdi = sr_get_device_instance(device_instances, device_index)))
+ if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR;
ols = sdi->priv;