X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fchronovu-la8%2Fapi.c;h=0df9a7bc92eb633e9485c0459812f64be94ddf75;hb=388f9d3e25da89df1fb01412688339b6de54e14e;hp=048c950fb2bdb2430872148c0725a1f502edf911;hpb=45e080b60b2526fd9723dd822215294f973bff2a;p=libsigrok.git diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 048c950f..0df9a7bc 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(); @@ -298,15 +297,6 @@ static int hw_info_get(int info_id, const void **data, case SR_DI_HWCAPS: *data = hwcaps; break; - case SR_DI_NUM_PROBES: - *data = GINT_TO_POINTER(NUM_PROBES); - sr_spew("%s: Returning number of probes: %d.", __func__, - NUM_PROBES); - break; - case SR_DI_PROBE_NAMES: - *data = probe_names; - sr_spew("%s: Returning probenames.", __func__); - break; case SR_DI_SAMPLERATES: fill_supported_samplerates_if_needed(); *data = &samplerates; @@ -506,8 +496,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;