diff --git a/Makefile.am b/Makefile.am index 58842e9b..69bb4473 100644 --- a/Makefile.am +++ b/Makefile.am @@ -167,42 +167,49 @@ libsigrok_la_SOURCES += \ src/scale/kern.c # Hardware drivers +noinst_LTLIBRARIES = src/libdrivers.la -# This entry must be placed before all drivers -libsigrok_la_SOURCES += src/hardware/driver_list_start.c +src/libdrivers.o: src/libdrivers.la + $(AM_V_CCLD)$(LINK) src/libdrivers.la +src/libdrivers.lo: src/libdrivers.o + $(AM_V_GEN)echo "# Generated by libtool" > $@ + $(AM_V_at)echo "pic_object='libdrivers.o'" >> $@ + $(AM_V_at)echo "non_pic_object='libdrivers.o'" >> $@ + +src_libdrivers_la_SOURCES = src/drivers.c if HW_AGILENT_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/agilent-dmm/api.c \ src/hardware/agilent-dmm/agilent-dmm.h \ src/hardware/agilent-dmm/sched.c endif if HW_APPA_55II -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/appa-55ii/protocol.h \ src/hardware/appa-55ii/protocol.c \ src/hardware/appa-55ii/api.c endif if HW_ARACHNID_LABS_RE_LOAD_PRO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/arachnid-labs-re-load-pro/protocol.h \ src/hardware/arachnid-labs-re-load-pro/protocol.c \ src/hardware/arachnid-labs-re-load-pro/api.c endif if HW_ASIX_SIGMA -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/asix-sigma/protocol.h \ src/hardware/asix-sigma/protocol.c \ src/hardware/asix-sigma/api.c endif if HW_ATTEN_PPS3XXX -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/atten-pps3xxx/protocol.h \ src/hardware/atten-pps3xxx/protocol.c \ src/hardware/atten-pps3xxx/api.c endif if HW_BAYLIBRE_ACME -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/baylibre-acme/protocol.h \ src/hardware/baylibre-acme/protocol.c \ src/hardware/baylibre-acme/api.c \ @@ -210,77 +217,77 @@ libsigrok_la_SOURCES += \ src/hardware/baylibre-acme/gpio.c endif if HW_BEAGLELOGIC -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/beaglelogic/beaglelogic.h \ src/hardware/beaglelogic/protocol.h \ src/hardware/beaglelogic/protocol.c \ src/hardware/beaglelogic/api.c endif if HW_BRYMEN_BM86X -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/brymen-bm86x/protocol.h \ src/hardware/brymen-bm86x/protocol.c \ src/hardware/brymen-bm86x/api.c endif if HW_BRYMEN_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/brymen-dmm/parser.c \ src/hardware/brymen-dmm/protocol.h \ src/hardware/brymen-dmm/protocol.c \ src/hardware/brymen-dmm/api.c endif if HW_CEM_DT_885X -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/cem-dt-885x/protocol.h \ src/hardware/cem-dt-885x/protocol.c \ src/hardware/cem-dt-885x/api.c endif if HW_CENTER_3XX -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/center-3xx/protocol.h \ src/hardware/center-3xx/protocol.c \ src/hardware/center-3xx/api.c endif if HW_CHRONOVU_LA -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/chronovu-la/protocol.h \ src/hardware/chronovu-la/protocol.c \ src/hardware/chronovu-la/api.c endif if HW_COLEAD_SLM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/colead-slm/protocol.h \ src/hardware/colead-slm/protocol.c \ src/hardware/colead-slm/api.c endif if HW_CONRAD_DIGI_35_CPU -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/conrad-digi-35-cpu/protocol.h \ src/hardware/conrad-digi-35-cpu/protocol.c \ src/hardware/conrad-digi-35-cpu/api.c endif if HW_DEMO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/demo/demo.c endif if HW_DEREE_DE5000 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/deree-de5000/api.c endif if HW_FLUKE_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/fluke-dmm/fluke-dmm.h \ src/hardware/fluke-dmm/fluke.c \ src/hardware/fluke-dmm/api.c endif if HW_FTDI_LA -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/ftdi-la/protocol.h \ src/hardware/ftdi-la/protocol.c \ src/hardware/ftdi-la/api.c endif if HW_FX2LAFW -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/fx2lafw/protocol.h \ src/hardware/fx2lafw/protocol.c \ src/hardware/fx2lafw/api.c \ @@ -288,164 +295,164 @@ libsigrok_la_SOURCES += \ src/hardware/fx2lafw/dslogic.h endif if HW_GMC_MH_1X_2X -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/gmc-mh-1x-2x/protocol.h \ src/hardware/gmc-mh-1x-2x/protocol.c \ src/hardware/gmc-mh-1x-2x/api.c endif if HW_GWINSTEK_GDS_800 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/gwinstek-gds-800/protocol.h \ src/hardware/gwinstek-gds-800/protocol.c \ src/hardware/gwinstek-gds-800/api.c endif if HW_HAMEG_HMO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/hameg-hmo/protocol.h \ src/hardware/hameg-hmo/protocol.c \ src/hardware/hameg-hmo/api.c endif if HW_HANTEK_6XXX -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/hantek-6xxx/protocol.h \ src/hardware/hantek-6xxx/protocol.c \ src/hardware/hantek-6xxx/api.c endif if HW_HANTEK_DSO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/hantek-dso/dso.h \ src/hardware/hantek-dso/dso.c \ src/hardware/hantek-dso/api.c endif if HW_HP_3457A -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/hp-3457a/protocol.h \ src/hardware/hp-3457a/protocol.c \ src/hardware/hp-3457a/api.c endif if HW_HUNG_CHANG_DSO_2100 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/hung-chang-dso-2100/protocol.h \ src/hardware/hung-chang-dso-2100/protocol.c \ src/hardware/hung-chang-dso-2100/api.c endif if HW_IKALOGIC_SCANALOGIC2 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/ikalogic-scanalogic2/protocol.h \ src/hardware/ikalogic-scanalogic2/protocol.c \ src/hardware/ikalogic-scanalogic2/api.c endif if HW_IKALOGIC_SCANAPLUS -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/ikalogic-scanaplus/protocol.h \ src/hardware/ikalogic-scanaplus/protocol.c \ src/hardware/ikalogic-scanaplus/api.c endif if HW_KECHENG_KC_330B -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/kecheng-kc-330b/protocol.h \ src/hardware/kecheng-kc-330b/protocol.c \ src/hardware/kecheng-kc-330b/api.c endif if HW_KERN_SCALE -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/kern-scale/protocol.h \ src/hardware/kern-scale/protocol.c \ src/hardware/kern-scale/api.c endif if HW_KORAD_KAXXXXP -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/korad-kaxxxxp/protocol.h \ src/hardware/korad-kaxxxxp/protocol.c \ src/hardware/korad-kaxxxxp/api.c endif if HW_LASCAR_EL_USB -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/lascar-el-usb/protocol.h \ src/hardware/lascar-el-usb/protocol.c \ src/hardware/lascar-el-usb/api.c endif if HW_LECROY_LOGICSTUDIO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/lecroy-logicstudio/protocol.h \ src/hardware/lecroy-logicstudio/protocol.c \ src/hardware/lecroy-logicstudio/api.c endif if HW_MANSON_HCS_3XXX -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/manson-hcs-3xxx/protocol.h \ src/hardware/manson-hcs-3xxx/protocol.c \ src/hardware/manson-hcs-3xxx/api.c endif if HW_MAYNUO_M97 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/maynuo-m97/protocol.h \ src/hardware/maynuo-m97/protocol.c \ src/hardware/maynuo-m97/api.c endif if HW_MIC_985XX -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/mic-985xx/protocol.h \ src/hardware/mic-985xx/protocol.c \ src/hardware/mic-985xx/api.c endif if HW_MOTECH_LPS_30X -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/motech-lps-30x/protocol.h \ src/hardware/motech-lps-30x/protocol.c \ src/hardware/motech-lps-30x/api.c endif if HW_NORMA_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/norma-dmm/protocol.h \ src/hardware/norma-dmm/protocol.c \ src/hardware/norma-dmm/api.c endif if HW_OPENBENCH_LOGIC_SNIFFER -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/openbench-logic-sniffer/protocol.h \ src/hardware/openbench-logic-sniffer/protocol.c \ src/hardware/openbench-logic-sniffer/api.c endif if HW_PCE_322A -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/pce-322a/protocol.h \ src/hardware/pce-322a/protocol.c \ src/hardware/pce-322a/api.c endif if HW_PIPISTRELLO_OLS -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/pipistrello-ols/protocol.h \ src/hardware/pipistrello-ols/protocol.c \ src/hardware/pipistrello-ols/api.c endif if HW_RIGOL_DS -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/rigol-ds/protocol.h \ src/hardware/rigol-ds/protocol.c \ src/hardware/rigol-ds/api.c endif if HW_SALEAE_LOGIC16 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/saleae-logic16/protocol.h \ src/hardware/saleae-logic16/protocol.c \ src/hardware/saleae-logic16/api.c endif if HW_SCPI_PPS -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/scpi-pps/protocol.h \ src/hardware/scpi-pps/protocol.c \ src/hardware/scpi-pps/profiles.c \ src/hardware/scpi-pps/api.c endif if HW_SERIAL_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/serial-dmm/protocol.h \ src/hardware/serial-dmm/protocol.c \ src/hardware/serial-dmm/api.c endif if HW_SYSCLK_LWLA -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/sysclk-lwla/lwla.h \ src/hardware/sysclk-lwla/lwla.c \ src/hardware/sysclk-lwla/lwla1016.c \ @@ -455,43 +462,43 @@ libsigrok_la_SOURCES += \ src/hardware/sysclk-lwla/api.c endif if HW_TELEINFO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/teleinfo/protocol.h \ src/hardware/teleinfo/protocol.c \ src/hardware/teleinfo/api.c endif if HW_TESTO -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/testo/protocol.h \ src/hardware/testo/protocol.c \ src/hardware/testo/api.c endif if HW_TONDAJ_SL_814 -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/tondaj-sl-814/protocol.h \ src/hardware/tondaj-sl-814/protocol.c \ src/hardware/tondaj-sl-814/api.c endif if HW_UNI_T_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/uni-t-dmm/protocol.h \ src/hardware/uni-t-dmm/protocol.c \ src/hardware/uni-t-dmm/api.c endif if HW_UNI_T_UT32X -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/uni-t-ut32x/protocol.h \ src/hardware/uni-t-ut32x/protocol.c \ src/hardware/uni-t-ut32x/api.c endif if HW_VICTOR_DMM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/victor-dmm/protocol.h \ src/hardware/victor-dmm/protocol.c \ src/hardware/victor-dmm/api.c endif if HW_YOKOGAWA_DLM -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/yokogawa-dlm/protocol.h \ src/hardware/yokogawa-dlm/protocol.c \ src/hardware/yokogawa-dlm/protocol_wrappers.h \ @@ -499,7 +506,7 @@ libsigrok_la_SOURCES += \ src/hardware/yokogawa-dlm/api.c endif if HW_ZEROPLUS_LOGIC_CUBE -libsigrok_la_SOURCES += \ +src_libdrivers_la_SOURCES += \ src/hardware/zeroplus-logic-cube/analyzer.c \ src/hardware/zeroplus-logic-cube/analyzer.h \ src/hardware/zeroplus-logic-cube/gl_usb.h \ @@ -509,10 +516,7 @@ libsigrok_la_SOURCES += \ src/hardware/zeroplus-logic-cube/api.c endif -# This entry must be placed after all drivers -libsigrok_la_SOURCES += src/hardware/driver_list_end.c - -libsigrok_la_LIBADD = $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS) +libsigrok_la_LIBADD = src/libdrivers.lo $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS) libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined library_includedir = $(includedir)/libsigrok diff --git a/configure.ac b/configure.ac index a089c9aa..c5089f1d 100644 --- a/configure.ac +++ b/configure.ac @@ -174,18 +174,6 @@ AM_CONDITIONAL([NEED_RPC], [test "x$sr_cv_have_rpc" = xyes]) # Check for compiler support of 128 bit integers AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], []) -# Linker flag to retain the objects of a static lib that are not referenced -AX_CHECK_LINK_FLAG([-Wl,--whole-archive -Wl,--no-whole-archive], - [SR_LINK_BEFORE_LIB=-Wl,--whole-archive - SR_LINK_AFTER_LIB=-Wl,--no-whole-archive], [ -AX_CHECK_LINK_FLAG([-Wl,-force_load], - [SR_LINK_BEFORE_LIB=-Wl,-force_load - SR_LINK_AFTER_LIB=], - [SR_LINK_BEFORE_LIB= - SR_LINK_AFTER_LIB=])]) -AC_SUBST(SR_LINK_BEFORE_LIB) -AC_SUBST(SR_LINK_AFTER_LIB) - ######################## ## Hardware drivers ## ######################## diff --git a/libsigrok.pc.in b/libsigrok.pc.in index 47ac8801..791e3f03 100644 --- a/libsigrok.pc.in +++ b/libsigrok.pc.in @@ -9,6 +9,6 @@ URL: http://www.sigrok.org Requires: glib-2.0 Requires.private: @SR_PKGLIBS@ Version: @SR_PACKAGE_VERSION@ -Libs: -L${libdir} @SR_LINK_BEFORE_LIB@ -lsigrok @SR_LINK_AFTER_LIB@ +Libs: -L${libdir} -lsigrok Libs.private: @SR_EXTRA_LIBS@ Cflags: -I${includedir} diff --git a/src/backend.c b/src/backend.c index f58ab7e9..379478a0 100644 --- a/src/backend.c +++ b/src/backend.c @@ -448,8 +448,6 @@ static int sanity_check_all_transform_modules(void) return ret; } -extern struct sr_dev_driver *sr_driver_list_start; - /** * Initialize libsigrok. * @@ -470,8 +468,6 @@ SR_API int sr_init(struct sr_context **ctx) { int ret = SR_ERR; struct sr_context *context; - struct sr_dev_driver **drivers; - GArray *array; #ifdef _WIN32 WSADATA wsadata; #endif @@ -485,12 +481,7 @@ SR_API int sr_init(struct sr_context **ctx) context = g_malloc0(sizeof(struct sr_context)); - /* Generate ctx->driver_list at runtime. */ - array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *)); - for (drivers = (&sr_driver_list_start) + 1; *drivers; drivers++) - g_array_append_val(array, *drivers); - context->driver_list = (struct sr_dev_driver **)array->data; - g_array_free(array, FALSE); + sr_drivers_init(context); if (sanity_check_all_drivers(context) < 0) { sr_err("Internal driver error(s), aborting."); diff --git a/src/drivers.c b/src/drivers.c new file mode 100644 index 00000000..6200e5ee --- /dev/null +++ b/src/drivers.c @@ -0,0 +1,56 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2016 Lars-Peter Clausen + * Copyright (C) 2016 Aurelien Jacobs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include "libsigrok-internal.h" + +/* + * sr_driver_list is a special section contains pointers to all the hardware + * drivers built into the library. The __start and __stop symbols are + * auto-generated by the linker (OSX needs a little help) and point to the start + * and end of the section. They are used to iterate over the list of all + * drivers. + */ +#ifdef __APPLE__ +extern struct sr_dev_driver *__start_sr_driver_list __asm("section$start$__DATA$__sr_driver_list"); +extern struct sr_dev_driver *__stop_sr_driver_list __asm("section$end$__DATA$__sr_driver_list"); +#else +extern struct sr_dev_driver *__start_sr_driver_list; +extern struct sr_dev_driver *__stop_sr_driver_list; +#endif + +/** @private + * Initialize the driver list in a fresh libsigrok context. + * + * @param ctx Pointer to a libsigrok context struct. Must not be NULL. + */ +SR_PRIV void sr_drivers_init(struct sr_context *ctx) +{ + struct sr_dev_driver **drivers; + GArray *array; + + array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *)); + for (drivers = &__start_sr_driver_list; drivers < &__stop_sr_driver_list; + drivers++) + g_array_append_val(array, *drivers); + ctx->driver_list = (struct sr_dev_driver **)array->data; + g_array_free(array, FALSE); +} diff --git a/src/hardware/driver_list_end.c b/src/hardware/driver_list_end.c deleted file mode 100644 index 31d97165..00000000 --- a/src/hardware/driver_list_end.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2016 Lars-Peter Clausen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include "libsigrok-internal.h" - -/* End of the driver list */ -static struct sr_dev_driver *sr_driver_list_end - __attribute__((section (SR_DRIVER_LIST_SECTION), used, - aligned(sizeof(struct sr_dev_driver *)))) = NULL; diff --git a/src/hardware/driver_list_start.c b/src/hardware/driver_list_start.c deleted file mode 100644 index 6cdae6b0..00000000 --- a/src/hardware/driver_list_start.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2016 Lars-Peter Clausen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include "libsigrok-internal.h" - -/* Beginning of the driver list */ -const struct sr_dev_driver *sr_driver_list_start - __attribute__((section (SR_DRIVER_LIST_SECTION), used, - aligned(sizeof(struct sr_dev_driver *)))) = NULL; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 13617054..96597e6d 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -332,6 +332,8 @@ struct zip_stat; #define SR_REGISTER_DEV_DRIVER(name) \ SR_REGISTER_DEV_DRIVER_LIST(name##_list, &name); +SR_PRIV void sr_drivers_init(struct sr_context *context); + struct sr_context { struct sr_dev_driver **driver_list; #ifdef HAVE_LIBUSB_1_0