X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fpipistrello-ols%2Fapi.c;h=3c7fc7b1790c0af6e1c37f33d929bb85523631f7;hb=41812aca436805b0614f2a8f31cf2f8ce494aea0;hp=b23ccf707f6258d59765e3deae2ef36290c316f0;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index b23ccf70..3c7fc7b1 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -61,11 +61,10 @@ static const char *patterns[] = { }; /* Channels are numbered 0-31 (on the PCB silkscreen). */ -SR_PRIV const char *p_ols_channel_names[NUM_CHANNELS + 1] = { +SR_PRIV const char *p_ols_channel_names[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", - NULL, }; /* Default supported samplerates, can be overridden by device metadata. */ @@ -94,7 +93,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) (void)options; - drvc = di->priv; + drvc = di->context; devices = NULL; @@ -111,10 +110,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc->flag_reg = 0; /* Allocate memory for the incoming ftdi data. */ - if (!(devc->ftdi_buf = g_try_malloc0(FTDI_BUF_SIZE))) { - sr_err("ftdi_buf malloc failed."); - goto err_free_devc; - } + devc->ftdi_buf = g_malloc0(FTDI_BUF_SIZE); /* Allocate memory for the FTDI context (ftdic) and initialize it. */ if (!(devc->ftdic = ftdi_new())) { @@ -198,7 +194,6 @@ err_free_ftdic: ftdi_free(devc->ftdic); /* NOT free() or g_free()! */ err_free_ftdi_buf: g_free(devc->ftdi_buf); -err_free_devc: g_free(devc); return NULL; @@ -206,7 +201,7 @@ err_free_devc: static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static void clear_helper(void *priv) @@ -229,7 +224,6 @@ static int cleanup(const struct sr_dev_driver *di) return dev_clear(di); } - static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { @@ -444,7 +438,7 @@ static int dev_open(struct sr_dev_inst *sdi) if (p_ols_open(devc) != SR_OK) { return SR_ERR; } else { - sdi->status = SR_ST_ACTIVE; + sdi->status = SR_ST_ACTIVE; return SR_OK; } } @@ -469,7 +463,6 @@ static int dev_close(struct sr_dev_inst *sdi) return ret; } - static int set_trigger(const struct sr_dev_inst *sdi, int stage) { struct dev_context *devc; @@ -706,8 +699,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, return SR_OK; } - - static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { struct dev_context *devc; @@ -748,5 +739,5 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };