From: Peter Stuge Date: Mon, 3 Dec 2012 01:42:57 +0000 (+0100) Subject: Add a struct sr_context * parameter to sr_driver_init() X-Git-Tag: dsupstream~485 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=44fc870c9cc5c0e53b47b9d7fa3dffe81731ee3c;p=libsigrok.git Add a struct sr_context * parameter to sr_driver_init() Since the public API is changed, this commit also bumps the libtool version component SR_LIB_VERSION_CURRENT in configure.ac. --- diff --git a/configure.ac b/configure.ac index 65013108..e8d440df 100644 --- a/configure.ac +++ b/configure.ac @@ -64,7 +64,7 @@ PKG_PROG_PKG_CONFIG([0.22]) # Carefully read the libtool docs before updating these numbers! # The algorithm for determining which number to change (and how) is nontrivial! # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info -SR_LIB_VERSION_CURRENT=1 +SR_LIB_VERSION_CURRENT=2 SR_LIB_VERSION_REVISION=0 SR_LIB_VERSION_AGE=0 SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE" diff --git a/hwdriver.c b/hwdriver.c index e685459f..d2f62e3a 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -212,11 +212,13 @@ SR_API struct sr_dev_driver **sr_driver_list(void) /** * Initialize a hardware driver. * + * @param ctx A libsigrok context object allocated by a previous call to + * sr_init(). * @param driver The driver to initialize. * * @return SR_OK if all went well, or an error code otherwise. */ -SR_API int sr_driver_init(struct sr_dev_driver *driver) +SR_API int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver) { if (driver->init) diff --git a/proto.h b/proto.h index 4c9286c1..c93a796e 100644 --- a/proto.h +++ b/proto.h @@ -75,7 +75,8 @@ SR_API int sr_filter_probes(int in_unitsize, int out_unitsize, /*--- hwdriver.c ------------------------------------------------------------*/ SR_API struct sr_dev_driver **sr_driver_list(void); -SR_API int sr_driver_init(struct sr_dev_driver *driver); +SR_API int sr_driver_init(struct sr_context *ctx, + struct sr_dev_driver *driver); SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options); SR_API int sr_info_get(struct sr_dev_driver *driver, int id, const void **data, const struct sr_dev_inst *sdi); diff --git a/session_file.c b/session_file.c index 12c0bf86..204dee96 100644 --- a/session_file.c +++ b/session_file.c @@ -144,7 +144,7 @@ SR_API int sr_session_load(const char *filename) sdi->driver = &session_driver; if (devcnt == 0) /* first device, init the driver */ - sdi->driver->init(); + sdi->driver->init(NULL); sr_session_dev_add(sdi); sdi->driver->dev_config_set(sdi, SR_HWCAP_SESSIONFILE, filename); sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTUREFILE, val);