X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fchronovu-la8%2Fapi.c;h=c7a5ba83c8084bdba1acb82ba467b1b9dd4a0031;hb=6936ee4206817dbf07fdb8524172bdb46d21c5c0;hp=048c950fb2bdb2430872148c0725a1f502edf911;hpb=45e080b60b2526fd9723dd822215294f973bff2a;p=libsigrok.git diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 048c950f..c7a5ba83 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -38,8 +38,7 @@ static const uint16_t usb_pids[] = { }; /* Function prototypes. */ -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 int clear_instances(void) { @@ -69,7 +68,7 @@ static int clear_instances(void) return SR_OK; } -static int hw_init(void) +static int hw_init(struct sr_context *sr_ctx) { struct drv_context *drvc; @@ -78,6 +77,7 @@ static int hw_init(void) return SR_ERR_MALLOC; } + drvc->sr_ctx = sr_ctx; di->priv = drvc; return SR_OK; @@ -160,7 +160,7 @@ static GSList *hw_scan(GSList *options) sdi->priv = devc; for (i = 0; probe_names[i]; i++) { - if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, + if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, probe_names[i]))) return NULL; sdi->probes = g_slist_append(sdi->probes, probe); @@ -179,7 +179,7 @@ static GSList *hw_scan(GSList *options) err_close_ftdic: (void) la8_close(devc); /* Log, but ignore errors. */ err_free_ftdic: - free(devc->ftdic); /* NOT g_free()! */ + ftdi_free(devc->ftdic); /* NOT free() or g_free()! */ err_free_final_buf: g_free(devc->final_buf); err_free_devc: @@ -279,10 +279,9 @@ static int hw_dev_close(struct sr_dev_inst *sdi) static int hw_cleanup(void) { - if (!di->priv) { - sr_err("%s: di->priv was NULL.", __func__); - return SR_ERR_BUG; - } + if (!di->priv) + /* Can get called on an unused driver, doesn't matter. */ + return SR_OK; clear_instances(); @@ -506,8 +505,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, 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 sr_datafeed_packet packet;