#include <libusb.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
-#include "config.h"
#include "dso.h"
SR_PRIV struct sr_dev_driver hantek_dso_driver_info;
static struct sr_dev_driver *hdi = &hantek_dso_driver_info;
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
- void *cb_data);
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof)
{
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
sr_err("hantek-dso: driver context malloc failed.");
- return SR_ERR;
+ return SR_ERR_MALLOC;
}
if (libusb_init(NULL) != 0) {
analog.num_samples = num_samples;
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
+ /* TODO: Check malloc return value. */
analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes);
data_offset = 0;
for (i = 0; i < analog.num_samples; i++) {
devc->trigger_offset = trigger_offset;
num_probes = (devc->ch1_enabled && devc->ch2_enabled) ? 2 : 1;
+ /* TODO: Check malloc return value. */
devc->framebuf = g_try_malloc(devc->framesize * num_probes * 2);
devc->samp_buffered = devc->samp_received = 0;
return SR_OK;
}
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;