From c61f45095a173388178c159897b1f0303b8affb7 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 24 Apr 2023 19:38:43 -0400 Subject: [PATCH 01/86] tests: don't dereference a var before checking it. The strchr() return a NULL if the character is not found. Make sure to handle that. Signed-off-by: Robin Getz --- tests/gen_code.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gen_code.c b/tests/gen_code.c index 9fc3d5ce6..2b7ce24d3 100644 --- a/tests/gen_code.c +++ b/tests/gen_code.c @@ -51,7 +51,7 @@ bool gen_test_path(const char *gen_file) return false; last = strrchr(gen_file, '.'); - if (*last != '.') + if (!last) return false; last++; From 91e5f979a672ece12aa230c55b5658c65d1c9b14 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 14 Feb 2023 16:05:54 +0000 Subject: [PATCH 02/86] channel: Support attribute names that start with the channel's label Support attribute names that start with the channel's label to avoid breaking compatibility with old kernels, which did not offer a 'label' attribute, and caused Libiio to sometimes misdetect the channel's extended name as being part of the attribute name. Signed-off-by: Paul Cercueil --- channel.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/channel.c b/channel.c index 2f92459c1..891c1deab 100644 --- a/channel.c +++ b/channel.c @@ -344,21 +344,53 @@ const char * iio_channel_get_attr(const struct iio_channel *chn, return chn->attrs[index].name; } -const char * iio_channel_find_attr(const struct iio_channel *chn, - const char *name) +static const char * +iio_channel_do_find_attr(const struct iio_channel *chn, const char *name) { unsigned int i; + for (i = 0; i < chn->nb_attrs; i++) { const char *attr = chn->attrs[i].name; if (!strcmp(attr, name)) return attr; } + + return NULL; +} + +const char * iio_channel_find_attr(const struct iio_channel *chn, + const char *name) +{ + const char *attr; + size_t len; + + attr = iio_channel_do_find_attr(chn, name); + if (attr) + return attr; + + /* Support attribute names that start with the channel's label to avoid + * breaking compatibility with old kernels, which did not offer a + * 'label' attribute, and caused Libiio to sometimes misdetect the + * channel's extended name as being part of the attribute name. */ + if (chn->name) { + len = strlen(chn->name); + + if (!strncmp(chn->name, name, len) && name[len] == '_') { + name += len + 1; + return iio_channel_do_find_attr(chn, name); + } + } + return NULL; } ssize_t iio_channel_attr_read(const struct iio_channel *chn, const char *attr, char *dst, size_t len) { + attr = iio_channel_find_attr(chn, attr); + if (!attr) + return -ENOENT; + if (chn->dev->ctx->ops->read_channel_attr) return chn->dev->ctx->ops->read_channel_attr(chn, attr, dst, len); @@ -369,6 +401,10 @@ ssize_t iio_channel_attr_read(const struct iio_channel *chn, ssize_t iio_channel_attr_write_raw(const struct iio_channel *chn, const char *attr, const void *src, size_t len) { + attr = iio_channel_find_attr(chn, attr); + if (!attr) + return -ENOENT; + if (chn->dev->ctx->ops->write_channel_attr) return chn->dev->ctx->ops->write_channel_attr(chn, attr, src, len); From 8eda862d03fa95125482db9eb30f138f196d71d4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 24 Apr 2023 08:36:16 -0400 Subject: [PATCH 03/86] utils: catch calloc memory failures in iio_stresstest On error, calloc() returns NULL. Or a successful call to calloc() with nmemb or size equal to zero. In the past, we would not catch that, and just start operating on the null pointer (crashing). So catch that, and gracefully error out. Signed-off-by: Robin Getz --- tests/iio_stresstest.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/iio_stresstest.c b/tests/iio_stresstest.c index 0eb83ba59..13683ee80 100644 --- a/tests/iio_stresstest.c +++ b/tests/iio_stresstest.c @@ -519,6 +519,12 @@ int main(int argc, char **argv) ret = (void *)calloc(info.num_threads, sizeof(void *)); + if (!ret || !info.start || !info.refills || !info.buffers || !info.starts || + !info.tid || !info.threads) { + fprintf(stderr, "Memory allocation failure\n"); + return 0; + } + for (i = 0; i < info.num_threads; i++) { info.start[i] = malloc(NUM_TIMESTAMPS * sizeof(struct timeval)); } @@ -658,6 +664,11 @@ int main(int argc, char **argv) /* gather and sort things, so we can print out a histogram */ struct timeval *sort; sort = calloc(info.num_threads * NUM_TIMESTAMPS, sizeof(struct timeval)); + if (!sort) { + app_running = 0; + fprintf(stderr, "Memory allocation failure\n"); + break; + } b = 0; /* gather */ for (i = 0; i < info.num_threads; i++) { From a037c83aa580b5f9f7d28db6b99602b53d18089d Mon Sep 17 00:00:00 2001 From: AlexandraTrifan Date: Fri, 21 Apr 2023 09:50:46 +0300 Subject: [PATCH 04/86] Distribution.xml: Make libiio.pkg installable without using Rosetta On Apple Silicon, the installer will require Rosetta 2 when installing libiio unless the arch specifiers are added in the installer xml file. Signed-off-by: AlexandraTrifan --- Distribution.xml.cmakein | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Distribution.xml.cmakein b/Distribution.xml.cmakein index 2bec89be2..741c65b82 100644 --- a/Distribution.xml.cmakein +++ b/Distribution.xml.cmakein @@ -1,7 +1,7 @@ Libiio - + From eef0f7775e0820bb2f7309a3a2c2edc4dd0431a1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 24 Apr 2023 20:27:46 -0400 Subject: [PATCH 05/86] set errno to 0, and check after calling library functions A few times we are using strtol and strtoul, where we were not setting errno to zero, and then checking it afterwards - this could lead to undefined behaviour based on end user inputs, so do like the man page suggests. Signed-off-by: Robin Getz --- network.c | 4 +++- usb.c | 6 ++++-- xml.c | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/network.c b/network.c index d45f0d98c..511322adb 100644 --- a/network.c +++ b/network.c @@ -1126,8 +1126,10 @@ struct iio_context * network_create_context(const char *host) } if (port) { unsigned long int tmp; + + errno = 0; tmp = strtoul(port, &end, 0); - if (port == end || tmp > 0xFFFF) { + if (port == end || tmp > 0xFFFF || errno == ERANGE) { errno = ENOENT; return NULL; } diff --git a/usb.c b/usb.c index 82ab7365b..97e60bf46 100644 --- a/usb.c +++ b/usb.c @@ -1222,8 +1222,9 @@ static int parse_vid_pid(const char *vid_pid, uint16_t *vid, uint16_t *pid) if (!vid_pid) return 0; + errno = 0; val = strtoul(vid_pid, &ptr, 16); - if (ptr == vid_pid || val > 0xFFFF || *ptr != ':') + if (ptr == vid_pid || val > 0xFFFF || *ptr != ':' || errno == ERANGE) return -EINVAL; *vid = (uint16_t) val; @@ -1233,8 +1234,9 @@ static int parse_vid_pid(const char *vid_pid, uint16_t *vid, uint16_t *pid) if (*vid_pid == '*') return vid_pid[1] == '\0' ? 0 : -EINVAL; + errno = 0; val = strtoul(vid_pid, &ptr, 16); - if (ptr == vid_pid || val > 0xFFFF || *ptr != '\0') + if (ptr == vid_pid || val > 0xFFFF || *ptr != '\0' || errno == ERANGE) return -EINVAL; *pid = (uint16_t) val; diff --git a/xml.c b/xml.c index 5de1ef85f..33f026103 100644 --- a/xml.c +++ b/xml.c @@ -428,12 +428,14 @@ static struct iio_context * iio_create_xml_context_helper(xmlDoc *doc) if (!strcmp((char *) attr->name, "description")) { description = content; } else if (!strcmp((char *) attr->name, "version-major")) { + errno = 0; major = strtol(content, &end, 10); - if (*end != '\0') + if (*end != '\0' || errno == ERANGE) IIO_WARNING("invalid format for major version\n"); } else if (!strcmp((char *) attr->name, "version-minor")) { + errno = 0; minor = strtol(content, &end, 10); - if (*end != '\0') + if (*end != '\0' || errno == ERANGE) IIO_WARNING("invalid format for minor version\n"); } else if (!strcmp((char *) attr->name, "version-git")) { git_tag = content; From f1fd3cef150471f223f64c7469534c9abcb7d4af Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Fri, 28 Apr 2023 16:55:39 +0300 Subject: [PATCH 06/86] CI:fix ARM error Signed-off-by: Raluca Groza --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7b76d966c..0c07f00e4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -271,6 +271,7 @@ stages: steps: - script: | set -e + sudo apt-get update sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross sudo apt-get install -y g++-arm-linux-gnueabihf sudo apt-get install -y g++-aarch64-linux-gnu From b36b19db32a2db5f9b4c48eba0c8f9b1e7231446 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 29 Apr 2023 08:06:08 -0400 Subject: [PATCH 07/86] cmake: tell people if we are/are not install udev rules we currently don't tell people if we are or aren't installing udev rules (which I think is an oversight). So do that. Signed-off-by: Robin Getz --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9edf6d9c..1baa7c3d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,6 +671,7 @@ toggle_iio_feature("${WITH_USB_BACKEND}" usb) toggle_iio_feature("${WITH_TESTS}" utils) toggle_iio_feature("${WITH_EXAMPLES}" examples) toggle_iio_feature("${WITH_IIOD}" iiod) +toggle_iio_feature("${INSTALL_UDEV_RULE}" udev-rule) #add iiod settings list(APPEND IIO_FEATURES_ON ${IIOD_FEATURES_ON}) list(APPEND IIO_FEATURES_OFF ${IIOD_FEATURES_OFF}) From 9128e9fffd281b47f5556f4dae29d9e39fbe26ba Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 8 May 2023 10:34:31 +0300 Subject: [PATCH 08/86] channel: Don't lookup attributes in special case of reading all attrs In the case where we want to read all attributes of a channel, we need to call iio_channel_attr_read() with the 'attr' argument set to NULL. So we skip searching for an attribute in this case. This was found when calling iio_channel_attr_read_all() which was causing a segmentation fault: 0: __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:116 1: iio_channel_do_find_attr (chn=0x555555ddf950, name=0x0) 2: iio_channel_find_attr (chn=0x555555ddf950, name=0x0) 3: iio_channel_attr_read () 4: iio_channel_attr_read_all () Signed-off-by: Dan --- channel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/channel.c b/channel.c index 891c1deab..469d037e3 100644 --- a/channel.c +++ b/channel.c @@ -387,9 +387,11 @@ const char * iio_channel_find_attr(const struct iio_channel *chn, ssize_t iio_channel_attr_read(const struct iio_channel *chn, const char *attr, char *dst, size_t len) { - attr = iio_channel_find_attr(chn, attr); - if (!attr) - return -ENOENT; + if (attr) { + attr = iio_channel_find_attr(chn, attr); + if (!attr) + return -ENOENT; + } if (chn->dev->ctx->ops->read_channel_attr) return chn->dev->ctx->ops->read_channel_attr(chn, From 642e033e26017e0b0ad5465a328bd24e229df1d4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 19:19:43 -0400 Subject: [PATCH 09/86] README_BUILD.md: update with a few settings from cmake files Document the build instructions from the options that were in the cmake files. Signed-off-by: Robin Getz --- README_BUILD.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/README_BUILD.md b/README_BUILD.md index 1c69ace2e..141236606 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -34,24 +34,28 @@ analog@precision:~$ cd libiio ## Configure & Build when configuring libiio with cmake, there are a few optional settings that you can use to control the build. +The recommendation is to leave things to the default. + +Cmake Options | Default | Target | Description | +---------------------- | ------- | -------| ---------------------------------------------- | +`BUILD_SHARED_LIBS` | ON | All | Build shared libraries | +`PYTHON_BINDINGS` | OFF | All | Install PYTHON bindings | +`WITH_TESTS` | ON | All | Build the test programs (iio-utils) | +`WITH_EXAMPLES` | OFF | All | Build the example programs | +`NO_THREADS` | OFF | All | Disable multi-threading support | +`CSHARP_BINDINGS` | OFF | Windows | Install C# bindings | +`CMAKE_INSTALL_PREFIX` | `/usr` | Linux | default install path | +`ENABLE_PACKAGING` | OFF | Linux, MaC | Create .deb/.rpm or .tar.gz packages via 'make package' | +`WITH_DOC` | OFF | Linux | Generate documentation with Doxygen and Sphinx | +`WITH_MAN` | OFF | Linux | Generate and install man pages | +`INSTALL_UDEV_RULE` | ON | Linux | Install a Linux udev rule for detection of USB devices | +`UDEV_RULES_INSTALL_DIR` | /lib/udev/rules.d | Linux | default install path for udev rules | +`WITH_LOCAL_CONFIG` | ON | Linux | Read local context attributes from /etc/libiio.ini | +`WITH_HWMON` | OFF | Linux | Add compatibility with the hwmon subsystem | +`WITH_GCOV` | OFF | Linux | Build with gcov profiling flags | +`OSX_FRAMEWORK` | ON | Mac | OS X frameworks provide the interfaces you need to write software for Mac. | +`OSX_PACKAGE` | ON | Mac | Create a OSX package for installation on local and other machines | -Cmake Options | Default | Description | -------------------- | ------- | ---------------------------------------------- | -`BUILD_SHARED_LIBS` | ON | Build shared libraries | -`CMAKE_INSTALL_PREFIX` | `/usr` | default install path | -`ENABLE_PACKAGING` | OFF | Create .deb/.rpm or .tar.gz packages via 'make package' | -`CSHARP_BINDINGS` | OFF | Install C# bindings | -`PYTHON_BINDINGS` | OFF | Install PYTHON bindings | -`WITH_DOC` | OFF | Generate documentation with Doxygen and Sphinx | -`WITH_MAN` | OFF | Generate and install man pages | -`WITH_TESTS` | ON | Build the test programs (iio-utils) | -`INSTALL_UDEV_RULE` | ON | Install a Linux udev rule for detection of USB devices | -`UDEV_RULES_INSTALL_DIR` | /lib/udev/rules.d | default install path for udev rules | -`WITH_EXAMPLES` | OFF | Build the example programs | -`WITH_LOCAL_CONFIG` | ON | Read local context attributes from /etc/libiio.ini | -`WITH_HWMON` | OFF | Add compatibility with the hwmon subsystem | -`NO_THREADS` | OFF | Disable multi-threading support | -`WITH_GCOV` | OFF | Build with gcov profiling flags | Which backends the library supports is dependent on the build system, but can be overridden. (If cmake finds libusb, it will use it, unless turned off manually) From 8e0c83c7ab69a849c5b99cef15843d102093dee1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 19:20:52 -0400 Subject: [PATCH 10/86] CI: make sure build instructions are kept up to date by checking to make sure that no options() are set in the cmake without documenting them in the build instructions Make a script that does this, and run it in CI. Signed-off-by: Robin Getz --- CI/azure/check_README_BUILD.sh | 34 ++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 3 +++ 2 files changed, 37 insertions(+) create mode 100755 CI/azure/check_README_BUILD.sh diff --git a/CI/azure/check_README_BUILD.sh b/CI/azure/check_README_BUILD.sh new file mode 100755 index 000000000..1d680f433 --- /dev/null +++ b/CI/azure/check_README_BUILD.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Check the project CMake for options, which are not described in the README_BUILD.md file +# At the same time, check to make sure the defaults are described properly. + +error=0 + +options() { + for file in $(find ./ -not \( -path ./deps -prune \) -name CMakeLists.txt) + do + grep option[[:space:]]*\( "${file}" | \ + sed -e "s/^[[:space:]]*//g" -e "s/(/ /g" | \ + awk '{print $2}' + done | sort | uniq +} + +for opt in $(options) +do + default=$(for file in $(find ./ -not \( -path ./deps -prune \) -name CMakeLists.txt) + do + grep "option[[:space:]]*(${opt} " "${file}" | \ + sed -e "s/^[[:space:]]*//g" -e "s/)[[:space:]]*$//" | \ + awk '{print $NF}' + done) + if ! grep -q "${opt}.*${default}" README_BUILD.md ; then + echo "no match with ${opt} set with ${default}" + grep -R "${opt}" ./* + error=1 + fi +done + +if [ "${error}" -eq "1" ] ; then + exit 1 +fi diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c07f00e4..bb3c5d8b2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -67,6 +67,9 @@ stages: - script: ./CI/azure/check_kernel.sh displayName: 'Kernel check' condition: and(eq(variables['artifactName'], 'Linux-Ubuntu-22.04'), eq(variables['Build.Reason'], 'PullRequest')) + - script: ./CI/azure/check_README_BUILD.sh + displayName: 'README_BUILD check' + condition: and(eq(variables['artifactName'], 'Linux-Ubuntu-22.04'), eq(variables['Build.Reason'], 'PullRequest')) - task: PublishPipelineArtifact@1 inputs: targetPath: '$(Build.ArtifactStagingDirectory)' From ca72c7dbc92cbee20fc1af66f9973ec969a9ce30 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 19:11:22 -0400 Subject: [PATCH 11/86] update Contributors file from the script in the bottom of that file. It's been a bit since this has been updated, so the numbers/names have changed a bit. Signed-off-by: Robin Getz --- Contributors.md | 162 +++++++++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 70 deletions(-) diff --git a/Contributors.md b/Contributors.md index d320789de..63f935ccb 100644 --- a/Contributors.md +++ b/Contributors.md @@ -1,9 +1,9 @@ # Contributors Since it's first commit on 17 Feb 2014, the libIIO has seen many improvements by many contributors. -Regular releases every 6 months delivers stable updates to users and developers, +Regular releases every ~6 months delivers stable updates to users and developers, each with new features, new examples, added device support, and improved performance. -Each of these releases contains the work of over 45 developers representing over 25 corporations. +Each of these releases contains the work of over 55+ developers representing over 30+ organizations. Although the libIIO would not exist without the initial support of Analog Devices, it is an open source source project, and relies on the contributions of many people. @@ -19,80 +19,102 @@ or tiny-iiod the deeply embedded iio daemon. | Author | Lines of Code | --------------------- | ------------- -| Paul Cercueil | 17904 -| Robin Getz | 7932 -| Lars-Peter Clausen | 3785 -| Tim Harder | 2259 -| Michael Hennerich | 1175 -| Matt Fornero | 987 -| Travis F. Collins | 602 -| Alexandru Ardelean | 555 -| Cristi Iacob | 437 -| Lucas Magasweran | 358 -| Matej Kenda | 273 -| Alexandra Trifan | 257 -| Romain Roffé | 225 -| Geert Uytterhoeven | 35 -| Andrea Galbusera | 32 -| JaredD | 31 -| Adrian Freihofer | 31 -| Dan Nechita | 29 -| Adrian Suciu | 23 -| Petr Štetiar | 20 -| Edward Kigwana | 19 -| Andreas Brauchli | 18 -| fpagliughi | 16 -| Samuel Martin | 12 -| Rémi Lefèvre | 12 -| Michael Heimpold | 12 -| SrikanthPagadarai | 11 -| Dimas Abreu Archanjo Dutra | 9 -| Marc Titinger | 8 -| Jonas Hansen | 4 -| Jeremy Trimble | 4 -| David Frey | 4 -| Ryo Hashimoto | 3 -| Markus Gnadl | 2 -| Julien Malik | 2 -| Jorik Jonker | 2 -| Pierre-Jean Texier | 1 -| Nicholas Pillitteri | 1 -| Morten Fyhn Amundsen | 1 -| Johnny Vestergaard | 1 -| Gwendal Grignou | 1 -| Ben Acland | 1 +| Paul Cercueil | 24510 +| Robin Getz | 12624 +| Lars-Peter Clausen | 3003 +| Raluca Chis | 1233 +| Cristi Iacob | 1055 +| Michael Hennerich | 878 +| Alexandru Ardelean | 835 +| Matt Fornero | 768 +| Iacob | 588 +| Travis F. Collins | 577 +| Nuno Sá | 531 +| Lucas Magasweran | 347 +| Romain Roffé | 202 +| Matej Kenda | 193 +| Adrian Suciu | 140 +| Mihail Chindris | 91 +| AlexandraTrifan | 85 +| Dan Nechita | 52 +| Geert Uytterhoeven | 36 +| Adrian Freihofer | 30 +| JaredD | 28 +| RChis1 | 25 +| Andrea Galbusera | 25 +| Petr Štetiar | 20 +| Andreas Brauchli | 18 +| fpagliughi | 15 +| Fabrice Fontaine | 14 +| Rémi Lefèvre | 12 +| Edward Kigwana | 12 +| Samuel Martin | 11 +| SrikanthPagadarai | 10 +| Max Lehuraux | 9 +| Julien Malik | 9 +| Dimas Abreu Archanjo Dutra | 9 +| Marc Titinger | 8 +| Marvin Schmidt | 7 +| Kathy Camenzind | 6 +| Chris Lamb | 6 +| Tim Harder | 5 +| Misko | 4 +| Michael Heimpold | 4 +| Jeremy Trimble | 4 +| f4exb | 4 +| David Frey | 4 +| DanielGuramulta | 4 +| Gwendal Grignou | 3 +| Matt Thomas | 2 +| Markus Gnadl | 2 +| Jan Tojnar | 2 +| Cormier, Jonathan | 2 +| Virgil Litan | 1 +| Pierre-Jean Texier | 1 +| Nicholas Pillitteri | 1 +| Morten Fyhn Amundsen | 1 +| Marc Sporcich | 1 +| Jonas Hansen | 1 +| Johnny Vestergaard | 1 ## Domains (or companies) contributing to the libIIO In order of most contributions to least (counted by lines of code). -| Company | Lines of code -| ---------------- | ------------- -| analog.com | 31153 -| metafoo.de | 3785 -| mathworks.com | 987 -| gmail.com | 382 -| daqri.com | 358 -| parrot.com | 237 -| linux-m68k.org | 35 -| scs.ch | 22 -| true.cz | 20 -| sensirion.com | 18 -| mindspring.com | 16 -| heimpold.de | 12 -| ufmg.br | 9 -| baylibre.com | 8 -| sierrawireless.com | 4 -| azuresummit.com | 4 -| google.com | 3 -| paraiso.me | 2 -| kippendief.biz | 2 -| iabg.de | 2 -| unixcluster.dk | 1 -| koncepto.io | 1 -| crapouillou.net | 1 -| chromium.org | 1 +| Company | Lines of code +| ------------------- | ------------- +| analog.com | 33846 +| crapouillou.net | 9205 +| metafoo.de | 3003 +| mathworks.com | 824 +| gmail.com | 413 +| daqri.com | 347 +| parrot.com | 214 +| linux-m68k.org | 36 +| scs.ch | 22 +| true.cz | 20 +| sensirion.com | 18 +| mindspring.com | 15 +| ufmg.br | 9 +| baylibre.com | 8 +| unseenlabs.fr | 7 +| exherbo.org | 7 +| tulip.co | 6 +| chris-lamb.co.uk | 6 +| sierrawireless.com | 4 +| heimpold.de | 4 +| cs.toronto.edu | 4 +| azuresummit.com | 4 +| chromium.org | 3 +| users.github.com | 2 +| paraiso.me | 2 +| iabg.de | 2 +| criticallink.com | 2 +| unixcluster.dk | 1 +| scires.com | 1 +| koncepto.io | 1 +| epiqsolutions.com | 1 ## scripts scripts were based on a [gist](https://gist.github.com/amitchhajer/4461043) from Amit Chhajer. From 1a19da1eeee848d24357a3de1af93e3d7626e14e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 7 May 2023 14:11:15 -0400 Subject: [PATCH 12/86] Update Doxyfile.in files Currently - the Doxfiles that are checked in, are from (old? nine years ago), and currently produces warnings when you build things: warning: Tag 'TCL_SUBST' at line 168 of file './Doxyfile.in' has become obsolete. This tag has been removed. warning: Tag 'COLS_IN_ALPHA_INDEX' at line 871 of file './Doxyfile.in' has become obsolete. This tag has been removed. warning: Tag 'PERL_PATH' at line 1558 of file './Doxyfile.in' has become obsolete. This tag has been removed. warning: Tag 'MSCGEN_PATH' at line 1580 of file './Doxyfile.in' has become obsolete. This tag has been removed. Update to 1.9.1 via: doxygen -u ./bindings/csharp/Doxyfile.in doxygen -u ./Doxyfile.in and check in the difference. Unfortunately - this has quite a few comment differences :( 2 files changed, 1885 insertions(+), 374 deletions(-) but if you only look at the actual options that have been moved/updated, it's pretty minimal. git diff | grep -v "\+\#" | grep -v "\-\#" | diffstat b/Doxyfile.in | 10 +++++++++- bindings/csharp/Doxyfile.in | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) Signed-off-by: Robin Getz --- Doxyfile.in | 1135 +++++++++++++++++++++++++++++------ bindings/csharp/Doxyfile.in | 1124 ++++++++++++++++++++++++++++------ 2 files changed, 1885 insertions(+), 374 deletions(-) diff --git a/Doxyfile.in b/Doxyfile.in index c3c9f72dd..d81abfeca 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1,5 +1,43 @@ +# Doxyfile 1.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "libiio" + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = libiio + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + PROJECT_NUMBER = @LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@ # Using the PROJECT_BRIEF tag one can provide an optional one line description @@ -8,10 +46,10 @@ PROJECT_NUMBER = @LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@ PROJECT_BRIEF = "Library for interfacing with IIO devices" -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. PROJECT_LOGO = @@ -21,17 +59,56 @@ PROJECT_LOGO = # left blank the current directory will be used. OUTPUT_DIRECTORY = @CMAKE_HTML_DEST_DIR@ + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the @@ -66,7 +143,7 @@ ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. @@ -110,6 +187,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -130,15 +217,23 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO @@ -157,16 +252,15 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -175,25 +269,60 @@ TCL_SUBST = OPTIMIZE_OUTPUT_FOR_C = YES +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # -# Note For files without extension you can use no_extension as a placeholder. +# Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -201,22 +330,72 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first +# tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent @@ -271,11 +450,24 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. @@ -285,35 +477,41 @@ LOOKUP_CACHE_SIZE = 0 EXTRACT_ALL = NO -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = NO -# This flag is only useful for Objective-C code. When set to YES local methods, +# This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are +# included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. @@ -328,6 +526,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -338,21 +543,21 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these +# documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. @@ -365,22 +570,36 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. # The default value is: system dependent. CASE_SENSE_NAMES = @CMAKE_CASE_SENSITIVE_FILESYSTEM@ # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the +# their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -408,14 +627,14 @@ INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. +# name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that +# name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. @@ -460,27 +679,25 @@ SORT_BY_SCOPE_NAME = NO STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. @@ -505,8 +722,8 @@ ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES @@ -551,11 +768,10 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. +# search path. See also \cite for info how to create references. CITE_BIB_FILES = @@ -571,7 +787,7 @@ CITE_BIB_FILES = QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. @@ -579,7 +795,7 @@ QUIET = YES WARNINGS = YES -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. @@ -596,12 +812,22 @@ WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = NO +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -625,7 +851,7 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/Dox_output_@PROJECT_NAME@ # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with -# spaces. +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = @CMAKE_SOURCE_DIR@ @@ -633,22 +859,33 @@ INPUT = @CMAKE_SOURCE_DIR@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. -FILE_PATTERNS = *.c *.h *.dox +FILE_PATTERNS = *.c \ + *.h \ + *.dox # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. @@ -663,7 +900,12 @@ RECURSIVE = NO # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = @CMAKE_SOURCE_DIR@/iio-private.h @CMAKE_SOURCE_DIR@/debug.h @CMAKE_SOURCE_DIR@/iio-lock.h @CMAKE_SOURCE_DIR@/iiod-client.h @CMAKE_SOURCE_DIR@/sort.h @CMAKE_SOURCE_DIR@/network.h +EXCLUDE = @CMAKE_SOURCE_DIR@/iio-private.h \ + @CMAKE_SOURCE_DIR@/debug.h \ + @CMAKE_SOURCE_DIR@/iio-lock.h \ + @CMAKE_SOURCE_DIR@/iiod-client.h \ + @CMAKE_SOURCE_DIR@/sort.h \ + @CMAKE_SOURCE_DIR@/network.h # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -696,7 +938,8 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/tests @CMAKE_SOURCE_DIR@/examples +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/tests \ + @CMAKE_SOURCE_DIR@/examples # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -732,6 +975,10 @@ IMAGE_PATH = @CMAKE_SOURCE_DIR@/doc # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -741,11 +988,15 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for +# INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. @@ -793,7 +1044,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO @@ -805,7 +1056,7 @@ REFERENCED_BY_RELATION = NO REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. @@ -825,12 +1076,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -852,6 +1103,44 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -863,13 +1152,6 @@ VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -882,7 +1164,7 @@ IGNORE_PREFIX = # Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES @@ -944,13 +1226,15 @@ HTML_FOOTER = @CMAKE_SOURCE_DIR@/doc/template/footer.html HTML_STYLESHEET = -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -966,9 +1250,9 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to +# will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -997,12 +1281,24 @@ HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1026,13 +1322,14 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1071,8 +1368,8 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1094,28 +1391,29 @@ GENERATE_HTMLHELP = NO CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1146,7 +1444,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1154,8 +1453,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1163,30 +1462,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1228,7 +1527,7 @@ DISABLE_INDEX = NO # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has @@ -1256,13 +1555,24 @@ ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1272,7 +1582,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1283,9 +1593,15 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. @@ -1296,7 +1612,7 @@ USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1311,8 +1627,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1326,7 +1642,8 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1354,12 +1671,12 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There -# are two flavours of web server based searching depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. See -# the section "External Indexing and Searching" for details. +# implemented using a web server instead of a web client using JavaScript. There +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1371,9 +1688,10 @@ SERVER_BASED_SEARCH = NO # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1384,10 +1702,11 @@ EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1422,24 +1741,428 @@ EXTRA_SEARCH_MAPPINGS = # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. +# +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_CMD_NAME = + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate +# index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). +# The default file is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +MAKEINDEX_CMD_NAME = makeindex + +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + +# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used by the +# printer. +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x +# 14 inches) and executive (7.25 x 10.5 inches). +# The default value is: a4. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} +# If left blank no extra packages will be included. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the +# generated LaTeX document. The header should contain everything until the first +# chapter. If it is left blank doxygen will generate a standard header. See +# section "Doxygen usage" for information on how to let doxygen write the +# default header to a separate file. +# +# Note: Only use a user-defined header if you know what you are doing! The +# following commands have a special meaning inside the header: $title, +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty +# string, for the replacement values of the other commands the user is referred +# to HTML_HEADER. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the +# generated LaTeX document. The footer should contain everything after the last +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. +# +# Note: Only use a user-defined footer if you know what you are doing! +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_FOOTER = + +# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# LaTeX style sheets that are included after the standard style sheets created +# by doxygen. Using this option one can overrule certain style aspects. Doxygen +# will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_STYLESHEET = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the LATEX_OUTPUT output +# directory. Note that the files will be copied as-is; there are no commands or +# markers available. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will +# contain links (just like the HTML output) instead of page references. This +# makes the output suitable for online browsing using a PDF viewer. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode +# command to the generated LaTeX files. This will instruct LaTeX to keep running +# if errors occur, instead of asking the user for help. This option is also used +# when generating formulas in HTML. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BATCHMODE = NO + +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the +# index chapters (such as File Index, Compound Index, etc.) in the output. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HIDE_INDICES = NO + +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source +# code with syntax highlighting in the LaTeX output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. See +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# The default value is: plain. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BIB_STYLE = plain + +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The +# RTF output is optimized for Word 97 and may not look too pretty with other RTF +# readers/editors. +# The default value is: NO. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: rtf. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will +# contain hyperlink fields. The RTF file will contain links (just like the HTML +# output) instead of page references. This makes the output suitable for online +# browsing using Word or some other Word compatible readers that support those +# fields. +# +# Note: WordPad (write) and others do not support links. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. +# +# See also section "Doxygen usage" for information on how to generate the +# default style sheet that doxygen normally uses. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an RTF document. Syntax is +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_EXTENSIONS_FILE = + +# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code +# with syntax highlighting in the RTF output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for +# classes and files. +# The default value is: NO. + GENERATE_MAN = NO +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. A directory man3 will be created inside the directory specified by +# MAN_OUTPUT. +# The default directory is: man. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to the generated +# man pages. In case the manual section does not start with a number, the number +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is +# optional. +# The default value is: .3. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_EXTENSION = .3 + +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it +# will generate one additional man file for each entity documented in the real +# man page(s). These additional files only source the real man page, but without +# them the man command would be unable to find the correct page. +# The default value is: NO. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that +# captures the structure of the code including all documentation. +# The default value is: NO. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: xml. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_OUTPUT = xml + +# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program +# listings (including syntax highlighting and cross-referencing information) to +# the XML output. Note that enabling this will significantly increase the size +# of the XML output. +# The default value is: YES. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_PROGRAMLISTING = YES + +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files +# that can be used to generate PDF. +# The default value is: NO. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. +# The default directory is: docbook. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_OUTPUT = docbook + +# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module +# file that captures the structure of the code including all documentation. +# +# Note that this feature is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI +# output from the Perl module output. +# The default value is: NO. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely +# formatted so it can be parsed by a human reader. This is useful if you want to +# understand what is going on. On the other hand, if this tag is set to NO, the +# size of the Perl module output will be much smaller and Perl will parse it +# just the same. +# The default value is: YES. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file are +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful +# so different doxyrules.make files included by the same Makefile don't +# overwrite each other's variables. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_MAKEVAR_PREFIX = + #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names -# in the source code. If set to NO only conditional compilation will be +# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names +# in the source code. If set to NO, only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. @@ -1455,7 +2178,7 @@ MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO -# If the SEARCH_INCLUDES tag is set to YES the includes files in the +# If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1497,9 +2220,9 @@ PREDEFINED = EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all refrences to function-like macros that are alone on a line, have an -# all uppercase name, and do not end with a semicolon. Such function macros are -# typically used for boiler-plate code, and will confuse the parser if not +# remove all references to function-like macros that are alone on a line, have +# an all uppercase name, and do not end with a semicolon. Such function macros +# are typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1519,7 +2242,7 @@ SKIP_FUNCTION_MACROS = YES # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. -# Note: Each tag file must have an unique name (where the name does NOT include +# Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. @@ -1531,37 +2254,32 @@ TAGFILES = GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES all external class will be listed in the -# class index. If set to NO only the inherited external classes will be listed. +# If the ALLEXTERNALS tag is set to YES, all external class will be listed in +# the class index. If set to NO, only the inherited external classes will be +# listed. # The default value is: NO. ALLEXTERNALS = NO -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in -# the modules index. If set to NO, only the current project's groups will be +# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = YES -# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in +# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram +# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more @@ -1570,15 +2288,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -1586,7 +2295,7 @@ MSCGEN_PATH = DIA_PATH = -# If set to YES, the inheritance and collaboration graphs will hide inheritance +# If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -1597,7 +2306,7 @@ HIDE_UNDOC_RELATIONS = YES # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO -# The default value is: NO. +# The default value is: YES. HAVE_DOT = @DOXYGEN_DOT_FOUND@ @@ -1611,7 +2320,7 @@ HAVE_DOT = @DOXYGEN_DOT_FOUND@ DOT_NUM_THREADS = 0 -# When you want a differently looking font n the dot files that doxygen +# When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by @@ -1659,7 +2368,7 @@ COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. @@ -1676,10 +2385,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -1711,7 +2442,8 @@ INCLUDED_BY_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1722,7 +2454,8 @@ CALL_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1745,11 +2478,17 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif and svg. +# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, +# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, +# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1771,7 +2510,7 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = "@DOXYGEN_DOT_PATH@" +DOT_PATH = @DOXYGEN_DOT_PATH@ # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile @@ -1792,6 +2531,24 @@ MSCFILE_DIRS = DIAFILE_DIRS = +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. + +PLANTUML_JAR_PATH = + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized @@ -1828,7 +2585,7 @@ MAX_DOT_GRAPH_DEPTH = 10 DOT_TRANSPARENT = YES -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. @@ -1845,9 +2602,11 @@ DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc and +# plantuml temporary files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES diff --git a/bindings/csharp/Doxyfile.in b/bindings/csharp/Doxyfile.in index e1252a680..2360dc112 100644 --- a/bindings/csharp/Doxyfile.in +++ b/bindings/csharp/Doxyfile.in @@ -1,5 +1,43 @@ +# Doxyfile 1.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + PROJECT_NAME = "C# bindings for libiio" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + PROJECT_NUMBER = @LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@ # Using the PROJECT_BRIEF tag one can provide an optional one line description @@ -8,10 +46,10 @@ PROJECT_NUMBER = @LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@ PROJECT_BRIEF = "C# bindings for libIIO" -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. PROJECT_LOGO = @@ -21,17 +59,56 @@ PROJECT_LOGO = # left blank the current directory will be used. OUTPUT_DIRECTORY = @CMAKE_HTML_DEST_DIR@ + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the @@ -66,7 +143,7 @@ ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. @@ -110,6 +187,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -130,15 +217,23 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO @@ -157,16 +252,15 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -175,25 +269,60 @@ TCL_SUBST = OPTIMIZE_OUTPUT_FOR_C = NO +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # -# Note For files without extension you can use no_extension as a placeholder. +# Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -201,22 +330,72 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first +# tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent @@ -271,11 +450,24 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. @@ -285,35 +477,41 @@ LOOKUP_CACHE_SIZE = 0 EXTRACT_ALL = NO -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = NO -# This flag is only useful for Objective-C code. When set to YES local methods, +# This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are +# included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. @@ -328,6 +526,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -338,21 +543,21 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these +# documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. @@ -365,22 +570,36 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. # The default value is: system dependent. CASE_SENSE_NAMES = @CMAKE_CASE_SENSITIVE_FILESYSTEM@ # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the +# their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -408,14 +627,14 @@ INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. +# name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that +# name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. @@ -460,27 +679,25 @@ SORT_BY_SCOPE_NAME = NO STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. @@ -505,8 +722,8 @@ ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES @@ -551,11 +768,10 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. +# search path. See also \cite for info how to create references. CITE_BIB_FILES = @@ -571,7 +787,7 @@ CITE_BIB_FILES = QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. @@ -579,7 +795,7 @@ QUIET = YES WARNINGS = YES -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. @@ -596,12 +812,22 @@ WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = NO +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -625,7 +851,7 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/Dox_output_csharp # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with -# spaces. +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = @CMAKE_SOURCE_DIR@/bindings/csharp/ @@ -633,22 +859,32 @@ INPUT = @CMAKE_SOURCE_DIR@/bindings/csharp/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. -FILE_PATTERNS = *.cs *.dox +FILE_PATTERNS = *.cs \ + *.dox # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. @@ -663,7 +899,7 @@ RECURSIVE = NO # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -732,6 +968,10 @@ IMAGE_PATH = @CMAKE_SOURCE_DIR@/doc # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -741,11 +981,15 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for +# INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. @@ -793,7 +1037,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO @@ -805,7 +1049,7 @@ REFERENCED_BY_RELATION = NO REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. @@ -825,12 +1069,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -852,6 +1096,44 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -863,13 +1145,6 @@ VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -882,7 +1157,7 @@ IGNORE_PREFIX = # Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES @@ -944,13 +1219,15 @@ HTML_FOOTER = @CMAKE_SOURCE_DIR@/doc/template/footer.html HTML_STYLESHEET = -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -966,9 +1243,9 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to +# will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -997,12 +1274,24 @@ HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1026,13 +1315,14 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1071,8 +1361,8 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1094,28 +1384,29 @@ GENERATE_HTMLHELP = NO CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1146,7 +1437,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1154,8 +1446,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1163,30 +1455,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1228,7 +1520,7 @@ DISABLE_INDEX = NO # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has @@ -1256,13 +1548,24 @@ ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1272,7 +1575,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1283,9 +1586,15 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. @@ -1296,7 +1605,7 @@ USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1311,8 +1620,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1326,7 +1635,8 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1354,12 +1664,12 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There -# are two flavours of web server based searching depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. See -# the section "External Indexing and Searching" for details. +# implemented using a web server instead of a web client using JavaScript. There +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1371,9 +1681,10 @@ SERVER_BASED_SEARCH = NO # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1384,10 +1695,11 @@ EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1422,24 +1734,428 @@ EXTRA_SEARCH_MAPPINGS = # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. +# +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_CMD_NAME = + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate +# index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). +# The default file is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +MAKEINDEX_CMD_NAME = makeindex + +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + +# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used by the +# printer. +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x +# 14 inches) and executive (7.25 x 10.5 inches). +# The default value is: a4. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} +# If left blank no extra packages will be included. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the +# generated LaTeX document. The header should contain everything until the first +# chapter. If it is left blank doxygen will generate a standard header. See +# section "Doxygen usage" for information on how to let doxygen write the +# default header to a separate file. +# +# Note: Only use a user-defined header if you know what you are doing! The +# following commands have a special meaning inside the header: $title, +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty +# string, for the replacement values of the other commands the user is referred +# to HTML_HEADER. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the +# generated LaTeX document. The footer should contain everything after the last +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. +# +# Note: Only use a user-defined footer if you know what you are doing! +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_FOOTER = + +# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# LaTeX style sheets that are included after the standard style sheets created +# by doxygen. Using this option one can overrule certain style aspects. Doxygen +# will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_STYLESHEET = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the LATEX_OUTPUT output +# directory. Note that the files will be copied as-is; there are no commands or +# markers available. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will +# contain links (just like the HTML output) instead of page references. This +# makes the output suitable for online browsing using a PDF viewer. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode +# command to the generated LaTeX files. This will instruct LaTeX to keep running +# if errors occur, instead of asking the user for help. This option is also used +# when generating formulas in HTML. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BATCHMODE = NO + +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the +# index chapters (such as File Index, Compound Index, etc.) in the output. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HIDE_INDICES = NO + +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source +# code with syntax highlighting in the LaTeX output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. See +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# The default value is: plain. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BIB_STYLE = plain + +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The +# RTF output is optimized for Word 97 and may not look too pretty with other RTF +# readers/editors. +# The default value is: NO. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: rtf. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will +# contain hyperlink fields. The RTF file will contain links (just like the HTML +# output) instead of page references. This makes the output suitable for online +# browsing using Word or some other Word compatible readers that support those +# fields. +# +# Note: WordPad (write) and others do not support links. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. +# +# See also section "Doxygen usage" for information on how to generate the +# default style sheet that doxygen normally uses. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an RTF document. Syntax is +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_EXTENSIONS_FILE = + +# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code +# with syntax highlighting in the RTF output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for +# classes and files. +# The default value is: NO. + GENERATE_MAN = NO +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. A directory man3 will be created inside the directory specified by +# MAN_OUTPUT. +# The default directory is: man. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to the generated +# man pages. In case the manual section does not start with a number, the number +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is +# optional. +# The default value is: .3. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_EXTENSION = .3 + +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it +# will generate one additional man file for each entity documented in the real +# man page(s). These additional files only source the real man page, but without +# them the man command would be unable to find the correct page. +# The default value is: NO. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that +# captures the structure of the code including all documentation. +# The default value is: NO. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: xml. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_OUTPUT = xml + +# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program +# listings (including syntax highlighting and cross-referencing information) to +# the XML output. Note that enabling this will significantly increase the size +# of the XML output. +# The default value is: YES. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_PROGRAMLISTING = YES + +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files +# that can be used to generate PDF. +# The default value is: NO. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. +# The default directory is: docbook. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_OUTPUT = docbook + +# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module +# file that captures the structure of the code including all documentation. +# +# Note that this feature is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI +# output from the Perl module output. +# The default value is: NO. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely +# formatted so it can be parsed by a human reader. This is useful if you want to +# understand what is going on. On the other hand, if this tag is set to NO, the +# size of the Perl module output will be much smaller and Perl will parse it +# just the same. +# The default value is: YES. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file are +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful +# so different doxyrules.make files included by the same Makefile don't +# overwrite each other's variables. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_MAKEVAR_PREFIX = + #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names -# in the source code. If set to NO only conditional compilation will be +# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names +# in the source code. If set to NO, only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. @@ -1455,7 +2171,7 @@ MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO -# If the SEARCH_INCLUDES tag is set to YES the includes files in the +# If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1497,9 +2213,9 @@ PREDEFINED = EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all refrences to function-like macros that are alone on a line, have an -# all uppercase name, and do not end with a semicolon. Such function macros are -# typically used for boiler-plate code, and will confuse the parser if not +# remove all references to function-like macros that are alone on a line, have +# an all uppercase name, and do not end with a semicolon. Such function macros +# are typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1519,7 +2235,7 @@ SKIP_FUNCTION_MACROS = YES # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. -# Note: Each tag file must have an unique name (where the name does NOT include +# Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. @@ -1531,37 +2247,32 @@ TAGFILES = GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES all external class will be listed in the -# class index. If set to NO only the inherited external classes will be listed. +# If the ALLEXTERNALS tag is set to YES, all external class will be listed in +# the class index. If set to NO, only the inherited external classes will be +# listed. # The default value is: NO. ALLEXTERNALS = NO -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in -# the modules index. If set to NO, only the current project's groups will be +# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = YES -# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in +# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram +# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more @@ -1570,15 +2281,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -1586,7 +2288,7 @@ MSCGEN_PATH = DIA_PATH = -# If set to YES, the inheritance and collaboration graphs will hide inheritance +# If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -1597,7 +2299,7 @@ HIDE_UNDOC_RELATIONS = YES # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO -# The default value is: NO. +# The default value is: YES. HAVE_DOT = @DOXYGEN_DOT_FOUND@ @@ -1611,7 +2313,7 @@ HAVE_DOT = @DOXYGEN_DOT_FOUND@ DOT_NUM_THREADS = 0 -# When you want a differently looking font n the dot files that doxygen +# When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by @@ -1659,7 +2361,7 @@ COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. @@ -1676,10 +2378,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -1711,7 +2435,8 @@ INCLUDED_BY_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1722,7 +2447,8 @@ CALL_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1745,11 +2471,17 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif and svg. +# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, +# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, +# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -1771,7 +2503,7 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = "@DOXYGEN_DOT_PATH@" +DOT_PATH = @DOXYGEN_DOT_PATH@ # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile @@ -1792,6 +2524,24 @@ MSCFILE_DIRS = DIAFILE_DIRS = +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. + +PLANTUML_JAR_PATH = + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized @@ -1828,7 +2578,7 @@ MAX_DOT_GRAPH_DEPTH = 10 DOT_TRANSPARENT = YES -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. @@ -1845,9 +2595,11 @@ DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc and +# plantuml temporary files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES From fe21df7a138f496bf3890c7cd77b4861ed1feb8b Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 4 May 2023 16:14:53 +0200 Subject: [PATCH 13/86] tests: Change -T/--Timeout option to -d/--duration in iio_stresstest The -T/--timeout (lowercase) option is already present as a common option, and allows to configure the Libiio context timeout in milliseconds. Signed-off-by: Paul Cercueil --- tests/iio_stresstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/iio_stresstest.c b/tests/iio_stresstest.c index 13683ee80..6a57af2fb 100644 --- a/tests/iio_stresstest.c +++ b/tests/iio_stresstest.c @@ -100,7 +100,7 @@ static const struct option options[] = { {"uri", required_argument, 0, 'u'}, {"buffer-size", required_argument, 0, 'b'}, {"samples", required_argument, 0, 's' }, - {"Timeout", required_argument, 0, 'T'}, + {"duration", required_argument, 0, 'd'}, {"threads", required_argument, 0, 't'}, {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}, From 800c3946dddd24a3ee1acb5d2cbedacd4fb34650 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 8 May 2023 13:51:12 +0200 Subject: [PATCH 14/86] tests: Move iio_adi_xflow_check to examples This tool is very ADI-specific and not really useful as a generic IIO utility. Therefore, it makes more sense to have it as part of the examples. Signed-off-by: Paul Cercueil --- examples/CMakeLists.txt | 7 +++++++ {tests => examples}/iio_adi_xflow_check.c | 2 +- tests/CMakeLists.txt | 5 +---- 3 files changed, 9 insertions(+), 5 deletions(-) rename {tests => examples}/iio_adi_xflow_check.c (99%) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 961e26bde..bce222e2e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -89,6 +89,13 @@ else() message(STATUS "Curses Development Kit (CDK) missing or too old, skipping iio-monitor") endif () +if (PTHREAD_LIBRARIES OR ANDROID) + project(iio_adi_xflow_check C) + add_executable(iio_adi_xflow_check iio_adi_xflow_check.c) + target_link_libraries(iio_adi_xflow_check iio iio_tests_helper ${PTHREAD_LIBRARIES}) + set(IIO_TESTS_TARGETS ${IIO_TESTS_TARGETS} iio_adi_xflow_check) +endif() + set_target_properties( ${IIO_TESTS_TARGETS} PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED ON C_EXTENSIONS OFF diff --git a/tests/iio_adi_xflow_check.c b/examples/iio_adi_xflow_check.c similarity index 99% rename from tests/iio_adi_xflow_check.c rename to examples/iio_adi_xflow_check.c index 688148e6f..e540b730b 100644 --- a/tests/iio_adi_xflow_check.c +++ b/examples/iio_adi_xflow_check.c @@ -15,7 +15,7 @@ #include #include -#include "iio_common.h" +#include "../tests/iio_common.h" #define MY_NAME "iio_adi_xflow_check" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 51c1e4132..7fba8d510 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,13 +57,10 @@ target_link_libraries(iio_writedev iio iio_tests_helper) set(IIO_TESTS_TARGETS iio_genxml iio_info iio_attr iio_readdev iio_reg iio_writedev) if(PTHREAD_LIBRARIES OR ANDROID) - project(iio_adi_xflow_check C) project(iio_stresstest C) - add_executable(iio_adi_xflow_check iio_adi_xflow_check.c) add_executable(iio_stresstest iio_stresstest.c) - target_link_libraries(iio_adi_xflow_check iio iio_tests_helper ${PTHREAD_LIBRARIES}) target_link_libraries(iio_stresstest iio iio_tests_helper ${PTHREAD_LIBRARIES}) - set(IIO_TESTS_TARGETS ${IIO_TESTS_TARGETS} iio_adi_xflow_check iio_stresstest) + set(IIO_TESTS_TARGETS ${IIO_TESTS_TARGETS} iio_stresstest) target_link_libraries(iio_readdev ${PTHREAD_LIBRARIES}) target_link_libraries(iio_writedev ${PTHREAD_LIBRARIES}) From 9f4949fa1b24a72174a3dd635554e828826f9672 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 26 Feb 2023 16:56:47 -0500 Subject: [PATCH 15/86] man: manage common parts of man pages in one place and stitch them together at build time, rather than using copy/paste everywhere, and forcing mutliple updates. Update a tiny bit the man pages, to be a little more pedanitic about serial ports, and a few other minor updates. Signed-off-by: Robin Getz Signed-off-by: Paul Cercueil --- man/CMakeLists.txt | 14 +++++++-- man/iio_attr.1.in | 62 +++--------------------------------- man/iio_common_cmds.1 | 11 +++++++ man/iio_common_footer.1 | 20 ++++++++++++ man/iio_common_opts.1 | 36 +++++++++++++++++++++ man/iio_info.1.in | 70 +++-------------------------------------- man/iio_readdev.1.in | 57 +++------------------------------ man/iio_reg.1.in | 32 +++---------------- man/iio_writedev.1.in | 60 ++++------------------------------- man/make_util_pages.sh | 21 +++++++++++++ 10 files changed, 123 insertions(+), 260 deletions(-) create mode 100644 man/iio_common_cmds.1 create mode 100644 man/iio_common_footer.1 create mode 100644 man/iio_common_opts.1 create mode 100755 man/make_util_pages.sh diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 04ee6ed1e..c321e8554 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,3 +1,6 @@ +# it doesn't make sense to create man pages on windows, so we don't really +# worry about that. + if (WITH_MAN) find_program(BASH_EXECUTABLE bash) find_program(DATE_EXECUTABLE date) @@ -36,8 +39,15 @@ if (WITH_MAN) if (WITH_TESTS) list(APPEND MAN1 iio_attr.1 iio_info.1 iio_readdev.1 iio_reg.1 iio_writedev.1) foreach(_page ${MAN1}) - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${_page}.in - ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/${_page} @ONLY) + execute_process( + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_util_pages.sh + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_page}.1.in + OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_page}.1.in + ) + configure_file( + ${CMAKE_CURRENT_BINARY_DIR}/${_page}.1.in + ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/${_page}.1 @ONLY + ) endforeach() if (WITH_DOC) file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man1) diff --git a/man/iio_attr.1.in b/man/iio_attr.1.in index aa4975139..eb26d0a3b 100644 --- a/man/iio_attr.1.in +++ b/man/iio_attr.1.in @@ -82,45 +82,11 @@ Read and Write IIO Context attributes .TP .B \-D \-\-debug-attr Read and Write IIO Debug attributes -.TP -.B \-S, \-\-scan -Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip,usb'. -Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456:b673'. -vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) -If no argument is given, it checks all that are availble. -.TP -.B \-h, \-\-help -Tells -.I iio_attr -to display some help, and then quit. - +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## .SH OPTIONS -.TP -.B \-a, \-\-auto -Look around for devices (locally, ip, and usb), and if there is only one device -found, connect to it. -.TP -.B \-u, \-\-uri -The Uniform Resource Identifier -.I (uri) -for connecting to devices, can be one of: -.RS -.IP ip:[address] -network address, either numeric (192.168.0.1) or network hostname (pluto.local) -.IP ip: -blank, if compiled with zeroconf support, will find an IIO device on network -.IP usb:[device:port:instance] -normally returned from -.B iio_info -s -or -.B iio_attr -S -.IP usb: -blank, if there is only one IIO device plugged into USB, find it, and attach to it. -.IP serial:[port],[baud],[config] -serial configuration, serial:/dev/ttyUSB0,115200,8n1 115200 baud, 8 data bits, no partity, one stop bit -.IP local: -with no address part -.RE +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## .TP .B \-i, \-\-input-channel Filters channels by input channels only @@ -140,23 +106,3 @@ Generate small C or python snippets that emulate what you are doing on the comma .SH RETURN VALUE If the specified device is not found, a non-zero exit code is returned. -.SH "SEE ALSO" -.ad l -.BR iio_attr (1), -.BR iio_info (1), -.BR iio_readdev (1), -.BR iio_reg (1), -.BR iio_writedev (1), -.BR libiio (3) -.PP -libiio home page: -.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio -.PP -libiio code: -.BR \%https://github.com/analogdevicesinc/libiio -.PP -Doxygen for libiio -.BR \%https://analogdevicesinc.github.io/libiio/ -.SH BUGS -All bugs are tracked at: -.BR \%https://github.com/analogdevicesinc/libiio/issues diff --git a/man/iio_common_cmds.1 b/man/iio_common_cmds.1 new file mode 100644 index 000000000..ca83f83a2 --- /dev/null +++ b/man/iio_common_cmds.1 @@ -0,0 +1,11 @@ +.TP +.B \-h, \-\-help +Tells +.I ##APP_NAME## +to display some help, and then quit. +.TP +.B \-S, \-\-scan [backends] +Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip:usb'. +Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456,b673'. +vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) +If no argument is given, it checks all that are availble. diff --git a/man/iio_common_footer.1 b/man/iio_common_footer.1 new file mode 100644 index 000000000..4d813f23e --- /dev/null +++ b/man/iio_common_footer.1 @@ -0,0 +1,20 @@ +.SH "SEE ALSO" +.ad l +.BR iio_attr (1), +.BR iio_info (1), +.BR iio_readdev (1), +.BR iio_reg (1), +.BR iio_writedev (1), +.BR libiio (3) +.PP +libiio home page: +.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio +.PP +libiio code: +.BR \%https://github.com/analogdevicesinc/libiio +.PP +Doxygen for libiio +.BR \%https://analogdevicesinc.github.io/libiio/ +.SH BUGS +All bugs are tracked at: +.BR \%https://github.com/analogdevicesinc/libiio/issues diff --git a/man/iio_common_opts.1 b/man/iio_common_opts.1 new file mode 100644 index 000000000..cb8530af3 --- /dev/null +++ b/man/iio_common_opts.1 @@ -0,0 +1,36 @@ +.TP +.B \-u, \-\-uri +The Uniform Resource Identifier +.I (uri) +for connecting to devices, can be one of: +.RS +.IP ip:[address] +network address, either numeric (192.168.0.1) or network hostname +.IP ip: +blank, if compiled with zeroconf support, will find an IIO device on network +.IP usb:[device:port:instance] +normally returned from +.B ##APP_NAME## -S +.IP serial:[port],[baud],[settings] +which are controlled, and need to match the iiod (or tinyiiod) on the other end of the serial port. +.RS +.IP [port] +is something like '/dev/ttyUSB0' on Linux, and 'COM4' on Windows. +.IP [baud] +is is normally one of 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200 [default], 128000 or 256000, but can vary system to system. +.IP [settings] +would normally be configured as '8n1' this is controlled by: +.RS +.IP data_bits: +(5, 6, 7, 8 [default], or 9) +.IP parity_bits: +('n' none [default], 'o' odd, 'e' even, 'm' mark, or 's' space) +.IP stop_bits: +(1 [default, or 2) +.IP flow_control: +('0' none [default], 'x' Xon Xoff, 'r' RTSCTS, or 'd' DTRDSR) +.RE +.RE +.IP local: +with no address part. +.RE diff --git a/man/iio_info.1.in b/man/iio_info.1.in index 9fb15aedc..e39065f25 100644 --- a/man/iio_info.1.in +++ b/man/iio_info.1.in @@ -31,58 +31,16 @@ iio_info \- list IIO devices and device attributes [ .I options ] --x -.br -.B iio_info -[ -.I options -] --n -.br -.B iio_info -[ -.I options -] -u .SH DESCRIPTION .B iio_info is a utility for displaying information about local or remote IIO devices .SH OPTIONS -.TP -.B \-h, \-\-help -Tells -.I iio_info -to display some help, and then quit. -.TP -.B \-x, \-\-xml -Use the XML backend with the provided XML file -.TP -.B \-n, \-\-network -Use the network backend with the provided hostname -.TP -.B \-u, \-\-uri -The Uniform Resource Identifier -.I (uri) -for connecting to devices, can be one of: -.RS -.IP ip:[address] -network address, either numeric (192.168.0.1) or network hostname -.IP ip: -blank, if compiled with zeroconf support, will find an IIO device on network -.IP usb:[device:port:instance] -normally returned from -.B iio_info -s -.IP serial:[port] -.IP local -with no address part -.RE -.TP -.B \-S, \-\-scan -Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip,usb'. -Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456:b673'. -vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) -If no argument is given, it checks all that are availble. +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## .TP .B \-a, \-\-auto Scan for available contexts and if only one is available use it. @@ -90,23 +48,3 @@ Scan for available contexts and if only one is available use it. .SH RETURN VALUE If the specified device is not found, a non-zero exit code is returned. -.SH "SEE ALSO" -.ad l -.BR iio_attr (1), -.BR iio_info (1), -.BR iio_readdev (1), -.BR iio_reg (1), -.BR iio_writedev (1), -.BR libiio (3) -.PP -libiio home page: -.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio -.PP -libiio code: -.BR \%https://github.com/analogdevicesinc/libiio -.PP -Doxygen for libiio -.BR \%https://analogdevicesinc.github.io/libiio/ -.SH BUGS -All bugs are tracked at: -.BR \%https://github.com/analogdevicesinc/libiio/issues diff --git a/man/iio_readdev.1.in b/man/iio_readdev.1.in index 6d0f0c267..e0cb04351 100644 --- a/man/iio_readdev.1.in +++ b/man/iio_readdev.1.in @@ -37,30 +37,8 @@ iio_readdev \- read buffers from an IIO device is a utility for reading buffers from connected IIO devices, and sending resutls to standard out. .SH OPTIONS -.TP -.B \-h, \-\-help -Tells -.I iio_readdev -to display some help, and then quit. -.B \-n, \-\-network -Use the network backend with the provided hostname -.TP -.B \-u, \-\-uri -The Uniform Resource Identifier -.I (uri) -for connecting to devices, can be one of: -.RS -.IP ip:[address] -network address, either numeric (192.168.0.1) or network hostname -.IP ip: -blank, if compiled with zeroconf support, will find an IIO device on network -.IP usb:[device:port:instance] -normally returned from -.B iio_info -s -.IP serial:[port] -.IP local -with no address part -.RE +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## .TP .B \-t \-\-trigger Use the specified trigger, if needed on the specified channel @@ -73,15 +51,8 @@ Number of samples (not bytes) to capture, 0 = infinite. Default is 0. .TP .B \-T \-\-timeout Buffer timeout in milliseconds. 0 = no timeout. Default is 0. -.TP -.B \-a, \-\-auto -Scan for available contexts and if only one is available use it. -.TP -.B \-S, \-\-scan -Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip,usb'. -Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456:b673'. -vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) -If no argument is given, it checks all that are availble. +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## .SH RETURN VALUE If the specified device is not found, a non-zero exit code is returned. @@ -115,23 +86,3 @@ And plots the data with gnuplot. .B \f(WCgnuplot \-e \(dq\&set term png; set output 'sample.png'; plot 'sample.dat' binary format='%short%short' using 1 with lines, 'sample.dat' binary format='%short%short' using 2 with lines;\(dq\&\fP .RE -.SH "SEE ALSO" -.ad l -.BR iio_attr (1), -.BR iio_info (1), -.BR iio_readdev (1), -.BR iio_reg (1), -.BR iio_writedev (1), -.BR libiio (3) -.PP -libiio home page: -.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio -.PP -libiio code: -.BR \%https://github.com/analogdevicesinc/libiio -.PP -Doxygen for libiio -.BR \%https://analogdevicesinc.github.io/libiio/ -.SH BUGS -All bugs are tracked at: -.BR \%https://github.com/analogdevicesinc/libiio/issues diff --git a/man/iio_reg.1.in b/man/iio_reg.1.in index 4518a469e..524df4b4f 100644 --- a/man/iio_reg.1.in +++ b/man/iio_reg.1.in @@ -34,7 +34,7 @@ iio_reg \- do a low level read or write to SPI or I2C register [] .SH DESCRIPTION .B iio_reg -is a utility for debugging local IIO devices. +is a utility for debugging local or remote IIO devices. It should not be used by normal users, and is normally used by driver developers during development, or by end users debugging a driver, or sending in a feature request. @@ -42,33 +42,11 @@ It provides a mechanism to read or write SPI or I2C registers for IIO devices. This can be useful when troubleshooting IIO devices, and understanding how the Linux IIO subsystem is managing the device. -This IIO utility does not work across a network or USB context. .SH OPTIONS -.TP -.B \-h, \-\-help -Tells -.I iio_reg -to display some help, and then quit. +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## .SH RETURN VALUE If the specified device is not found, a non-zero exit code is returned. -.SH "SEE ALSO" -.ad l -.BR iio_attr (1), -.BR iio_info (1), -.BR iio_readdev (1), -.BR iio_reg (1), -.BR iio_writedev (1), -.BR libiio (3) -.PP -libiio home page: -.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio -.PP -libiio code: -.BR \%https://github.com/analogdevicesinc/libiio -.PP -Doxygen for libiio -.BR \%https://analogdevicesinc.github.io/libiio/ -.SH BUGS -All bugs are tracked at: -.BR \%https://github.com/analogdevicesinc/libiio/issues diff --git a/man/iio_writedev.1.in b/man/iio_writedev.1.in index 723d5b6e0..95684f686 100644 --- a/man/iio_writedev.1.in +++ b/man/iio_writedev.1.in @@ -31,42 +31,14 @@ iio_writedev \- write buffers on an IIO device [ .I options ] -[-n ] [-t ] [-T ] [-b ] [-s ] [ ...] +[-t ] [-T ] [-b ] [-s ] [ ...] .SH DESCRIPTION .B iio_reg is a utility for writing buffers from connected IIO devices. .SH OPTIONS -.TP -.B \-h, \-\-help -Tells -.I iio_readdev -to display some help, and then quit. -.B \-n, \-\-network -Use the network backend with the provided hostname -.TP -.B \-u, \-\-uri -The Uniform Resource Identifier -.I (uri) -for connecting to devices, can be one of: -.RS -.IP ip:[address] -network address, either numeric (192.168.0.1) or network hostname -.IP ip: -blank, if compiled with zeroconf support, will find an IIO device on network -.IP usb:[device:port:instance] -normally returned from -.B iio_info -s -.IP serial:[port] -.IP local -with no address part -.TP -.B \-S, \-\-scan -Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip,usb'. -Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456:b673'. -vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) -If no argument is given, it checks all that are availble. -.RE +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## .TP .B \-t \-\-trigger Use the specified trigger, if needed on the specified channel @@ -80,11 +52,10 @@ Number of samples (not bytes) to capture, 0 = infinite. Default is 0. .B \-T \-\-timeout Buffer timeout in milliseconds. 0 = no timeout. Default is 0. .TP -.B \-a, \-\-auto -Scan for available contexts and if only one is available use it. -.TP .B \-c \-\-cyclic Use cyclic buffer mode. +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## .SH RETURN VALUE If the specified device is not found, a non-zero exit code is returned. @@ -113,23 +84,4 @@ This sends 1024 samples of I and Q data to the USB attached AD9361. data is taki .B \f(CWiio_writedev \-a \-s 1024 cf-ad9361-dds-core-lpc voltage0 voltage1 < ./samples.dat\fP .RE -.SH "SEE ALSO" -.ad l -.BR iio_attr (1), -.BR iio_info (1), -.BR iio_readdev (1), -.BR iio_reg (1), -.BR iio_writedev (1), -.BR libiio (3) -.PP -libiio home page: -.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio -.PP -libiio code: -.BR \%https://github.com/analogdevicesinc/libiio -.PP -Doxygen for libiio -.BR \%https://analogdevicesinc.github.io/libiio/ -.SH BUGS -All bugs are tracked at: -.BR \%https://github.com/analogdevicesinc/libiio/issues + diff --git a/man/make_util_pages.sh b/man/make_util_pages.sh new file mode 100755 index 000000000..61d4e2835 --- /dev/null +++ b/man/make_util_pages.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +dir=$1 +if [ -z "${dir}" -o ! -f "${dir}/iio_common_cmds.1" -o ! -f "${dir}/iio_common_opts.1" -o ! -f "${dir}/iio_common_footer.1" ] ; then + echo "not pointing to src directory ${dir}" 1>&2 + exit +fi +file=$2 +if [ -z "${file}" -o ! -f "${file}" ] ; then + echo "missing 2nd argument file to manipulate ${file}" 1>&2 + exit +fi + +app=$(grep "^.TH" "${file}" | head -1 | awk '{print $2}') + +sed '/##COMMON_COMMANDS_START##/Q' "${file}" +sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_cmds.1" +sed -n '/^##COMMON_COMMANDS_STOP##/,${p;/^##COMMON_OPTION_START##/q}' "${file}" | grep -v "##COMMON_" +sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_opts.1" +sed -ne '/^##COMMON_OPTION_STOP#/,$ p' "${file}" | grep -v "##COMMON_OPTION_STOP##" +sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_footer.1" From d8d66ef5127bec624f511fefe1372b49d6f67995 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 3 May 2023 11:47:59 +0200 Subject: [PATCH 16/86] man: Simplify call to make_man.sh There is no need to execute make_man.sh through a shell with a shell redirection, CMake can redirect the output to a file for us, and the make_man.sh script should be executable already. Also move the generated libiio.3.in to the "man" build dir for consistency. Signed-off-by: Paul Cercueil --- man/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index c321e8554..a04df86b2 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -2,7 +2,6 @@ # worry about that. if (WITH_MAN) - find_program(BASH_EXECUTABLE bash) find_program(DATE_EXECUTABLE date) if (DEFINED ENV{SOURCE_DATE_EPOCH}) execute_process( @@ -17,10 +16,12 @@ if (WITH_MAN) ${CMAKE_CURRENT_SOURCE_DIR}/make_man.sh.in ${CMAKE_CURRENT_BINARY_DIR}/make_man.sh @ONLY) execute_process( - COMMAND ${BASH_EXECUTABLE} "-c" "${CMAKE_CURRENT_BINARY_DIR}/make_man.sh > ${CMAKE_BINARY_DIR}/libiio.3.in" - ) + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/make_man.sh + OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/libiio.3.in + ) + configure_file( - ${CMAKE_BINARY_DIR}/libiio.3.in + ${CMAKE_CURRENT_BINARY_DIR}/libiio.3.in ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/libiio.3 @ONLY) if (WITH_DOC) From 459d815f81a569017b5b41c5e6b1a558949e3ec2 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 4 May 2023 16:25:30 +0200 Subject: [PATCH 17/86] man: Add missing man pages Add man pages for iio_genxml, iio_stresstest and iiod. The CMake code will also process the templates of the utilities enabled in the config, instead of hardcoding a list in the script. Signed-off-by: Paul Cercueil --- man/CMakeLists.txt | 22 ++++---- man/iio_genxml.1.in | 46 +++++++++++++++++ man/iio_stresstest.1.in | 69 +++++++++++++++++++++++++ man/iiod.1.in | 108 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 236 insertions(+), 9 deletions(-) create mode 100644 man/iio_genxml.1.in create mode 100644 man/iio_stresstest.1.in create mode 100644 man/iiod.1.in diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index a04df86b2..b3a7a6fc4 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -30,7 +30,7 @@ if (WITH_MAN) message(FATAL_ERROR "Can not build html DOC from man without man2html") endif() message(STATUS "Building html doc pages with man2html") - file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man3) + file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man1 ${CMAKE_HTML_DEST_DIR}/man3) execute_process( COMMAND ${MAN2HTML} -r INPUT_FILE ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/libiio.3 @@ -38,8 +38,7 @@ if (WITH_MAN) ) endif() if (WITH_TESTS) - list(APPEND MAN1 iio_attr.1 iio_info.1 iio_readdev.1 iio_reg.1 iio_writedev.1) - foreach(_page ${MAN1}) + foreach(_page ${IIO_TESTS_TARGETS}) execute_process( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_util_pages.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_page}.1.in @@ -49,18 +48,23 @@ if (WITH_MAN) ${CMAKE_CURRENT_BINARY_DIR}/${_page}.1.in ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/${_page}.1 @ONLY ) - endforeach() - if (WITH_DOC) - file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man1) - foreach(_page ${MAN1}) + + if (WITH_DOC) execute_process( COMMAND ${MAN2HTML} -r INPUT_FILE ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/${_page} OUTPUT_FILE ${CMAKE_HTML_DEST_DIR}/man1/${_page}.html ) - endforeach() - endif() + endif() + endforeach() endif() + + if (WITH_IIOD) + configure_file(iiod.1.in + ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/iiod.1 @ONLY + ) + endif() + # install man files into the BINARY directories, # section 3 = library functions install(DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR} diff --git a/man/iio_genxml.1.in b/man/iio_genxml.1.in new file mode 100644 index 000000000..47fa05a77 --- /dev/null +++ b/man/iio_genxml.1.in @@ -0,0 +1,46 @@ +.\" Copyright (c) 2018-2020 Robin Getz +.\" Copyright (c) 2018-2020 Analog Devices Inc. +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; 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 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.TH iio_genxml 1 "@CMAKE_DATE@" "libiio-@LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@" "LibIIO Utilities" +.IX iio_genxml +.SH NAME +iio_genxml \- Generate XML representation of a Libiio context +.SH SYNOPSIS +.B iio_genxml +[ +.I options +] + +.SH DESCRIPTION +.B iio_genxml +is a utility for generating a XML representation of a Libiio context. + +.SH OPTIONS +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## + +.SH RETURN VALUE +If the specified device is not found, a non-zero exit code is returned. diff --git a/man/iio_stresstest.1.in b/man/iio_stresstest.1.in new file mode 100644 index 000000000..64a28b320 --- /dev/null +++ b/man/iio_stresstest.1.in @@ -0,0 +1,69 @@ +.\" Copyright (c) 2018-2020 Robin Getz +.\" Copyright (c) 2018-2020 Analog Devices Inc. +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; 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 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.TH iio_stresstest 1 "@CMAKE_DATE@" "libiio-@LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@" "LibIIO Utilities" +.IX iio_stresstest +.SH NAME +iio_stresstest \- Stress test program for Libiio +.SH SYNOPSIS +.B iio_stresstest +[ +.I options +] +-u +.SH DESCRIPTION +.B iio_stresstest +is a stress-testing program that can be used to find bugs in Libiio or in the Libiio daemon (IIOD). + + +.SH OPTIONS +##COMMON_COMMANDS_START## +##COMMON_COMMANDS_STOP## +##COMMON_OPTION_START## +##COMMON_OPTION_STOP## +.TP +.B \-a, \-\-auto +Scan for available contexts and if only one is available use it. +.TP +.B \-T, \-\-timeout +Context timeout in milliseconds. 0 = no timeout (wait forever) +.TP +.B \-b, \-\-buffer\-size +Size of the capture buffer. Default is 256. +.TP +.B \-s, \-\-samples +Number of samples to capture, 0 = infinite. Default is 0. +.TP +.B \-d, \-\-duration +Time to wait (in seconds) before stopping all threads +.TP +.B \-t, \-\-threads +Number of threads to use +.TP +.B \-v, \-\-verbose +Increase verbosity (-vv and -vvv for more) + +.SH RETURN VALUE +If the specified device is not found, a non-zero exit code is returned. + diff --git a/man/iiod.1.in b/man/iiod.1.in new file mode 100644 index 000000000..fce7da40d --- /dev/null +++ b/man/iiod.1.in @@ -0,0 +1,108 @@ +.\" Copyright (c) 2018-2020 Robin Getz +.\" Copyright (c) 2018-2020 Analog Devices Inc. +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; 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 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.TH iiod 1 "@CMAKE_DATE@" "libiio-@LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@" "LibIIO Utilities" +.IX iiod +.SH NAME +iiod \- IIO Daemon +.SH SYNOPSIS +.B iiod +[ +.I options +] + +.SH DESCRIPTION +.B iiod +is a server built on top of Libiio which can share a Libiio context across the +network, USB, or a UART link. + +.SH COMMANDS +.TP +.B \-V, \-\-version +Display the version of this program. +.TP +.B \-d, \-\-debug +Use alternative (incompatible) debug interface. +.TP +.B \-D, \-\-demux +Demux channels directly on the server. +.TP +.B \-i, \-\-interactive +Run iiod in the controlling terminal. +.TP +.B \-a, \-\-aio +Use asynchronous I/O. +.TP +.B \-F, \-\-ffs +Use the given FunctionFS mountpoint to serve over USB. +.TP +.B \-n, \-\-nb\-pipes +Specify the number of USB pipes (ep couples) to use. +.TP +.B \-s, \-\-serial +Run iiod on the specified UART. +.TP +.B \-p, \-\-port +Port to listen on (default = 30431). +Using --port 0 will pick an ephemeral port (dynamic / unused in the range between 32768–60999). +.TP +.B \-u, \-\-uri +The Uniform Resource Identifier +.I (uri) +for connecting to devices, can be one of: +.RS +.IP ip:[address] +network address, either numeric (192.168.0.1) or network hostname +.IP ip: +blank, if compiled with zeroconf support, will find an IIO device on network +.IP usb:[device:port:instance] +normally returned from +.B iio_info -S +.IP serial:[port],[baud],[settings] +which are controlled, and need to match the iiod (or tinyiiod) on the other end of the serial port. +.RS +.IP [port] +is something like '/dev/ttyUSB0' on Linux, and 'COM4' on Windows. +.IP [baud] +is is normally one of 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200 [default], 128000 or 256000, but can vary system to system. +.IP [settings] +would normally be configured as '8n1' this is controlled by: +.RS +.IP data_bits: +(5, 6, 7, 8 [default], or 9) +.IP parity_bits: +('n' none [default], 'o' odd, 'e' even, 'm' mark, or 's' space) +.IP stop_bits: +(1 [default, or 2) +.IP flow_control: +('0' none [default], 'x' Xon Xoff, 'r' RTSCTS, or 'd' DTRDSR) +.RE +.RE +.IP local: +with no address part. This is the default. +.RE +.TP + +.SH RETURN VALUE +If the specified device is not found, a non-zero exit code is returned. From eacddbffd995d608862d84f12199756aa64cabd5 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 8 May 2023 17:49:57 +0200 Subject: [PATCH 18/86] doc: Generate hyperlinks to manuals of utilities Instead of hardcoding hyperlinks to the man pages of Libiio utils, generate them based on the config. Signed-off-by: Paul Cercueil --- CMakeLists.txt | 4 ++++ doc/index.html.in | 16 +--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1baa7c3d2..d09020dbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -536,6 +536,10 @@ if(WITH_DOC) DESTINATION ${CMAKE_HTML_DEST_DIR}/${CMAKE_API_DEST_DIR} FILES_MATCHING PATTERN "*.svg") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/doc/html/ DESTINATION ${CMAKE_HTML_DEST_DIR}) + set(IIO_TESTS_MAN_PAGES_HTML "") + foreach(_page ${IIO_TESTS_TARGETS}) + set(IIO_TESTS_MAN_PAGES_HTML "${IIO_TESTS_MAN_PAGES_HTML}
  • ${_page}
  • ") + endforeach() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html.in ${CMAKE_HTML_DEST_DIR}/index.html @ONLY) diff --git a/doc/index.html.in b/doc/index.html.in index 5baefbb2b..eb0358861 100644 --- a/doc/index.html.in +++ b/doc/index.html.in @@ -130,21 +130,7 @@
  • libiio
  • -
  • - iio_attr -
  • -
  • - iio_info -
  • -
  • - iio_readdev -
  • -
  • - iio_reg -
  • -
  • - iio_writedev -
  • + @IIO_TESTS_MAN_PAGES_HTML@ From 33b8b70c990b3f0dcdde5cc7f95ed337175e61f6 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 8 May 2023 18:00:03 +0200 Subject: [PATCH 19/86] man: iio_{read,write}dev: Update examples Update the USAGE section which prints examples of how iio_readdev and iio_writedev can be used. Signed-off-by: Paul Cercueil --- man/iio_readdev.1.in | 23 +++++++++++++---------- man/iio_writedev.1.in | 25 ++++++++++++++----------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/man/iio_readdev.1.in b/man/iio_readdev.1.in index e0cb04351..eb00e5679 100644 --- a/man/iio_readdev.1.in +++ b/man/iio_readdev.1.in @@ -59,20 +59,23 @@ If the specified device is not found, a non-zero exit code is returned. .SH "USAGE" .PP You use iio_readdev in the same way you use many of the other libiio utilities. -You must specify a IIO device, and the specific channel to read. Since this is a read, channels must be input. -It is easy to use -.B iio_attr -to find out what the channels are called. -.PP -This identifies the device, and channel that can be used. +You should specify a IIO device, and the specific channel to read. Since this is a read, channels must be input. +If no channel is provided, iio_readdev will read from all input channels. +If no device is provided, iio_readdev will print a few examples: .RS -.B \f(CWiio_attr \-a \-i \-c .\fP +.B \f(CWiio_readdev -a\fP +.br +Using auto-detected IIO context at URI "usb:3.10.5" +.br +Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage0 +.br +Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage1 .br -\f(CWUsing auto-detected IIO context at URI "usb:3.10.5"\fP +Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage2 .br -dev 'cf-ad9361-lpc', channel 'voltage0' (input, index: 0, format: le:S12/16>>0) +Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage3 .br -dev 'cf-ad9361-lpc', channel 'voltage1' (input, index: 1, format: le:S12/16>>0) +Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc .RE .PP This captures 1024 samples of I and Q data from the USB attached AD9361, and diff --git a/man/iio_writedev.1.in b/man/iio_writedev.1.in index 95684f686..ca38f317d 100644 --- a/man/iio_writedev.1.in +++ b/man/iio_writedev.1.in @@ -62,21 +62,24 @@ If the specified device is not found, a non-zero exit code is returned. .SH "USAGE" .PP -You use iio_readdev in the same way you use many of the other libiio utilities. -You must specify a IIO device, and the specific channel to read. Since this is a write, channels must be output. -It is easy to use -.B iio_attr -to find out what the channels are called. -.PP -This identifies the device, and channel that can be used. +You use iio_writedev in the same way you use many of the other libiio utilities. +You should specify a IIO device, and the specific channel to write. Since this is a write, channels must be output. +If no channel is provided, iio_writedev will write to all output channels. +If no device is provided, iio_writedev will print a few examples: .RS -.B \f(CWiio_attr \-a \-o \-c .\fP +.B \f(CWiio_writedev -a\fP +.br +Using auto-detected IIO context at URI "usb:3.10.5" +.br +Example : iio_writedev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-dds-core-lpc voltage0 +.br +Example : iio_writedev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-dds-core-lpc voltage1 .br -\f(CWUsing auto-detected IIO context at URI "usb:3.10.5"\fP +Example : iio_writedev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-dds-core-lpc voltage2 .br -dev 'cf-ad9361-dds-core-lpc', channel 'voltage0' (output, index: 0, format: le:S16/16>>0) +Example : iio_writedev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-dds-core-lpc voltage3 .br -dev 'cf-ad9361-dds-core-lpc', channel 'voltage1' (output, index: 1, format: le:S16/16>>0) +Example : iio_writedev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-dds-core-lpc .RE .PP This sends 1024 samples of I and Q data to the USB attached AD9361. data is taking from standard in, in a binary format. From 7cb06e0f4e09208852ad464545003c8eb0b6e2e8 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 19:49:02 -0400 Subject: [PATCH 20/86] treat warnings as errors in CI In the past, when we build on travis and appveyor, we would detect this, and turn on -Werror (treating warnings as errors). Somewhere along the line - that got lost. Re-enable that for azure pipelines, and document it in the README At the same time, turn on the equivilent for the cmake files themselves. Signed-off-by: Robin Getz --- CI/azure/ci-ubuntu.sh | 2 +- CI/build_win.ps1 | 2 +- CMakeLists.txt | 9 +++++---- README_BUILD.md | 1 + azure-pipelines.yml | 8 ++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CI/azure/ci-ubuntu.sh b/CI/azure/ci-ubuntu.sh index 45c13bfb0..0f2b8abc1 100644 --- a/CI/azure/ci-ubuntu.sh +++ b/CI/azure/ci-ubuntu.sh @@ -3,6 +3,6 @@ set -x uname -a echo "$PWD" mkdir build && cd build -cmake .. -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" +cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" make make package diff --git a/CI/build_win.ps1 b/CI/build_win.ps1 index 2802ba67f..2d35ceb19 100644 --- a/CI/build_win.ps1 +++ b/CI/build_win.ps1 @@ -10,7 +10,7 @@ mkdir build-x64 cp .\libiio.iss.cmakein .\build-x64 cd build-x64 -cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. +cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. cmake --build . --config Release if ( $LASTEXITCODE -ne 0 ) { throw "[*] cmake build failure" diff --git a/CMakeLists.txt b/CMakeLists.txt index d09020dbd..fb629dc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,13 +184,14 @@ endif() # make sure all check_symbol_exists are before this point, otherwise they fail # on some versions of compilers +option(COMPILE_WARNING_AS_ERROR "Make all warnings into errors" OFF) if (MSVC) # why can't different CIs use the same flags? # Travis CI : CI=True & TRAVIS=True # Appveyor : CI=True & APPVEYOR=True # Azure Pipelines: TF_BUILD=True - if(DEFINED ENV{TF_BUILD} OR (DEFINED ENV{CI} AND DEFINED ENV{APPVEYOR})) - message(STATUS "Running in an Azure or AppVeyor environment, setting -Werror") + if(COMPILE_WARNING_AS_ERROR) + message(STATUS "Setting -Werror") add_compile_options(/WX) endif() elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") @@ -200,8 +201,8 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") endif() - if(DEFINED ENV{TF_BUILD} OR (DEFINED ENV{CI} AND (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR}))) - message(STATUS "Running in CI environment (Azure, Travis or AppVeyor), setting -Werror") + if(COMPILE_WARNING_AS_ERROR) + message(STATUS "Setting -Werror") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif() else() diff --git a/README_BUILD.md b/README_BUILD.md index 141236606..342472a17 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -39,6 +39,7 @@ The recommendation is to leave things to the default. Cmake Options | Default | Target | Description | ---------------------- | ------- | -------| ---------------------------------------------- | `BUILD_SHARED_LIBS` | ON | All | Build shared libraries | +'COMPILE_WARNING_AS_ERROR' | OFF | All | Make all C warnings into errors | `PYTHON_BINDINGS` | OFF | All | Install PYTHON bindings | `WITH_TESTS` | ON | All | Build the test programs (iio-utils) | `WITH_EXAMPLES` | OFF | All | Build the example programs | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bb3c5d8b2..d584a7c13 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,7 +50,7 @@ stages: - script: | set -e mkdir build && cd build - cmake .. -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package displayName: 'Build' @@ -208,7 +208,7 @@ stages: - script: | set -e mkdir build && cd build - cmake .. -DOSX_PACKAGE=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF make sudo make install cd .. @@ -216,7 +216,7 @@ stages: - script: | set -e mkdir build_tar && cd build_tar - cmake .. -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package cd .. @@ -224,7 +224,7 @@ stages: - script: | set -e cd build - cmake .. -DPYTHON_BINDINGS=ON -DWITH_DOC=ON + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON make cd .. displayName: 'Build With Doc' From bde61deac34ffbb6e6e50a7b6c02c69b0d5edb0a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 20:04:33 -0400 Subject: [PATCH 21/86] cmake: set the min version to 2.8.12 Now that we are erroring out, and noticing issues, set things to 2.8.12, the min required not to get warnings/errors on modern systems. Cmake 2.8.12 was released Tue Oct 8 13:27:39 EDT 2013; so still should be plenty old for most distributions. Even RedHat 6 supports cmake 2.8.12 ... https://access.redhat.com/errata/RHBA-2014:1506.html Signed-off-by: Robin Getz --- CMakeLists.txt | 2 +- bindings/csharp/CMakeLists.txt | 2 +- bindings/python/CMakeLists.txt | 2 +- examples/CMakeLists.txt | 2 +- iiod/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb629dc26..98779320a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ message(STATUS "cmake version: ${CMAKE_VERSION}") -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(libiio C) if (MINGW) diff --git a/bindings/csharp/CMakeLists.txt b/bindings/csharp/CMakeLists.txt index a5a954809..22127bc68 100644 --- a/bindings/csharp/CMakeLists.txt +++ b/bindings/csharp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(libiio-sharp NONE) if (WIN32) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index ec212a588..cd2b27cfa 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(libiio-py NONE) if(${CMAKE_VERSION} VERSION_LESS "3.12.0") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index bce222e2e..2ed4d9f50 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(ad9361-iiostream C) project(ad9371-iiostream C) diff --git a/iiod/CMakeLists.txt b/iiod/CMakeLists.txt index fa9c34159..b269f0c3e 100644 --- a/iiod/CMakeLists.txt +++ b/iiod/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(iiod C) include(FindBISON) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7fba8d510..7c67a695f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) project(iio_genxml C) project(iio_info C) From 0a5eaa2b745a280b889a7014afa4418ddcaac6d1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 14:40:03 -0400 Subject: [PATCH 22/86] add uninstall target Per the request #694, this adds an "uninstall" target, which is (a) good form, and (b) requested by Jeff Long, and will make PyBOMBs work more natively. Signed-off-by: Robin Getz --- CMakeLists.txt | 12 +++++ cmake/cmake_uninstall.cmake.in | 83 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 cmake/cmake_uninstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 98779320a..1702ae685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -657,6 +657,18 @@ if (WITH_USB_BACKEND AND CMAKE_SYSTEM_NAME MATCHES "^Linux") endif() endif() +# Add uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY + ) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() + string(REPLACE ";" "," LIBIIO_SCAN_BACKENDS "${LIBIIO_SCAN_BACKENDS}") configure_file(iio-config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/iio-config.h @ONLY) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..ca6864dac --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,83 @@ +# based on https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake +# per : https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#what-is-its-license +# The snippets on this wiki are provided under the same license. (BSD 3-clause) +# +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2023 Kitware, Inc. and Contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Kitware, Inc. nor the names of Contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +#D ATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Add uninstall target + +cmake_policy(SET CMP0007 NEW) + +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + else() + # delete empty directories (if they are empty) + get_filename_component(dir ${file} DIRECTORY) + string(REPLACE "/" ";" dir_list ${dir}) + list(LENGTH dir_list dir_len) + foreach(X RANGE ${dir_len}) + file(GLOB result LIST_DIRECTORIES true "${dir}/*") + list(LENGTH result result_len) + if (NOT result_len EQUAL 0) + # if directory not empty, stop + break() + endif() + message(STATUS "Removing empty directory: ${dir}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove_directory ${dir}" + OUTPUT_VARIABLE stdout + RETURN_VALUE result + ) + if(NOT "${result}" STREQUAL 0) + message(FATAL_ERROR "Failed to remove directory: '${file}'.") + endif() + get_filename_component(dir ${dir} DIRECTORY) + endforeach() + endif() + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() From cf1c0728d0ecf874b88b2a3edcdb10e11b8c00c0 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 6 May 2023 10:32:55 -0400 Subject: [PATCH 23/86] utils: add 'version' option to each util Today, when debugging things - its sometimes tricky to tell which version of things are installed, since downstream distirbutions split iio-utils and libiio. This commit adds an new option "-V" or "--version" to things to print out the utility version, and the library version (which hopefully matches) seperately. Document option in man pages at same time. Signed-off-by: Robin Getz --- examples/iio_adi_xflow_check.c | 1 + man/iio_common_cmds.1 | 7 +++++++ tests/iio_attr.c | 1 + tests/iio_common.c | 19 +++++++++++++++++++ tests/iio_common.h | 3 ++- tests/iio_genxml.c | 1 + tests/iio_info.c | 10 ++-------- tests/iio_readdev.c | 1 + tests/iio_reg.c | 1 + 9 files changed, 35 insertions(+), 9 deletions(-) diff --git a/examples/iio_adi_xflow_check.c b/examples/iio_adi_xflow_check.c index e540b730b..628261b5e 100644 --- a/examples/iio_adi_xflow_check.c +++ b/examples/iio_adi_xflow_check.c @@ -170,6 +170,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': diff --git a/man/iio_common_cmds.1 b/man/iio_common_cmds.1 index ca83f83a2..aee2e2462 100644 --- a/man/iio_common_cmds.1 +++ b/man/iio_common_cmds.1 @@ -4,6 +4,13 @@ Tells .I ##APP_NAME## to display some help, and then quit. .TP +.B \-V, \-\-version +Prints the version information for this particular copy of +.I ##APP_NAME## +and the version of the libiio library it is using. This is useful for knowing if the version of the library and +.I ##APP_NAME## +on your system are up to date. This is also useful when reporting bugs. +.TP .B \-S, \-\-scan [backends] Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip:usb'. Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456,b673'. diff --git a/tests/iio_attr.c b/tests/iio_attr.c index d2fd258a8..cd7a40742 100644 --- a/tests/iio_attr.c +++ b/tests/iio_attr.c @@ -375,6 +375,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': diff --git a/tests/iio_common.c b/tests/iio_common.c index deb706c2d..879f6ec3b 100644 --- a/tests/iio_common.c +++ b/tests/iio_common.c @@ -192,6 +192,7 @@ void free_argw(int argc, char * argw[]) static const struct option common_options[] = { {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, {"xml", required_argument, 0, 'x'}, {"uri", required_argument, 0, 'u'}, {"scan", optional_argument, 0, 'S'}, @@ -239,6 +240,7 @@ struct option * add_common_options(const struct option * longopts) static const char *common_options_descriptions[] = { "Show this help and quit.", + "Display libiio version information.", "Use the XML backend with the provided XML file.", ("Use the context at the provided URI." "\n\t\t\teg: 'ip:192.168.2.1', 'ip:pluto.local', or 'ip:'" @@ -287,6 +289,10 @@ struct iio_context * handle_common_opts(char * name, int argc, case 'h': usage(name, options, options_descriptions); break; + case 'V': + version(name); + exit(0); + break; case 'n': if (backend != IIO_LOCAL) { fprintf(stderr, "-a, -x, -n and -u are mutually exclusive\n"); @@ -434,6 +440,19 @@ void usage(char *name, const struct option *options, exit(0); } +void version(char *name) +{ + unsigned int i, major, minor; + char git_tag[8]; + + printf("%s version: %u.%u (git tag:%s)\n", name, LIBIIO_VERSION_MAJOR, LIBIIO_VERSION_MINOR, LIBIIO_VERSION_GIT); + iio_library_get_version(&major, &minor, git_tag); + printf("Libiio version: %u.%u (git tag: %s) backends:", major, minor, git_tag); + for (i = 0; i < iio_get_backends_count(); i++) + printf(" %s", iio_get_backend(i)); + printf("\n"); +} + uint64_t get_time_us(void) { struct timespec tp; diff --git a/tests/iio_common.h b/tests/iio_common.h index cb8edde70..25e15d8d7 100644 --- a/tests/iio_common.h +++ b/tests/iio_common.h @@ -40,13 +40,14 @@ int iio_device_enable_channel(const struct iio_device *dev, const char * channel * If such a character is followed by a colon, the option requires an argument. * Two colons mean an option takes an optional argument. */ -#define COMMON_OPTIONS "hn:x:u:a::S::T:" +#define COMMON_OPTIONS "hVn:x:u:a::S::T:" struct iio_context * handle_common_opts(char * name, int argc, char * const argv[], const char *optstring, const struct option *options, const char *options_descriptions[]); struct option * add_common_options(const struct option * longopts); void usage(char *name, const struct option *options, const char *options_descriptions[]); +void version(char *name); char ** dup_argv(char * name, int argc, char * argv[]); void free_argw(int argc, char * argw[]); diff --git a/tests/iio_genxml.c b/tests/iio_genxml.c index e2a5c0e8e..7368c8ce7 100644 --- a/tests/iio_genxml.c +++ b/tests/iio_genxml.c @@ -47,6 +47,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': diff --git a/tests/iio_info.c b/tests/iio_info.c index ea1096924..0e9c80471 100644 --- a/tests/iio_info.c +++ b/tests/iio_info.c @@ -58,14 +58,6 @@ int main(int argc, char **argv) argw = dup_argv(MY_NAME, argc, argv); - iio_library_get_version(&major, &minor, git_tag); - printf("Library version: %u.%u (git tag: %s)\n", major, minor, git_tag); - - printf("Compiled with backends:"); - for (i = 0; i < iio_get_backends_count(); i++) - printf(" %s", iio_get_backend(i)); - printf("\n"); - ctx = handle_common_opts(MY_NAME, argc, argw, MY_OPTS, options, options_descriptions); opts = add_common_options(options); if (!opts) { @@ -77,6 +69,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': @@ -107,6 +100,7 @@ int main(int argc, char **argv) if (!ctx) return EXIT_FAILURE; + version(MY_NAME); printf("IIO context created with %s backend.\n", iio_context_get_name(ctx)); diff --git a/tests/iio_readdev.c b/tests/iio_readdev.c index aa33294ce..fc87974e1 100644 --- a/tests/iio_readdev.c +++ b/tests/iio_readdev.c @@ -210,6 +210,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': diff --git a/tests/iio_reg.c b/tests/iio_reg.c index fb1c6a1b1..55c2cfc97 100644 --- a/tests/iio_reg.c +++ b/tests/iio_reg.c @@ -84,6 +84,7 @@ int main(int argc, char **argv) switch (c) { /* All these are handled in the common */ case 'h': + case 'V': case 'n': case 'x': case 'u': From 690ab5a7ce3841197905f8dd42f78083ca9cb7ff Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Sat, 6 May 2023 12:06:46 +0200 Subject: [PATCH 24/86] Add C++ API This adds a C++17 API to the library. Implemented as a single header without dependencies. It simplifies usage of the library when a modern C++ compiler is available. Signed-off-by: Tilman Blumhagen --- CI/azure/ci-ubuntu.sh | 2 +- CMakeLists.txt | 14 +- Doxyfile.in | 11 +- README_BUILD.md | 4 +- azure-pipelines.yml | 6 +- bindings/CMakeLists.txt | 4 + bindings/cpp/CMakeLists.txt | 7 + bindings/cpp/examples/iiopp-enum.cpp | 103 ++++ bindings/cpp/iiopp.h | 805 +++++++++++++++++++++++++++ examples/README.md | 5 + mainpage.dox | 7 + 11 files changed, 956 insertions(+), 12 deletions(-) create mode 100644 bindings/cpp/CMakeLists.txt create mode 100644 bindings/cpp/examples/iiopp-enum.cpp create mode 100644 bindings/cpp/iiopp.h diff --git a/CI/azure/ci-ubuntu.sh b/CI/azure/ci-ubuntu.sh index 0f2b8abc1..42f6bb0b6 100644 --- a/CI/azure/ci-ubuntu.sh +++ b/CI/azure/ci-ubuntu.sh @@ -3,6 +3,6 @@ set -x uname -a echo "$PWD" mkdir build && cd build -cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" +cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" make make package diff --git a/CMakeLists.txt b/CMakeLists.txt index 1702ae685..f2fd71386 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,6 +225,17 @@ endif() set(LIBIIO_CFILES backend.c channel.c device.c context.c buffer.c utilities.c scan.c sort.c) set(LIBIIO_HEADERS iio.h) +set(DOXYGEN_INPUT "${CMAKE_SOURCE_DIR}") +set(DOXYGEN_STRIP_FROM_PATH "${CMAKE_SOURCE_DIR}") + +if (CPP_BINDINGS) + list(APPEND LIBIIO_HEADERS bindings/cpp/iiopp.h) + set(DOXYGEN_ENABLED_SECTIONS CPP_BINDINGS) + set(DOXYGEN_INPUT "${DOXYGEN_INPUT} ${CMAKE_SOURCE_DIR}/bindings/cpp/") + set(DOXYGEN_STRIP_FROM_PATH "${CMAKE_SOURCE_DIR}/bindings/cpp/") + set(DOXYGEN_CPP_EXAMPLE_PATH "${CMAKE_SOURCE_DIR}/bindings/cpp/examples") +endif() + if(WITH_USB_BACKEND) list(APPEND LIBIIO_CFILES usb.c) list(APPEND LIBS_TO_LINK ${LIBUSB_LIBRARIES}) @@ -485,7 +496,7 @@ set_target_properties(iio PROPERTIES VERSION ${VERSION} SOVERSION ${LIBIIO_VERSION_MAJOR} FRAMEWORK ${OSX_FRAMEWORK} - PUBLIC_HEADER ${LIBIIO_HEADERS} + PUBLIC_HEADER "${LIBIIO_HEADERS}" C_STANDARD 99 C_STANDARD_REQUIRED ON C_EXTENSIONS OFF @@ -560,6 +571,7 @@ if(WITH_DOC) endif() endif() +option(CPP_BINDINGS "Install C++ bindings" OFF) option(CSHARP_BINDINGS "Install C# bindings" OFF) option(PYTHON_BINDINGS "Install Python bindings" OFF) add_subdirectory(bindings) diff --git a/Doxyfile.in b/Doxyfile.in index d81abfeca..7b0380382 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -160,7 +160,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = +STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -708,7 +708,7 @@ GENERATE_DEPRECATEDLIST= YES # sections, marked by \if ... \endif and \cond # ... \endcond blocks. -ENABLED_SECTIONS = +ENABLED_SECTIONS = @DOXYGEN_ENABLED_SECTIONS@ # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the @@ -854,7 +854,7 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/Dox_output_@PROJECT_NAME@ # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_SOURCE_DIR@ +INPUT = @DOXYGEN_INPUT@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -939,7 +939,8 @@ EXCLUDE_SYMBOLS = # command). EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/tests \ - @CMAKE_SOURCE_DIR@/examples + @CMAKE_SOURCE_DIR@/examples \ + @DOXYGEN_CPP_EXAMPLE_PATH@ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -2208,7 +2209,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/README_BUILD.md b/README_BUILD.md index 342472a17..596506bb8 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -40,6 +40,7 @@ Cmake Options | Default | Target | Description ---------------------- | ------- | -------| ---------------------------------------------- | `BUILD_SHARED_LIBS` | ON | All | Build shared libraries | 'COMPILE_WARNING_AS_ERROR' | OFF | All | Make all C warnings into errors | +`CPP_BINDINGS` | OFF | All | Install C++ bindings (C++17 required for examples) | `PYTHON_BINDINGS` | OFF | All | Install PYTHON bindings | `WITH_TESTS` | ON | All | Build the test programs (iio-utils) | `WITH_EXAMPLES` | OFF | All | Build the example programs | @@ -57,7 +58,6 @@ Cmake Options | Default | Target | Description `OSX_FRAMEWORK` | ON | Mac | OS X frameworks provide the interfaces you need to write software for Mac. | `OSX_PACKAGE` | ON | Mac | Create a OSX package for installation on local and other machines | - Which backends the library supports is dependent on the build system, but can be overridden. (If cmake finds libusb, it will use it, unless turned off manually) @@ -102,7 +102,7 @@ Cmake Options | Default | Description | ```shell analog@precision:~/libiio$ mkdir build analog@precision:~/libiio/build$ cd build -analog@precision:~/libiio/build$ cmake ../ -DPYTHON_BINDINGS=ON +analog@precision:~/libiio/build$ cmake ../ -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON analog@precision:~/libiio/build$ make -j$(nproc) ``` diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d584a7c13..6fcc38210 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -208,7 +208,7 @@ stages: - script: | set -e mkdir build && cd build - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF make sudo make install cd .. @@ -216,7 +216,7 @@ stages: - script: | set -e mkdir build_tar && cd build_tar - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package cd .. @@ -224,7 +224,7 @@ stages: - script: | set -e cd build - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON make cd .. displayName: 'Build With Doc' diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index c3e8fb6b1..c8041e05e 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -1,3 +1,7 @@ +if (CPP_BINDINGS) + add_subdirectory(cpp) +endif() + if (CSHARP_BINDINGS) add_subdirectory(csharp) endif() diff --git a/bindings/cpp/CMakeLists.txt b/bindings/cpp/CMakeLists.txt new file mode 100644 index 000000000..728cb3263 --- /dev/null +++ b/bindings/cpp/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(iiopp-enum CXX) +add_executable(iiopp-enum examples/iiopp-enum.cpp iiopp.h ${LIBIIO_RC}) +target_include_directories(iiopp-enum PRIVATE ./) +set_target_properties(iiopp-enum PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) +target_link_libraries(iiopp-enum iio) diff --git a/bindings/cpp/examples/iiopp-enum.cpp b/bindings/cpp/examples/iiopp-enum.cpp new file mode 100644 index 000000000..5f4388305 --- /dev/null +++ b/bindings/cpp/examples/iiopp-enum.cpp @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * libiio - C++ API usage + * + * This example libiio program shows the usage of the C++ API for enumerating + * devices, channels and attributes. + * + * Copyright (c) 2023, DIFITEC GmbH + * Author: Tilman Blumhagen + */ + +#include + +#include +#include + +using namespace iiopp; +using namespace std; + +string get(IAttr const & att) +{ + char value[1024] = {0}; // Flawfinder: ignore + att.read(value, sizeof(value)); // Flawfinder: ignore + return value; +} + +void enumerateIioEntities() +{ + cout << boolalpha; + + shared_ptr context = create_default_context(); + + for (Device device : *context) + { + cout << "Device:" << endl; + cout << " id: " << quoted(string(device.id())) << endl; + + cout << " name: "; + if (auto name = device.name()) + cout << quoted(string(*name)); + cout << endl; + + cout << " is trigger: " << device.is_trigger() << endl; + + for (auto att : device.attrs) + cout << " attribute " << att.name() << " = " << quoted(get(att)) << endl; + + for (auto att : device.debug_attrs) + cout << " debug attribute " << att.name() << " = " << quoted(get(att)) << endl; + + for (auto att : device.buffer_attrs) + cout << " buffer attribute " << att.name() << " = " << quoted(get(att)) << endl; + + for (Channel channel : device) + { + cout << " Channel: " << channel.id() << endl; + + cout << " name: "; + if (auto name = channel.name()) + cout << quoted(string(*name)); + cout << endl; + + cout << " is output: " << channel.is_output() << endl; + cout << " is enabled: " << channel.is_enabled() << endl; + + for (auto att : channel.attrs) + cout << " attribute " << quoted(att.name().c_str()) << " = " << quoted(get(att)) << endl; + } + } + + shared_ptr scanCtx = create_scan_context({}, 0); + shared_ptr infoList = scanCtx->info_list(); + + cout << "scan context info list:" << endl; + for (ContextInfo info : *infoList) + { + cout << " uri: " << quoted(info.uri().c_str()) << endl; + cout << " description: " << quoted(info.desciption().c_str()) << endl; + } + + cout << "scan block:" << endl; + shared_ptr blk = create_scan_block({}, 0); + for (ContextInfo info : *blk) + { + cout << " uri: " << quoted(info.uri().c_str()) << endl; + cout << " description: " << quoted(info.desciption().c_str()) << endl; + } +} + +int main(int argc, char ** argv) +{ + try + { + enumerateIioEntities(); + } + catch (std::exception & e) + { + cerr << "ERROR: " << e.what() << endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h new file mode 100644 index 000000000..d28cc9f72 --- /dev/null +++ b/bindings/cpp/iiopp.h @@ -0,0 +1,805 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * libiio - Library for interfacing industrial I/O (IIO) devices + * + * Copyright (C) 2023, DIFITEC GmbH + * Author: Tilman Blumhagen + */ + +/** @file iiopp.h + * @brief Public C++ interface + * + * @see @ref iiopp +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +/** @brief Public C++ API + * + * This is a C++17 wrapper for @ref iio.h + * + * It provides: + * + * - Classes that model the major types, providing member functions for easy usage. + * - Uniform access to attributes of channels and devices (with their attr/debug_attr/buffer_attr variants). + * - Error handling (error codes are checked and turned into exceptions). + * - Functions that may return \c NULL for "no string" are explicit by returning an std::optional. + * - Iterators for idiomatic access to devices of context and channels of devices. + * - Iterators for atributes. + * - Implicit conversion to the wrapped C-types, so C++ instances can easily be passed to the C-API. + * + * @warning All objects live in the @ref iiopp::Context that created them. When a context gets destroyed (when + * the last std::shared_pointer to it releases it) all its child objects die as well. All types have + * weak reference semantic and become invalid when the context gets destroyed. + * Lifetime is managed by std::shared_ptr. + * + * In consequence all types are cheap to copy (at the cost of assigning a pointer and maybe an integer). Copies refer + * to the same underlying object. + * + * See @ref iiopp-enum.cpp for an example. + */ +namespace iiopp +{ + +class Context; +class Device; +class Buffer; + +/** @brief Non-owning immutable null terminated string + * + * Used for argument/return type for functions that expect/return a C-string (null terminated char-array). + * Provides implicit conversion of std::string while still retaining efficient pass-through for char const*. + * Only valid as long as the original string is valid. + */ +class cstr +{ + char const * const s; +public: + cstr(std::string const & s) : s(s.c_str()){} + cstr(char const * s) : s(s){assert(s);} + + char const * c_str() const {return s;} + operator char const * () const {return s;} +}; + +/** @brief Common interface for attribute access + */ +class IAttr +{ +public: + virtual ~IAttr(){} + + virtual cstr name() const = 0; + + virtual size_t read(char * dst, size_t size) const = 0; // Flawfinder: ignore + virtual bool read_bool() const = 0; + virtual double read_double() const = 0; + virtual long long read_longlong() const = 0; + + virtual size_t write(cstr src) = 0; + virtual void write_bool(bool val) = 0; + virtual void write_double(double val) = 0; + virtual void write_longlong(long long val) = 0; + + operator bool () const {return read_bool();} + operator double () const {return read_double();} + operator long long () const {return read_longlong();} + + cstr operator = (cstr val){write(val); return val;} + bool operator = (bool val){write_bool(val); return val;} + double operator = (double val){write_double(val); return val;} + long long operator = (long long val){write_longlong(val); return val;} +}; + +/** @brief Optional string, used for C-functions that return @c nullptr for "no value". + */ +typedef std::optional optstr; + +namespace impl +{ + +std::shared_ptr new_ctx(iio_context * ctx); + +inline optstr opt(char const * s) +{ + return s ? optstr{{s}} : optstr{}; +} + +inline std::string err_str(int err) +{ + char buf[1024]; // Flawfinder: ignore + iio_strerror(err, buf, sizeof(buf)); + return buf; +} + +[[noreturn]] inline void err(int err, char const * ctx) +{ + assert(err > 0); + std::ostringstream s; + s << ctx << ": " << err_str(err); + s.flush(); + throw std::runtime_error(s.str()); +} + +inline void check(int ret, char const * ctx) +{ + if (ret) + { + assert(ret < 0); + err(-ret, ctx); + } +} + +template +T check_n(T n, char const * s) +{ + if (n < 0) + impl::err(static_cast(-n), s); + return n; +} + +/** @brief Serves as base class to implement a @c vector-like interface + * + * Implements begin(), end() and the index operator for a type @a container_T (which should be derived from it) with elements of type @a element_T. + */ +template +class IndexedSequence +{ + container_T & _me() {return *static_cast(this);} +public: + + /** @brief A random access iterator for an @ref IndexedSequence + */ + class Iterator + { + container_T & c; + size_t i; + public: + typedef std::random_access_iterator_tag iterator_category; + typedef element_T value_type; + typedef std::ptrdiff_t difference_type; + typedef element_T *pointer; + typedef element_T &reference; + Iterator(container_T &cont, size_t idx) : c(cont), i(idx) {assert(idx <= cont.size());} + + element_T operator*() const { return c[i]; } + Iterator& operator++() { assert(i <= c.size()); ++i; return *this;} + Iterator operator++(int) { Iterator tmp = *this; ++(*this); return tmp; } + bool operator == (const Iterator& rhs) const { assert(&c == &rhs.c); return i == rhs.i; } + bool operator != (const Iterator& rhs) const { assert(&c == &rhs.c); return i != rhs.i; } + bool operator < (const Iterator& rhs) const { assert(&c == &rhs.c); return i < rhs.i; } + bool operator > (const Iterator& rhs) const { assert(&c == &rhs.c); return i > rhs.i; } + bool operator <= (const Iterator& rhs) const { assert(&c == &rhs.c); return i <= rhs.i; } + bool operator >= (const Iterator& rhs) const { assert(&c == &rhs.c); return i >= rhs.i; } + Iterator operator + (ssize_t x) const { return Iterator(c, i + x); } + ssize_t operator - (Iterator rhs) const { assert(&c == &rhs.c); return i - rhs.i; } + }; + + Iterator begin() {return Iterator(_me(), 0);} + Iterator end() {return Iterator(_me(), _me().size());} +}; + +template +class AttrT : public IAttr +{ + obj_T const * const _obj; + cstr const _name; +public: + + AttrT(obj_T const * obj, cstr name) : _obj(obj), _name(name){assert(obj && name);} + + cstr name() const override {return _name;} + + size_t read(char * dst, size_t size) const override {return check_n(read_T(_obj, _name, dst, size), "iio_..._attr_read");} // Flawfinder: ignore + bool read_bool() const override {bool val; check(read_bool_T(_obj, _name, &val), "iio_..._attr_read_bool"); return val;} + double read_double() const override {double val; check(read_double_T(_obj, _name, &val), "iio_..._attr_read_double"); return val;} + long long read_longlong() const override {long long val; check(read_longlong_T(_obj, _name, &val), "iio_..._attr_read_longlong"); return val;} + + size_t write(cstr src) override {return check_n(write_T(_obj, _name, src), "iio_..._attr_write");} + void write_bool(bool val) override {check(write_bool_T(_obj, _name, val), "iio_..._attr_write_bool");} + void write_double(double val) override {check(write_double_T(_obj, _name, val), "iio_..._attr_write_double");} + void write_longlong(long long val) override {check(write_longlong_T(_obj, _name, val), "iio_..._attr_write_longlong");} +}; + +template +std::optional attr(obj_T const * obj, cstr name) +{ + char const * s = find_attr_T(obj, name); + if (s) + return {attr_T(obj, s)}; + return {}; +} + +template +std::optional attr(obj_T const * obj, unsigned int idx) +{ + char const * s = get_attr_T(obj, idx); + if (s) + return {attr_T(obj, s)}; + return {}; +} + +/** @brief Vector-like accessor for all attributes of an object + */ +#ifdef DOXYGEN +template +class AttrSeqT : public IndexedSequence, attr_T> +#else +template +class AttrSeqT : public IndexedSequence, attr_T> +#endif +{ + obj_T const * const _obj; +public: + AttrSeqT(obj_T const * obj) : _obj(obj){assert(obj);} + + /** @brief Count of attributes + */ + size_t size() const {return get_attrs_count_T(_obj);} + + /** @brief Access by attribute index + */ + attr_T operator [](size_t idx) + { + if (auto ret = attr(_obj, idx)) + return *ret; + throw std::out_of_range("invalid attribute index"); + } + + /** @brief Access by attribute name + */ + attr_T operator [](cstr name) + { + if (auto ret = attr(_obj, name)) + return *ret; + throw std::out_of_range("invalid attribute name"); + } +}; + +} // namespace impl + +/** @brief C++ wrapper for the @ref Channel C-API + */ +class Channel +{ + iio_channel * const p; +public: + + Channel() = delete; + Channel(iio_channel * chan) : p(chan), attrs(chan){} + operator iio_channel * () const {return p;} + +#ifndef DOXYGEN + typedef impl::AttrT Attr; + + typedef impl::AttrSeqT AttrSeq; +#else + typedef IAttr Attr; + typedef impl::AttrSeqT AttrSeq; +#endif + + std::optional attr(cstr name) {return impl::attr(p, name);} + std::optional attr(unsigned int idx) {return impl::attr(p, idx);} + + AttrSeq attrs; + + void disable() {iio_channel_disable(p);} + void enable() {iio_channel_enable(p);} + optstr find_attr(cstr name) {return impl::opt(iio_channel_find_attr(p, name));} + unsigned int attrs_count() const {return iio_channel_get_attrs_count(p);} + void * data() const {return iio_channel_get_data(p);} + Device device(); + cstr id() const {return iio_channel_get_id(p);} + iio_modifier modifier() const {return iio_channel_get_modifier(p);} + optstr name() const { return impl::opt(iio_channel_get_name(p));} + iio_chan_type type() const {return iio_channel_get_type(p);} + bool is_enabled() const { return iio_channel_is_enabled(p);} + bool is_output() const { return iio_channel_is_output(p);} + bool is_scan_element() const { return iio_channel_is_scan_element(p);} + size_t read(Buffer buffer, void * dst, size_t len) const; // Flawfinder: ignore + size_t read_raw(Buffer buffer, void * dst, size_t len) const; + void set_data(void * data){iio_channel_set_data(p, data);} + size_t write(Buffer buffer, void const * src, size_t len); + size_t write_raw(Buffer buffer, void const * src, size_t len); + + void convert(void * dst, void const * src) const {iio_channel_convert(p, dst, src);} + void convert_inverse(void * dst, void const * src) const {iio_channel_convert_inverse(p, dst, src);} + iio_data_format const * data_format() const {return iio_channel_get_data_format(p);} + unsigned long index() const { return impl::check_n(iio_channel_get_index(p), "iio_channel_get_index");} +}; + +/** @brief C++ wrapper for the @ref Buffer C-API + */ +class Buffer +{ + iio_buffer * const p; +public: + Buffer(iio_buffer * buffer) : p(buffer){} + operator iio_buffer * () const {return p;} + void cancel() {iio_buffer_cancel(p);} + void * end() {return iio_buffer_end(p);} + void * first(Channel channel){ return iio_buffer_first(p, channel);} + ssize_t for_each(ssize_t (*callback)(const struct iio_channel *chn, void *src, size_t bytes, void *d), void *data){return iio_buffer_foreach_sample(p, callback, data);} + void * data() {return iio_buffer_get_data(p);} + Device device(); + int poll_fd() const { + int const ret = iio_buffer_get_poll_fd(p); + if (ret < 0) + impl::err(-ret, "iio_buffer_get_poll_fd"); + return ret; + } + size_t push() const { return impl::check_n(iio_buffer_push(p), "iio_buffer_push");} + size_t push_partial(size_t samples_count) const {return impl::check_n(iio_buffer_push_partial(p, samples_count), "iio_buffer_push_partial");} + size_t refill() const { return impl::check_n(iio_buffer_refill(p), "iio_buffer_refill");} + void set_blocking_mode(bool blocking){impl::check(iio_buffer_set_blocking_mode(p, blocking), "iio_buffer_set_blocking_mode");} + void set_data(void * data){iio_buffer_set_data(p, data);} + void * start() {return iio_buffer_start(p);} + ptrdiff_t step() const {return iio_buffer_step(p);} +}; + +/** @brief C++ wrapper for the @ref Device C-API + */ +class Device : public impl::IndexedSequence +{ + iio_device * const p; +public: + + size_t size() const + { + return channels_count(); + } + + Channel operator [](size_t i) + { + assert(i < channels_count()); + return channel(i); + } + +#ifndef DOXYGEN + typedef impl::AttrT Attr; + + typedef impl::AttrSeqT AttrSeq; +#else + typedef IAttr Attr; + typedef impl::AttrSeqT AttrSeq; +#endif + std::optional attr(cstr name) {return impl::attr(p, name);} + std::optional attr(unsigned int idx) {return impl::attr(p, idx);} + + AttrSeq attrs; + +#ifndef DOXYGEN + typedef impl::AttrT DebugAttr; + + typedef impl::AttrSeqT DebugAttrSeq; +#else + typedef IAttr DebugAttr; + typedef impl::AttrSeqT DebugAttrSeq; +#endif + + std::optional debug_attr(cstr name) {return impl::attr(p, name);} + std::optional debug_attr(unsigned int idx) {return impl::attr(p, idx);} + + DebugAttrSeq debug_attrs; + +#ifndef DOXYGEN + typedef impl::AttrT BufferAttr; + + typedef impl::AttrSeqT BufferAttrSeq; +#else + typedef IAttr BufferAttr; + typedef impl::AttrSeqT BufferAttrSeq; +#endif + + std::optional buffer_attr(cstr name) {return impl::attr(p, name);} + std::optional buffer_attr(unsigned int idx) {return impl::attr(p, idx);} + + BufferAttrSeq buffer_attrs; + + Device() = delete; + Device(iio_device * dev) : p(dev), attrs(dev), debug_attrs(dev), buffer_attrs(dev){} + operator iio_device * () const {return p;} + + optstr find_attr(cstr name) const {return impl::opt(iio_device_find_attr(p, name));} + optstr find_buffer_attr(cstr name) const {return impl::opt(iio_device_find_buffer_attr(p, name));} + Channel find_channel(cstr name, bool output) const {return Channel{iio_device_find_channel(p, name, output)};} + unsigned int attrs_count() const {return iio_device_get_attrs_count(p);} + unsigned int buffer_attrs_count() const {return iio_device_get_buffer_attrs_count(p);} + Channel channel(unsigned int idx) const {return Channel{iio_device_get_channel(p, idx)};} + unsigned int channels_count() const {return iio_device_get_channels_count(p);} + Context context(); + void * data() const {return iio_device_get_data(p);} + cstr id() const { return iio_device_get_id(p);} + optstr label() const { return impl::opt(iio_device_get_label(p));} + optstr name() const { return impl::opt(iio_device_get_name(p));} + Device trigger() const {iio_device const * ret; impl::check(iio_device_get_trigger(p, &ret), "iio_device_get_trigger"); return const_cast(ret);} + bool is_trigger() const {return iio_device_is_trigger(p);} + void set_data(void * data){iio_device_set_data(p, data);} + void set_kernel_buffers_count(unsigned int nb_buffers) {impl::check(iio_device_set_kernel_buffers_count(p, nb_buffers), "iio_device_set_kernel_buffers_count");} + void set_trigger(iio_device const * trigger) {impl::check(iio_device_set_trigger(p, trigger), "iio_device_set_trigger");} + std::shared_ptr create_buffer(size_t samples_count, bool cyclic) + { + iio_buffer * buffer = iio_device_create_buffer(p, samples_count, cyclic); + if (!buffer) + impl::err(errno, "iio_device_create_buffer"); + + auto deleter = [](Buffer * buf) { + if (buf) + { + iio_buffer_destroy(*buf); + delete buf; + } + }; + + return std::shared_ptr{new Buffer(buffer), deleter}; + } +}; + +/** @brief C++ wrapper for the @ref Context C-API + */ +class Context : public impl::IndexedSequence +{ + iio_context * const p; +public: + size_t size() const + { + return devices_count(); + } + + Device operator [](size_t i) + { + assert(i < devices_count()); + return device(i); + } + + Context() = delete; + Context(iio_context * ctx) : p(ctx){assert(ctx);} + operator iio_context * () const {return p;} + + std::shared_ptr clone() const { + iio_context * ctx = iio_context_clone(p); + if (!ctx) + impl::err(errno, "iio_context_clone"); + + return impl::new_ctx(ctx); + } + + Device find_device(cstr name) const {return iio_context_find_device(p, name);} + std::pair attr(unsigned int idx) const + { + char const * name, * value; + impl::check(iio_context_get_attr(p, idx, &name, &value), "iio_context_get_attr"); + return {name, value}; + } + optstr attr_value(cstr name) const {return impl::opt(iio_context_get_attr_value(p, name));} + unsigned int attrs_count() const {return iio_context_get_attrs_count(p);} + cstr description() const {return iio_context_get_description(p);} + Device device(unsigned int idx) const + { + return Device{iio_context_get_device(p, idx)}; + } + unsigned int devices_count() const {return iio_context_get_devices_count(p);} + cstr name() const {return iio_context_get_name(p);} + + struct Version + { + unsigned int major, minor; + std::string git_tag; + }; + + Version version() const { + Version ver; + char git_tag[8]; // Flawfinder: ignore + impl::check(iio_context_get_version(p, &ver.major, &ver.minor, git_tag), "iio_context_get_version"); + ver.git_tag = git_tag; + return ver; + } + + cstr xml() const {return iio_context_get_xml(p);} + void set_timeout(unsigned int timeout_ms){impl::check(iio_context_set_timeout(p, timeout_ms), "iio_context_set_timeout");} +}; + +inline Context Device::context(){return const_cast(iio_device_get_context(p));} +inline Device Channel::device() {return const_cast(iio_channel_get_device(p));} +inline Device Buffer::device() {return const_cast(iio_buffer_get_device(p));} +inline size_t Channel::read(Buffer buffer, void * dst, size_t len) const {return iio_channel_read(p, buffer, dst, len);} // Flawfinder: ignore +inline size_t Channel::read_raw(Buffer buffer, void * dst, size_t len) const {return iio_channel_read_raw(p, buffer, dst, len);} +inline size_t Channel::write(Buffer buffer, void const * src, size_t len) {return iio_channel_write(p, buffer, src, len);} +inline size_t Channel::write_raw(Buffer buffer, void const * src, size_t len) {return iio_channel_write_raw(p, buffer, src, len);} + +namespace impl +{ +inline std::shared_ptr new_ctx(iio_context * ctx) +{ + assert(ctx); + + auto deleter = [](Context * ctx) { + if (ctx) + { + iio_context_destroy(*ctx); + delete ctx; + } + }; + + return std::shared_ptr{new Context(ctx), deleter}; +} +} // namespace impl + + +/** @brief C++ wrapper for @ref iio_create_context_from_uri + */ +inline std::shared_ptr create_from_uri(cstr uri) +{ + iio_context * ctx = iio_create_context_from_uri(uri); + if (!ctx) + impl::err(errno, "iio_create_context_from_uri"); + + return impl::new_ctx(ctx); +} + +/** @brief C++ wrapper for @ref iio_create_default_context + */ +inline std::shared_ptr create_default_context() +{ + iio_context * ctx = iio_create_default_context(); + if (!ctx) + impl::err(errno, "iio_create_default_context"); + + return impl::new_ctx(ctx); +} + +/** @brief C++ wrapper for @ref iio_create_local_context + */ +inline std::shared_ptr create_local_context() +{ + iio_context * ctx = iio_create_local_context(); + if (!ctx) + impl::err(errno, "iio_create_local_context"); + + return impl::new_ctx(ctx); +} + +/** @brief C++ wrapper for @ref iio_create_network_context + */ +inline std::shared_ptr create_network_context(cstr host) +{ + iio_context * ctx = iio_create_network_context(host); + if (!ctx) + impl::err(errno, "iio_create_network_context"); + + return impl::new_ctx(ctx); +} + +/** @brief C++ wrapper for @ref iio_create_xml_context + */ +inline std::shared_ptr create_xml_context(cstr xml_file) +{ + iio_context * ctx = iio_create_xml_context(xml_file); + if (!ctx) + impl::err(errno, "iio_create_xml_context"); + + return impl::new_ctx(ctx); +} + +/** @brief C++ wrapper for @ref iio_create_xml_context_mem + */ +inline std::shared_ptr create_xml_context_mem(char const * xml, size_t len) +{ + iio_context * ctx = iio_create_xml_context_mem(xml, len); + if (!ctx) + impl::err(errno, "iio_create_xml_context_mem"); + + return impl::new_ctx(ctx); +} + +class ContextInfo +{ + iio_context_info const * const p; +public: + ContextInfo() = delete; + ContextInfo(iio_context_info const * i) : p(i){assert(i);} + operator iio_context_info const * () const {return p;} + + cstr desciption() const {return iio_context_info_get_description(p);} + cstr uri() const {return iio_context_info_get_uri(p);} +}; + +class ScanContext +{ + iio_scan_context * const p; +public: + ScanContext() = delete; + ScanContext(iio_scan_context * ctx) : p(ctx){assert(ctx);} + operator iio_scan_context * () const {return p;} + + class InfoList : public impl::IndexedSequence + { + iio_context_info ** const p; + size_t const n; + public: + InfoList() = delete; + InfoList(iio_context_info ** p, size_t n) : p(p), n(n){assert(p);} + operator iio_context_info ** () const {return p;} + + size_t size() const {return n;} + + ContextInfo operator [] (size_t i) const + { + if (i >= n) + throw std::out_of_range("invalid info index"); + + return ContextInfo(p[i]); + } + }; + + std::shared_ptr info_list() const + { + iio_context_info ** lst; + ssize_t const n = iio_scan_context_get_info_list(p, &lst); + if (n < 0) + impl::err(static_cast(-n), "iio_scan_context_get_info_list"); + + + auto deleter = [](InfoList * lst) { + if (lst) + { + iio_context_info_list_free(*lst); + delete lst; + } + }; + + return std::shared_ptr{new InfoList(lst, n), deleter}; + } +}; + +std::shared_ptr create_scan_context(optstr backend, int flags) +{ + iio_scan_context * ctx = iio_create_scan_context(backend ? static_cast(*backend) : nullptr, flags); + if (!ctx) + impl::err(errno, "iio_create_scan_context"); + + auto deleter = [](ScanContext * ctx) { + if (ctx) + { + iio_scan_context_destroy(*ctx); + delete ctx; + } + }; + + return std::shared_ptr{new ScanContext(ctx), deleter}; +} + +class ScanBlock : public impl::IndexedSequence +{ + iio_scan_block * const p; + size_t const n; +public: + ScanBlock() = delete; + ScanBlock(iio_scan_block * blk) : p(blk), n(impl::check_n(iio_scan_block_scan(blk), "iio_scan_block_scan")){assert(blk);} + operator iio_scan_block * () const {return p;} + + + size_t size() const {return n;} + + ContextInfo operator [] (unsigned int i) const + { + if (iio_context_info * info = iio_scan_block_get_info(p, i)) + return ContextInfo(info); + impl::err(errno, "iio_scan_block_get_info"); + } + +}; + +std::shared_ptr create_scan_block(optstr backend, int flags) +{ + iio_scan_block * blk = iio_create_scan_block(backend ? static_cast(*backend) : nullptr, flags); + if (!blk) + impl::err(errno, "iio_create_scan_block"); + + auto deleter = [](ScanBlock * blk) { + if (blk) + { + iio_scan_block_destroy(*blk); + delete blk; + } + }; + + return std::shared_ptr{new ScanBlock(blk), deleter}; +} + + +/** @brief Reads the value of a channel by using "input" or "raw" attribute and applying "scale" and "offset" if available + * + * @see @c get_channel_value in the example @ref iio-monitor.c + */ +inline double value(Channel ch) +{ + if (double val; !iio_channel_attr_read_double(ch, "input", &val)) + return val / 1000.; + + double scale = 1; + iio_channel_attr_read_double(ch, "scale", &scale); + + double offset = 0; + iio_channel_attr_read_double(ch, "offset", &offset); + + double raw; + impl::check(iio_channel_attr_read_double(ch, "raw", &raw), "reading raw value"); + + return (raw + offset) * scale / 1000.; +} + +} // namespace iiopp diff --git a/examples/README.md b/examples/README.md index 9ddb99fe6..abffb8613 100644 --- a/examples/README.md +++ b/examples/README.md @@ -41,3 +41,8 @@ No hardware should be required to run this program. * Requirements : Curses Development Kit (libcdk5-dev); pthreads; ncurses; libiio A Curses based application which implements real time monitoring of IIO non-buffer samples. + +## iopp-enum + * Language : C++ + +Demonstrates the usage of the C++ API. diff --git a/mainpage.dox b/mainpage.dox index 84b561aed..f245ed835 100644 --- a/mainpage.dox +++ b/mainpage.dox @@ -26,6 +26,10 @@ The basic bricks of the libiio API are the iio_context, iio_device, iio_channel - A iio_device object may contain zero or more iio_channel objects. A iio_channel object is associated with only one iio_device. - A iio_device object may be associated with one iio_buffer object, and a iio_buffer object is associated with only one iio_device. +@if CPP_BINDINGS +A C++ API is provided in @ref iiopp.h +@endif + @section scan_contexts Scanning for IIO contexts The first step when dealing with a collection of IIO devices (known as a context) is to find the context. This can be connected via usb, network, serial or local. Having these different connectivity options could prove to be problematic, but libiio abstracts the low level communications away, and allows you just to find contexts, and talk to devices without being interested in the low level aspects. Many find this convinent to develop applications and algorithms on a host, and quickly move to an embedded Linux system without having to change any code. @@ -274,4 +278,7 @@ This means applications compiled against an older version will work fine with a \example adrv9009-iiostream.c This example libiio program is meant to exercise the features of IIO functionality on the ADRV9009. \example dummy-iiostream.c This example libiio program is meant to exercise the features of IIO present in the sample dummy IIO device in the linux kernel. \example iio-monitor.c A Curses based application which implements real time monitoring of IIO non-buffer samples. +@if CPP_BINDINGS +\example iiopp-enum.cpp This example demonstrates usage of the C++ API to enumerate devices, channels and attributes. +@endif */ From 9a869572d863ca8e26ed5d6ea49faae4d7766d76 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Tue, 2 May 2023 15:13:34 +0300 Subject: [PATCH 25/86] CI:add new builds Signed-off-by: Raluca Groza --- CI/azure/prepare_assets.sh | 10 ++++++---- README.md | 20 ++++++++++++-------- artifact_manifest.txt.cmakein | 18 ++++++++++++++++++ azure-pipelines.yml | 25 ++++++++++++++++++++++++- 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh index 8ea86c8d6..18912d024 100755 --- a/CI/azure/prepare_assets.sh +++ b/CI/azure/prepare_assets.sh @@ -1,14 +1,15 @@ #!/bin/bash -e release_artifacts() { - local deb_linux_assets='Fedora-34 Ubuntu-20.04 Ubuntu-22.04' + local deb_linux_assets='Fedora-34 Fedora-28 Ubuntu-18.04 Ubuntu-20.04 Ubuntu-22.04 Debian-11 openSUSE-15.4 CentOS-7' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" for i in $deb_linux_assets; do cd "Linux-${i}" - if [ "${i}" == "Fedora-34" ]; then + if [ "${i}" == "Fedora-34" ] || [ "${i}" == "Fedora-28" ] || [ "${i}" == "CentOS-7" ]; then find . -name '*.rpm' -exec mv {} ../ ";" fi find . -name '*.deb' -exec mv {} ../ ";" + find . -name '*.tar.gz' -exec mv {} ../ ";" cd ../ rm -r "Linux-${i}" done @@ -42,6 +43,7 @@ release_artifacts() { for i in $deb_arm_assets; do cd "Ubuntu-${i}" find . -name '*.deb' -exec mv {} ../ ";" + find . -name '*.tar.gz' -exec mv {} ../ ";" cd ../ rm -r "Ubuntu-${i}" done @@ -49,10 +51,10 @@ release_artifacts() { } swdownloads_artifacts() { - local linux_dist='Fedora-34 Ubuntu-20.04 Ubuntu-22.04' + local linux_dist='Fedora-34 Fedora-28 Ubuntu-18.04 Ubuntu-20.04 Ubuntu-22.04 Debian-11 openSUSE-15.4 CentOS-7' for distribution in $linux_dist; do cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/Linux-${distribution}" - if [ "${distribution}" == "Fedora-34" ]; then + if [ "${distribution}" == "Fedora-34" ] || [ "${distribution}" == "Fedora-28" ] || [ "${distribution}" == "CentOS-7" ]; then find . -name '*.rpm' -exec mv {} ../"${distribution}_latest_master_libiio.rpm" ";" fi find . -name '*.tar.gz' -exec mv {} ../"${distribution}_latest_master_libiio.tar.gz" ";" diff --git a/README.md b/README.md index ea2309460..582a3bb9f 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,18 @@ As with many open source packages, we use [GitHub](https://github.com/analogdevi | OS X | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=macOSBuilds&configuration=macOSBuilds%20macOS_12)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | macOS Monterey
    (v 12) | [![OS-X package 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.pkg) | [![OS-X tarball 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=macOSBuilds&configuration=macOSBuilds%20macOS_11)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | macOS Big Sur
    (v 11) | [![OS-X package 11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-11_latest_master_libiio.pkg) | [![OS-X tarball 11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-11_latest_master_libiio.tar.gz) | | | Unsupported. Last artifacts from Sept 6, 2022 | macOS Catalina
    (v 10.15) | [![OS-X package 10.15](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-10.15_latest_master_libiio.pkg) | [![OS-X tarball 10.15](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-10.15_latest_master_libiio.tar.gz) | -| Linux | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_22_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Jammy Jellyfish
    (v 22.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-22.04_latest_master_libiio.deb) | | -| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_20_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Focal Fossa
    (v 20.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-20.04_latest_master_libiio.deb) | | -| | Unsupported. Last artifact from Feb 22, 2023 | Ubuntu Bionic Beaver
    (v 18.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-18.04_latest_master_libiio.deb) | | -| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20fedora34)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Fedora 34 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.deb) | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.rpm) | -| ARM | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-ppc64le)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-ppc64le | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-ppc64le_latest_master_libiio.deb) | | -| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-x390x)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-x390x | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-x390x_latest_master_libiio.deb) | | -| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-arm64v8)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-arm64v8 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm64v8_latest_master_libiio.deb) | | -| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-arm32v7)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-arm32v7 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm32v7_latest_master_libiio.deb) | | +| Linux | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_22_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Jammy Jellyfish
    (v 22.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-22.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-22.04_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_20_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Focal Fossa
    (v 20.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-20.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-20.04_latest_master_libiio.tar.gz) | +| | Unsupported. Last artifact from Feb 22, 2023 | Ubuntu Bionic Beaver
    (v 18.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-18.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-18.04_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20fedora34)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Fedora 34 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.tar.gz) | +| | | Fedora 28 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.tar.gz) | +| | | CentOS 7 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.tar.gz) | +| | | Debian Bullseye | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.tar.gz) | +| | | openSUSE 15.4 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.tar.gz) | +| ARM | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-ppc64le)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-ppc64le | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-ppc64le_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-ppc64le_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-x390x)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-x390x | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-x390x_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-x390x_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-arm64v8)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-arm64v8 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm64v8_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm64v8_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-arm32v7)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-arm32v7 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm32v7_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm32v7_latest_master_libiio.tar.gz) | If you use it, and like it - please let us know. If you use it, and hate it - please let us know that too. The goal of the project is to try to make Linux IIO devices easier to use on a variety of platforms. If we aren't doing that - we will try to make it better. diff --git a/artifact_manifest.txt.cmakein b/artifact_manifest.txt.cmakein index a01f033d2..9e296aac4 100644 --- a/artifact_manifest.txt.cmakein +++ b/artifact_manifest.txt.cmakein @@ -4,12 +4,30 @@ Linux-Fedora-34/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-34.deb Linux-Fedora-34/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-34.rpm Linux-Fedora-34/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-34.tar.gz +Linux-Fedora-28/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-28.deb +Linux-Fedora-28/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-28.rpm +Linux-Fedora-28/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-28.tar.gz + +Linux-CentOS-7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-CentOS-7.deb +Linux-CentOS-7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-CentOS-7.rpm +Linux-CentOS-7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-CentOS-7.tar.gz + +Linux-Debian-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-11.deb +Linux-Debian-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-11.rpm +Linux-Debian-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-11.tar.gz + +Linux-Ubuntu-18.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-18.04.deb +Linux-Ubuntu-18.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-18.04.tar.gz + Linux-Ubuntu-20.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-20.04.deb Linux-Ubuntu-20.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-20.04.tar.gz Linux-Ubuntu-22.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-22.04.deb Linux-Ubuntu-22.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-22.04.tar.gz +Linux-openSUSE-15.4/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-openSUSE-15.4.deb +Linux-openSUSE-15.4/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-openSUSE-15.4.tar.gz + macOS-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-11.tar.gz macOS-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6fcc38210..bab0ba5c8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,15 +32,30 @@ stages: # Docker Images strategy: matrix: + ubuntu_18_04: + image: 'tfcollins/libiio_ubuntu_18_04-ci:latest' + artifactName: 'Linux-Ubuntu-18.04' ubuntu_20_04: image: 'tfcollins/libiio_ubuntu_20_04-ci:latest' artifactName: 'Linux-Ubuntu-20.04' ubuntu_22_04: image: 'tfcollins/libiio_ubuntu_22_04-ci:latest' artifactName: 'Linux-Ubuntu-22.04' + fedora28: + image: 'tfcollins/libiio_fedora_28-ci:latest' + artifactName: 'Linux-Fedora-28' fedora34: image: 'tfcollins/libiio_fedora_34-ci:latest' artifactName: 'Linux-Fedora-34' + debian_bullseye: + image: 'tfcollins/libiio_debian_bullseye-ci:latest' + artifactName: 'Linux-Debian-11' + opensuse_15_4: + image: 'tfcollins/libiio_opensuse_15_4-ci:latest' + artifactName: 'Linux-openSUSE-15.4' + centos_7: + image: 'tfcollins/libiio_centos_7-ci:latest' + artifactName: 'Linux-CentOS-7' container: $[ variables['image'] ] steps: - checkout: self @@ -50,7 +65,12 @@ stages: - script: | set -e mkdir build && cd build - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + if [ "$ARTIFACTNAME" != "Linux-CentOS-7" ]; then + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + else + # CentOS 7 does not have new enough kernel headers to support modern libusb + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DWITH_USB_BACKEND=OFF -DWITH_IIOD_USBD=OFF + fi make make package displayName: 'Build' @@ -190,6 +210,9 @@ stages: macOS_12: vmImage: 'macOS-12' artifactName: 'macOS-12' + macOS_13: + vmImage: 'macOS-13' + artifactName: 'macOS-13' pool: vmImage: $[ variables['vmImage'] ] steps: From 82e9508da7a71833088eb5a8302f944d76020f44 Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Fri, 19 May 2023 14:37:41 +0200 Subject: [PATCH 26/86] iiopp: Fixed typo in documentation Signed-off-by: Tilman Blumhagen --- bindings/cpp/iiopp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h index d28cc9f72..6a5cc3ffb 100644 --- a/bindings/cpp/iiopp.h +++ b/bindings/cpp/iiopp.h @@ -37,7 +37,7 @@ * - Implicit conversion to the wrapped C-types, so C++ instances can easily be passed to the C-API. * * @warning All objects live in the @ref iiopp::Context that created them. When a context gets destroyed (when - * the last std::shared_pointer to it releases it) all its child objects die as well. All types have + * the last std::shared_ptr to it releases it) all its child objects die as well. All types have * weak reference semantic and become invalid when the context gets destroyed. * Lifetime is managed by std::shared_ptr. * From c3336470788ed31670b578237fd49f2923c15df6 Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Fri, 19 May 2023 14:47:58 +0200 Subject: [PATCH 27/86] iiopp: exceptions now have a specific type, derived from std::system_error std::system_error is better at reporting errno-based errors: It also reports the error code while runtime_error only reported a message. Also throwing a specific iiopp::error class allows applications to discriminate them from other kinds of errors. Signed-off-by: Tilman Blumhagen --- bindings/cpp/examples/iiopp-enum.cpp | 4 ++-- bindings/cpp/iiopp.h | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bindings/cpp/examples/iiopp-enum.cpp b/bindings/cpp/examples/iiopp-enum.cpp index 5f4388305..19eb46eb5 100644 --- a/bindings/cpp/examples/iiopp-enum.cpp +++ b/bindings/cpp/examples/iiopp-enum.cpp @@ -93,9 +93,9 @@ int main(int argc, char ** argv) { enumerateIioEntities(); } - catch (std::exception & e) + catch (error & e) { - cerr << "ERROR: " << e.what() << endl; + cerr << "ERROR " << e.code().value() << ": " << e.what() << endl; return EXIT_FAILURE; } diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h index 6a5cc3ffb..983d2ecbe 100644 --- a/bindings/cpp/iiopp.h +++ b/bindings/cpp/iiopp.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -70,6 +70,14 @@ class cstr operator char const * () const {return s;} }; +/** @brief Thrown to report errors. + */ +class error : public std::system_error +{ +public: + using std::system_error::system_error; +}; + /** @brief Common interface for attribute access */ class IAttr @@ -123,10 +131,7 @@ inline std::string err_str(int err) [[noreturn]] inline void err(int err, char const * ctx) { assert(err > 0); - std::ostringstream s; - s << ctx << ": " << err_str(err); - s.flush(); - throw std::runtime_error(s.str()); + throw error(err, std::generic_category(), ctx); } inline void check(int ret, char const * ctx) From 5506edc662c0ef860ff709e4a43a3262a81bf4fd Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Fri, 19 May 2023 15:34:59 +0200 Subject: [PATCH 28/86] iiopp: Relax required standard to C++11 (requires Boost for optional-type) The requirement of C++17 was only due to minor features. The missing std::optional is now replaced by boost::optional if C++17 is not available. Of course in that case Boost headers must be available. The examples still depend on C++17. This avoids the dependency on Boot. Signed-off-by: Tilman Blumhagen --- bindings/cpp/iiopp.h | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h index 983d2ecbe..06ccfda10 100644 --- a/bindings/cpp/iiopp.h +++ b/bindings/cpp/iiopp.h @@ -16,7 +16,12 @@ #include #include + +#if __cplusplus < 201703L +#include +#else #include +#endif #include #include #include @@ -24,7 +29,9 @@ /** @brief Public C++ API * - * This is a C++17 wrapper for @ref iio.h + * This is a C++ wrapper for @ref iio.h + * + * It requires C++17 or C++11 with Boost (for boost::optional). * * It provides: * @@ -49,6 +56,12 @@ namespace iiopp { +#if __cplusplus < 201703L +using boost::optional; +#else +using std::optional; +#endif + class Context; class Device; class Buffer; @@ -109,7 +122,7 @@ class IAttr /** @brief Optional string, used for C-functions that return @c nullptr for "no value". */ -typedef std::optional optstr; +typedef optional optstr; namespace impl { @@ -224,7 +237,7 @@ class AttrT : public IAttr }; template -std::optional attr(obj_T const * obj, cstr name) +optional attr(obj_T const * obj, cstr name) { char const * s = find_attr_T(obj, name); if (s) @@ -233,7 +246,7 @@ std::optional attr(obj_T const * obj, cstr name) } template -std::optional attr(obj_T const * obj, unsigned int idx) +optional attr(obj_T const * obj, unsigned int idx) { char const * s = get_attr_T(obj, idx); if (s) @@ -317,8 +330,8 @@ class Channel typedef impl::AttrSeqT AttrSeq; #endif - std::optional attr(cstr name) {return impl::attr(p, name);} - std::optional attr(unsigned int idx) {return impl::attr(p, idx);} + optional attr(cstr name) {return impl::attr(p, name);} + optional attr(unsigned int idx) {return impl::attr(p, idx);} AttrSeq attrs; @@ -415,8 +428,8 @@ class Device : public impl::IndexedSequence typedef IAttr Attr; typedef impl::AttrSeqT AttrSeq; #endif - std::optional attr(cstr name) {return impl::attr(p, name);} - std::optional attr(unsigned int idx) {return impl::attr(p, idx);} + optional attr(cstr name) {return impl::attr(p, name);} + optional attr(unsigned int idx) {return impl::attr(p, idx);} AttrSeq attrs; @@ -442,8 +455,8 @@ class Device : public impl::IndexedSequence typedef impl::AttrSeqT DebugAttrSeq; #endif - std::optional debug_attr(cstr name) {return impl::attr(p, name);} - std::optional debug_attr(unsigned int idx) {return impl::attr(p, idx);} + optional debug_attr(cstr name) {return impl::attr(p, name);} + optional debug_attr(unsigned int idx) {return impl::attr(p, idx);} DebugAttrSeq debug_attrs; @@ -469,8 +482,8 @@ class Device : public impl::IndexedSequence typedef impl::AttrSeqT BufferAttrSeq; #endif - std::optional buffer_attr(cstr name) {return impl::attr(p, name);} - std::optional buffer_attr(unsigned int idx) {return impl::attr(p, idx);} + optional buffer_attr(cstr name) {return impl::attr(p, name);} + optional buffer_attr(unsigned int idx) {return impl::attr(p, idx);} BufferAttrSeq buffer_attrs; @@ -792,8 +805,11 @@ std::shared_ptr create_scan_block(optstr backend, int flags) */ inline double value(Channel ch) { - if (double val; !iio_channel_attr_read_double(ch, "input", &val)) - return val / 1000.; + { + double val; + if (!iio_channel_attr_read_double(ch, "input", &val)) + return val / 1000.; + } double scale = 1; iio_channel_attr_read_double(ch, "scale", &scale); From ac26a23d2636b561f0b22230880be227938d8f6f Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Fri, 19 May 2023 15:40:51 +0200 Subject: [PATCH 29/86] html: Minor update about C++ It should need no explicit explanation that the C API can be used by C++ programs. Instead mention that now a C++ API is part of the library. Signed-off-by: Tilman Blumhagen --- doc/index.html.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/index.html.in b/doc/index.html.in index eb0358861..bb1142771 100644 --- a/doc/index.html.in +++ b/doc/index.html.in @@ -275,8 +275,8 @@

    Once you have secured your access to the library and its header, please check the libIIO API or the libIIO examples.

    Where is (insert my favourite language) support?

    -

    The mainline library is written in C, can be used in C++, and has built in - bindings for Python and C# (C-Sharp). The mainline library is written in C, and has built in + bindings for C++, Python and C# (C-Sharp). Node.js and Rust are maintained outside the main repo. If you are interested in creating more language From e89543607eeaddd3f8d12a8018d565ffa6e6443f Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Mon, 22 May 2023 16:39:36 +0200 Subject: [PATCH 30/86] iiopp: Fixed typo ContextInfo::description() Signed-off-by: Tilman Blumhagen --- bindings/cpp/examples/iiopp-enum.cpp | 4 ++-- bindings/cpp/iiopp.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/cpp/examples/iiopp-enum.cpp b/bindings/cpp/examples/iiopp-enum.cpp index 19eb46eb5..254f7a495 100644 --- a/bindings/cpp/examples/iiopp-enum.cpp +++ b/bindings/cpp/examples/iiopp-enum.cpp @@ -75,7 +75,7 @@ void enumerateIioEntities() for (ContextInfo info : *infoList) { cout << " uri: " << quoted(info.uri().c_str()) << endl; - cout << " description: " << quoted(info.desciption().c_str()) << endl; + cout << " description: " << quoted(info.description().c_str()) << endl; } cout << "scan block:" << endl; @@ -83,7 +83,7 @@ void enumerateIioEntities() for (ContextInfo info : *blk) { cout << " uri: " << quoted(info.uri().c_str()) << endl; - cout << " description: " << quoted(info.desciption().c_str()) << endl; + cout << " description: " << quoted(info.description().c_str()) << endl; } } diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h index 06ccfda10..be41ace44 100644 --- a/bindings/cpp/iiopp.h +++ b/bindings/cpp/iiopp.h @@ -691,7 +691,7 @@ class ContextInfo ContextInfo(iio_context_info const * i) : p(i){assert(i);} operator iio_context_info const * () const {return p;} - cstr desciption() const {return iio_context_info_get_description(p);} + cstr description() const {return iio_context_info_get_description(p);} cstr uri() const {return iio_context_info_get_uri(p);} }; From 43f03aca5d9bce54c91dadbf8d93538d9344be73 Mon Sep 17 00:00:00 2001 From: Tilman Blumhagen Date: Wed, 24 May 2023 13:34:56 +0200 Subject: [PATCH 31/86] iiopp: added toggle_iio_feature for C++ bindings Signed-off-by: Tilman Blumhagen --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2fd71386..e48910a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -701,6 +701,7 @@ toggle_iio_feature("${WITH_TESTS}" utils) toggle_iio_feature("${WITH_EXAMPLES}" examples) toggle_iio_feature("${WITH_IIOD}" iiod) toggle_iio_feature("${INSTALL_UDEV_RULE}" udev-rule) +toggle_iio_feature("${CPP_BINDINGS}" "c++-bindings") #add iiod settings list(APPEND IIO_FEATURES_ON ${IIOD_FEATURES_ON}) list(APPEND IIO_FEATURES_OFF ${IIOD_FEATURES_OFF}) From e26bff111f4c7e37222ab34014cde3f9c6aab31f Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 5 Jun 2023 14:01:27 +0200 Subject: [PATCH 32/86] iiod: thread_pool: Add helper thread_pool_purge_events() Factorize the code that purges all the data left in the event file descriptor into a function named thread_pool_purge_events(). This function is only called once for now, but it will be used again in a future commit. Signed-off-by: Paul Cercueil --- iiod/thread-pool.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/iiod/thread-pool.c b/iiod/thread-pool.c index 2fd30825f..65b680ee5 100644 --- a/iiod/thread-pool.c +++ b/iiod/thread-pool.c @@ -157,11 +157,18 @@ void thread_pool_stop(struct thread_pool *pool) } while (ret == -1 && errno == EINTR); } -void thread_pool_stop_and_wait(struct thread_pool *pool) +static void thread_pool_purge_events(struct thread_pool *pool) { uint64_t e; int ret; + do { + ret = read(pool->stop_fd, &e, sizeof(e)); + } while (ret != -1 || errno == EINTR); +} + +void thread_pool_stop_and_wait(struct thread_pool *pool) +{ thread_pool_stop(pool); pthread_mutex_lock(&pool->thread_count_lock); @@ -170,9 +177,7 @@ void thread_pool_stop_and_wait(struct thread_pool *pool) &pool->thread_count_lock); pthread_mutex_unlock(&pool->thread_count_lock); - do { - ret = read(pool->stop_fd, &e, sizeof(e)); - } while (ret != -1 || errno == EINTR); + thread_pool_purge_events(pool); } bool thread_pool_is_stopped(const struct thread_pool *pool) From f5f8422559a08ba44a409a4f97fc11bdfb3e2b2a Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 4 Apr 2023 11:00:22 +0200 Subject: [PATCH 33/86] iiod: thread_pool: Add function thread_pool_restart() This function can be used to re-activate a thread pool that has been previously stopped with thread_pool_stop(). Signed-off-by: Paul Cercueil --- iiod/thread-pool.c | 8 ++++++++ iiod/thread-pool.h | 1 + 2 files changed, 9 insertions(+) diff --git a/iiod/thread-pool.c b/iiod/thread-pool.c index 65b680ee5..3b00a54ef 100644 --- a/iiod/thread-pool.c +++ b/iiod/thread-pool.c @@ -185,6 +185,14 @@ bool thread_pool_is_stopped(const struct thread_pool *pool) return pool->stop; } +void thread_pool_restart(struct thread_pool *pool) +{ + if (pool->stop) { + thread_pool_purge_events(pool); + pool->stop = false; + } +} + void thread_pool_destroy(struct thread_pool *pool) { pthread_mutex_destroy(&pool->thread_count_lock); diff --git a/iiod/thread-pool.h b/iiod/thread-pool.h index b4e8bf0bb..42d428598 100644 --- a/iiod/thread-pool.h +++ b/iiod/thread-pool.h @@ -19,6 +19,7 @@ int thread_pool_get_poll_fd(const struct thread_pool *pool); void thread_pool_stop(struct thread_pool *pool); void thread_pool_stop_and_wait(struct thread_pool *pool); bool thread_pool_is_stopped(const struct thread_pool *pool); +void thread_pool_restart(struct thread_pool *pool); void thread_pool_destroy(struct thread_pool *pool); From 1753dbc3840cbc3a2c0b3e300b0a64e130f0c10d Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 4 Apr 2023 11:02:05 +0200 Subject: [PATCH 34/86] iiod: Re-create IIO context when receiving USR1 signal Handle USR1 as a signal that IIOD should re-create the IIO context. This allows support for hot-plugging IIO devices at runtime; the USR1 signal can then be sent from a udev script, for instance. Signed-off-by: Paul Cercueil --- iiod/iiod.c | 92 +++++++++++++++++++++++++++++++++++++++-------------- iiod/ops.h | 3 +- iiod/usbd.c | 41 +++++++++++++----------- 3 files changed, 94 insertions(+), 42 deletions(-) diff --git a/iiod/iiod.c b/iiod/iiod.c index 3478126ca..2cdf0356a 100644 --- a/iiod/iiod.c +++ b/iiod/iiod.c @@ -37,6 +37,11 @@ #define _STRINGIFY(x) #x #define STRINGIFY(x) _STRINGIFY(x) +static int start_iiod(const char *uri, const char *ffs_mountpoint, + const char *uart_params, bool debug, bool interactive, + bool use_aio, uint16_t port, unsigned int nb_pipes, + int ep0_fd); + struct client_data { int fd; bool debug; @@ -131,6 +136,14 @@ static void sig_handler(int sig) thread_pool_stop(main_thread_pool); } +static bool restart_usr1; + +static void sig_handler_usr1(int sig) +{ + restart_usr1 = true; + thread_pool_stop(main_thread_pool); +} + static int main_interactive(struct iio_context *ctx, bool verbose, bool use_aio, const void *xml_zstd, size_t xml_zstd_len) { @@ -376,15 +389,12 @@ int main(int argc, char **argv) long nb_pipes = 3, val; char *end; const char *arg = "local:"; - struct iio_context *ctx; int c, option_index = 0; char *ffs_mountpoint = NULL; char *uart_params = NULL; char err_str[1024]; - void *xml_zstd; - size_t xml_zstd_len = 0; uint16_t port = IIOD_PORT; - int ret; + int ret, ep0_fd = 0; while ((c = getopt_long(argc, argv, "+hVdDiaF:n:s:p:u:", options, &option_index)) != -1) { @@ -459,40 +469,79 @@ int main(int argc, char **argv) } } - ctx = iio_create_context_from_uri(arg); - - if (!ctx) { + main_thread_pool = thread_pool_new(); + if (!main_thread_pool) { iio_strerror(errno, err_str, sizeof(err_str)); - IIO_ERROR("Unable to create local context: %s\n", err_str); + IIO_ERROR("Unable to create thread pool: %s\n", err_str); return EXIT_FAILURE; } - xml_zstd = get_xml_zstd_data(ctx, &xml_zstd_len); + if (WITH_IIOD_USBD && ffs_mountpoint) { + ret = init_usb_daemon(ffs_mountpoint, nb_pipes); + if (ret < 0) { + iio_strerror(errno, err_str, sizeof(err_str)); + IIO_ERROR("Unable to init USB: %s\n", err_str); - main_thread_pool = thread_pool_new(); - if (!main_thread_pool) { - iio_strerror(errno, err_str, sizeof(err_str)); - IIO_ERROR("Unable to create thread pool: %s\n", err_str); - ret = EXIT_FAILURE; - goto out_destroy_context; + thread_pool_destroy(main_thread_pool); + return EXIT_FAILURE; + } + + ep0_fd = ret; } set_handler(SIGHUP, sig_handler); set_handler(SIGPIPE, sig_handler); set_handler(SIGINT, sig_handler); set_handler(SIGTERM, sig_handler); + set_handler(SIGUSR1, sig_handler_usr1); + + do { + thread_pool_restart(main_thread_pool); + restart_usr1 = false; + + ret = start_iiod(arg, ffs_mountpoint, uart_params, debug, + interactive, use_aio, port, nb_pipes, ep0_fd); + } while (!ret && restart_usr1); + + thread_pool_destroy(main_thread_pool); + + if (WITH_IIOD_USBD && ffs_mountpoint) + close(ep0_fd); + + return ret; +} + +static int start_iiod(const char *uri, const char *ffs_mountpoint, + const char *uart_params, bool debug, bool interactive, + bool use_aio, uint16_t port, unsigned int nb_pipes, + int ep0_fd) +{ + struct iio_context *ctx; + char err_str[1024]; + void *xml_zstd; + size_t xml_zstd_len = 0; + int ret; + + ctx = iio_create_context_from_uri(uri); + if (!ctx) { + iio_strerror(errno, err_str, sizeof(err_str)); + IIO_ERROR("Unable to create local context: %s\n", err_str); + return EXIT_FAILURE; + } + + xml_zstd = get_xml_zstd_data(ctx, &xml_zstd_len); if (WITH_IIOD_USBD && ffs_mountpoint) { /* We pass use_aio == true directly, this is ensured to be true * by the CMake script. */ ret = start_usb_daemon(ctx, ffs_mountpoint, - debug, true, (unsigned int) nb_pipes, + debug, true, (unsigned int) nb_pipes, ep0_fd, main_thread_pool, xml_zstd, xml_zstd_len); if (ret) { iio_strerror(-ret, err_str, sizeof(err_str)); IIO_ERROR("Unable to start USB daemon: %s\n", err_str); ret = EXIT_FAILURE; - goto out_destroy_thread_pool; + goto out_free_xml_data; } } @@ -504,7 +553,7 @@ int main(int argc, char **argv) iio_strerror(-ret, err_str, sizeof(err_str)); IIO_ERROR("Unable to start serial daemon: %s\n", err_str); ret = EXIT_FAILURE; - goto out_destroy_thread_pool; + goto out_thread_pool_stop; } } @@ -513,16 +562,13 @@ int main(int argc, char **argv) else ret = main_server(ctx, debug, xml_zstd, xml_zstd_len, port); +out_thread_pool_stop: /* * In case we got here through an error in the main thread make sure all * the worker threads are signaled to shutdown. */ - -out_destroy_thread_pool: thread_pool_stop_and_wait(main_thread_pool); - thread_pool_destroy(main_thread_pool); - -out_destroy_context: +out_free_xml_data: free(xml_zstd); iio_context_destroy(ctx); diff --git a/iiod/ops.h b/iiod/ops.h index add7437b1..d03eee44f 100644 --- a/iiod/ops.h +++ b/iiod/ops.h @@ -92,9 +92,10 @@ void interpreter(struct iio_context *ctx, int fd_in, int fd_out, bool verbose, bool is_socket, bool is_usb, bool use_aio, struct thread_pool *pool, const void *xml_zstd, size_t xml_zstd_len); +int init_usb_daemon(const char *ffs, unsigned int nb_pipes); int start_usb_daemon(struct iio_context *ctx, const char *ffs, bool debug, bool use_aio, unsigned int nb_pipes, - struct thread_pool *pool, + int ep0_fd, struct thread_pool *pool, const void *xml_zstd, size_t xml_zstd_len); int start_serial_daemon(struct iio_context *ctx, const char *uart_params, bool debug, struct thread_pool *pool, diff --git a/iiod/usbd.c b/iiod/usbd.c index 3385f5b53..93889ccfc 100644 --- a/iiod/usbd.c +++ b/iiod/usbd.c @@ -217,7 +217,6 @@ static void usbd_main(struct thread_pool *pool, void *d) thread_pool_destroy(pdata->pool[i]); } - close(pdata->ep0_fd); free(pdata->ffs); free(pdata->pool); free(pdata); @@ -328,14 +327,34 @@ static int write_header(int fd, unsigned int nb_pipes) return 0; } +int init_usb_daemon(const char *ffs, unsigned int nb_pipes) +{ + char buf[256]; + int ep0_fd, ret; + + snprintf(buf, sizeof(buf), "%s/ep0", ffs); + + ep0_fd = open(buf, O_RDWR); + if (ep0_fd < 0) { + return -errno; + } + + ret = write_header(ep0_fd, nb_pipes); + if (ret < 0) { + close(ep0_fd); + return ret; + } + + return ep0_fd; +} + int start_usb_daemon(struct iio_context *ctx, const char *ffs, bool debug, bool use_aio, unsigned int nb_pipes, - struct thread_pool *pool, + int ep0_fd, struct thread_pool *pool, const void *xml_zstd, size_t xml_zstd_len) { struct usbd_pdata *pdata; unsigned int i; - char buf[256]; int ret; pdata = zalloc(sizeof(*pdata)); @@ -356,18 +375,6 @@ int start_usb_daemon(struct iio_context *ctx, const char *ffs, goto err_free_pdata_pool; } - snprintf(buf, sizeof(buf), "%s/ep0", ffs); - - pdata->ep0_fd = open(buf, O_RDWR); - if (pdata->ep0_fd < 0) { - ret = -errno; - goto err_free_ffs; - } - - ret = write_header(pdata->ep0_fd, nb_pipes); - if (ret < 0) - goto err_close_ep0; - for (i = 0; i < nb_pipes; i++) { pdata->pool[i] = thread_pool_new(); if (!pdata->pool[i]) { @@ -381,6 +388,7 @@ int start_usb_daemon(struct iio_context *ctx, const char *ffs, pdata->use_aio = use_aio; pdata->xml_zstd = xml_zstd; pdata->xml_zstd_len = xml_zstd_len; + pdata->ep0_fd = ep0_fd; ret = thread_pool_add_thread(pool, usbd_main, pdata, "usbd_main_thd"); if (!ret) @@ -393,9 +401,6 @@ int start_usb_daemon(struct iio_context *ctx, const char *ffs, if (pdata->pool[i]) thread_pool_destroy(pdata->pool[i]); } -err_close_ep0: - close(pdata->ep0_fd); -err_free_ffs: free(pdata->ffs); err_free_pdata_pool: free(pdata->pool); From 0b14634aa7c2efc36d35b041c5511c93eb6a0c0f Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 6 Jun 2023 07:43:40 -0400 Subject: [PATCH 35/86] cmake: turn HWMON on by default, and SERIAL ON for CI This turns HWMON on by default, and turns on serial backends in the CI systems so the default binaries include it. Signed-off-by: Robin Getz --- CI/azure/ci-ubuntu.sh | 2 +- CMakeLists.txt | 2 +- README_BUILD.md | 2 +- azure-pipelines.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CI/azure/ci-ubuntu.sh b/CI/azure/ci-ubuntu.sh index 42f6bb0b6..25ccea0b1 100644 --- a/CI/azure/ci-ubuntu.sh +++ b/CI/azure/ci-ubuntu.sh @@ -3,6 +3,6 @@ set -x uname -a echo "$PWD" mkdir build && cd build -cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" +cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" make make package diff --git a/CMakeLists.txt b/CMakeLists.txt index e48910a99..f53fe17e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,7 +284,7 @@ if(WITH_LOCAL_BACKEND) endif() option(WITH_LOCAL_MMAP_API "Use the mmap API provided in Analog Devices' kernel (not upstream)" ON) - option(WITH_HWMON "Add compatibility with the hardware monitoring (hwmon) subsystem" OFF) + option(WITH_HWMON "Add compatibility with the hardware monitoring (hwmon) subsystem" ON) list(APPEND LIBIIO_SCAN_BACKENDS local) endif() diff --git a/README_BUILD.md b/README_BUILD.md index 596506bb8..61bc7ed4e 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -53,7 +53,7 @@ Cmake Options | Default | Target | Description `INSTALL_UDEV_RULE` | ON | Linux | Install a Linux udev rule for detection of USB devices | `UDEV_RULES_INSTALL_DIR` | /lib/udev/rules.d | Linux | default install path for udev rules | `WITH_LOCAL_CONFIG` | ON | Linux | Read local context attributes from /etc/libiio.ini | -`WITH_HWMON` | OFF | Linux | Add compatibility with the hwmon subsystem | +`WITH_HWMON` | ON | Linux | Add compatibility with the hwmon subsystem | `WITH_GCOV` | OFF | Linux | Build with gcov profiling flags | `OSX_FRAMEWORK` | ON | Mac | OS X frameworks provide the interfaces you need to write software for Mac. | `OSX_PACKAGE` | ON | Mac | Create a OSX package for installation on local and other machines | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bab0ba5c8..444e02b4a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -66,9 +66,9 @@ stages: set -e mkdir build && cd build if [ "$ARTIFACTNAME" != "Linux-CentOS-7" ]; then - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} else - # CentOS 7 does not have new enough kernel headers to support modern libusb + # CentOS 7 does not have new enough kernel headers to support modern libusb. nor libserialport cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DWITH_USB_BACKEND=OFF -DWITH_IIOD_USBD=OFF fi make From 739627532b59279d11869745be49894d9cc07d82 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 7 Jun 2023 15:25:18 -0400 Subject: [PATCH 36/86] local: change exclusionary language No functional change. Per: https://www.ietf.org/archive/id/draft-knodel-terminology-09.html remove some exclusionary language that was in the codebase. Signed-off-by: Robin Getz --- local.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/local.c b/local.c index 3eff2bd32..d058358a3 100644 --- a/local.c +++ b/local.c @@ -96,7 +96,7 @@ struct iio_channel_pdata { unsigned int nb_protected_attrs; }; -static const char * const device_attrs_blacklist[] = { +static const char * const device_attrs_denylist[] = { "dev", "uevent", }; @@ -1265,8 +1265,8 @@ static int add_attr_to_device(struct iio_device *dev, const char *attr) { unsigned int i; - for (i = 0; i < ARRAY_SIZE(device_attrs_blacklist); i++) - if (!strcmp(device_attrs_blacklist[i], attr)) + for (i = 0; i < ARRAY_SIZE(device_attrs_denylist); i++) + if (!strcmp(device_attrs_denylist[i], attr)) return 0; if (!strcmp(attr, "name")) From 7a1269e12a4ffeb75d88f30c856c8158448bf4d9 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 5 Jun 2023 15:54:59 -0400 Subject: [PATCH 37/86] CI: Add a spelling check into CI use codespell to make sure that everyone is aware of their bad spelling, and make sure to point it out during the commit process. Signed-off-by: Robin Getz --- .codespell-whitelist => .codespell-ignore.txt | 0 .github/workflows/codespell.yml | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+) rename .codespell-whitelist => .codespell-ignore.txt (100%) create mode 100644 .github/workflows/codespell.yml diff --git a/.codespell-whitelist b/.codespell-ignore.txt similarity index 100% rename from .codespell-whitelist rename to .codespell-ignore.txt diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 000000000..1d7471eea --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,27 @@ +# GitHub Action to automate the identification of common misspellings in text files. +# https://github.com/codespell-project/actions-codespell +# https://github.com/codespell-project/codespell +name: codespell +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +permissions: + contents: read # to fetch code (actions/checkout) +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: codespell-project/actions-codespell@v1 # v1.0 + with: + check_filenames: true + skip: .git,deps + ignore_words_file: .codespell-ignore.txt From 53d94214d629e3f9a0835aab4febb2034cac631e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 5 Jun 2023 16:25:50 -0400 Subject: [PATCH 38/86] Fix random minor spelling errors now that we have CI telling where the problems are, fix it. Signed-off-by: Robin Getz --- CI/azure/generateDocumentationAndDeploy.sh.in | 2 +- README_BUILD.md | 2 +- bindings/cpp/iiopp.h | 2 +- bindings/csharp/Device.cs | 2 +- bindings/csharp/mainpage.dox | 2 +- bindings/python/doc/iio_attr.rst | 2 +- bindings/python/doc/iio_info.rst | 2 +- bindings/python/doc/iio_readdev.rst | 2 +- bindings/python/doc/iio_writedev.rst | 2 +- cmake/LinuxPackaging.cmake | 8 ++++---- dns_sd_windows.c | 2 +- doc/index.html.in | 2 +- iiod/dns-sd.c | 2 +- local.c | 2 +- mainpage.dox | 4 ++-- man/iio_common_cmds.1 | 2 +- man/make_man.sh.in | 2 +- utilities.c | 2 +- 18 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CI/azure/generateDocumentationAndDeploy.sh.in b/CI/azure/generateDocumentationAndDeploy.sh.in index 37b0c2bf5..3428609d9 100644 --- a/CI/azure/generateDocumentationAndDeploy.sh.in +++ b/CI/azure/generateDocumentationAndDeploy.sh.in @@ -8,7 +8,7 @@ set -x # # Preconditions: # - Packages doxygen graphviz must be installed. -# - An gh-pages branch should already exist. See below for mor info on how to +# - An gh-pages branch should already exist. See below for more info on how to # create a gh-pages branch. # # This script will generate Doxygen documentation and push the documentation to diff --git a/README_BUILD.md b/README_BUILD.md index 61bc7ed4e..7080b54ea 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -82,7 +82,7 @@ Cmake Options | Default | Description | `WITH_ZSTD` | OFF | Support for ZSTD compressed metadata | -Options which effect iiod only. These are only avalible on Linux. +Options which effect iiod only. These are only available on Linux. Cmake Options | Default | Description | ------------------- | ------- | ---------------------------------------------- | diff --git a/bindings/cpp/iiopp.h b/bindings/cpp/iiopp.h index be41ace44..4a1e3c134 100644 --- a/bindings/cpp/iiopp.h +++ b/bindings/cpp/iiopp.h @@ -40,7 +40,7 @@ * - Error handling (error codes are checked and turned into exceptions). * - Functions that may return \c NULL for "no string" are explicit by returning an std::optional. * - Iterators for idiomatic access to devices of context and channels of devices. - * - Iterators for atributes. + * - Iterators for attributes. * - Implicit conversion to the wrapped C-types, so C++ instances can easily be passed to the C-API. * * @warning All objects live in the @ref iiopp::Context that created them. When a context gets destroyed (when diff --git a/bindings/csharp/Device.cs b/bindings/csharp/Device.cs index bdc1820ee..b7886faed 100644 --- a/bindings/csharp/Device.cs +++ b/bindings/csharp/Device.cs @@ -450,7 +450,7 @@ public Attr find_buffer_attribute(string attribute) return new DeviceBufferAttr(dev, Marshal.PtrToStringAnsi(attr)); } - ///

    Finds the channel attribute coresponding to the given filename from the current device. + /// Finds the channel attribute corresponding to the given filename from the current device. /// The name of the attribute. /// Output variable. It will contain a pointer to the resulting . /// Output variable. It will contain a pointer to the resulting . diff --git a/bindings/csharp/mainpage.dox b/bindings/csharp/mainpage.dox index ac1f6f752..d21bbd9f2 100644 --- a/bindings/csharp/mainpage.dox +++ b/bindings/csharp/mainpage.dox @@ -15,7 +15,7 @@ open-source, commercial or non-commercial applications. The full terms of the library license can be found at: http://opensource.org/licenses/LGPL-2.1 and the iio-utils license can be found at: https://opensource.org/licenses/GPL-2.0 @section code_model Code Model -The basic bricks of the libiio API, and therefore the C# bindings are the the iio namepace, and the classes of that nameplace: iio.Channel, iio.Context, iio.Device, iio.IOBuffer, iio.Trigger, and iio.Attr (channel or device attributes). +The basic bricks of the libiio API, and therefore the C# bindings are the the iio namespace, and the classes of that nameplace: iio.Channel, iio.Context, iio.Device, iio.IOBuffer, iio.Trigger, and iio.Attr (channel or device attributes). ![Caption text](doc/codemodel.svg) diff --git a/bindings/python/doc/iio_attr.rst b/bindings/python/doc/iio_attr.rst index 13e703474..3e2c18ca6 100644 --- a/bindings/python/doc/iio_attr.rst +++ b/bindings/python/doc/iio_attr.rst @@ -1,7 +1,7 @@ iio_attr ====================== | iio_attr is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. -| This tool is written using the libiio Python bindings. It works in a very similar way of how the base iio_attr works. You can find more informations about it on this `page `_. +| This tool is written using the libiio Python bindings. It works in a very similar way of how the base iio_attr works. You can find more information about it on this `page `_. .. automodule:: iio_attr :members: diff --git a/bindings/python/doc/iio_info.rst b/bindings/python/doc/iio_info.rst index 025a4e0c7..2f2e6dc81 100644 --- a/bindings/python/doc/iio_info.rst +++ b/bindings/python/doc/iio_info.rst @@ -1,7 +1,7 @@ iio_info ===================== | iio_info is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. -| This tool is written using the libiio Python bindings. It works in the same way as the base iio_info works. You can find more informations about it on this `page `_. +| This tool is written using the libiio Python bindings. It works in the same way as the base iio_info works. You can find more information about it on this `page `_. .. automodule:: iio_info :members: diff --git a/bindings/python/doc/iio_readdev.rst b/bindings/python/doc/iio_readdev.rst index 013618b83..50e156555 100644 --- a/bindings/python/doc/iio_readdev.rst +++ b/bindings/python/doc/iio_readdev.rst @@ -1,7 +1,7 @@ iio_readdev ===================== | iio_readdev is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. -| This tool is written using the libiio Python bindings. It works in the same way as the base iio_readdev works. You can find more informations about it on this `page `_. +| This tool is written using the libiio Python bindings. It works in the same way as the base iio_readdev works. You can find more information about it on this `page `_. .. automodule:: iio_readdev :members: diff --git a/bindings/python/doc/iio_writedev.rst b/bindings/python/doc/iio_writedev.rst index 4f069e0d7..f19258c11 100644 --- a/bindings/python/doc/iio_writedev.rst +++ b/bindings/python/doc/iio_writedev.rst @@ -1,7 +1,7 @@ iio_writedev ===================== | iio_writedev is part of the Libiio package, a library that has been developed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. -| This tool is written using the libiio Python bindings. It works in the same way as the base iio_writedev works. You can find more informations about it on this `page `_. +| This tool is written using the libiio Python bindings. It works in the same way as the base iio_writedev works. You can find more information about it on this `page `_. .. automodule:: iio_writedev :members: diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index d4d6181ca..a3f787628 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -41,11 +41,11 @@ endif() # if we want to, and have the capabilities find what is needed, # based on what backends are turned on and what libraries are installed if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) - message(STATUS "querying installed packages on system for dependancies") + message(STATUS "querying installed packages on system for dependencies") execute_process(COMMAND "${DPKG_CMD}" --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) - # don't add a package dependancy if it is not installed locally + # don't add a package dependency if it is not installed locally # these should be the debian package names set(PACKAGES "libc6") if (WITH_LOCAL_BACKEND) @@ -64,7 +64,7 @@ if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) set(PACKAGES "${PACKAGES} libserialport0") endif() # find the version of the installed package, which is hard to do in - # cmake first, turn the list into an list (seperated by semicolons) + # cmake first, turn the list into an list (separated by semicolons) string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES}) # then iterate over each foreach(package ${PACKAGES}) @@ -103,7 +103,7 @@ if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) DPKGQ_VER ${DPKGQ_VER}) string(REGEX REPLACE "'" "" DPKGQ_VER ${DPKGQ_VER}) - # build the string for the Debian dependancy + # build the string for the Debian dependency set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" "${match} (>= ${DPKGQ_VER}), ") diff --git a/dns_sd_windows.c b/dns_sd_windows.c index c6fc47d29..ca6087b88 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -187,7 +187,7 @@ static int open_client_sockets(int *sockets, unsigned int max_sockets) * - IPv4 "address" record (A) specifying IPv4 address of a given host * - IPv6 "address" record (AAAA) specifying IPv6 address of a given host * It's this routine that gets called, and needs to stitch things together - * The DNS host doesn't necessary need to be the acutal host (but for + * The DNS host doesn't necessary need to be the actual host (but for * mdns - it usually is. */ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, diff --git a/doc/index.html.in b/doc/index.html.in index bb1142771..5223d7eb4 100644 --- a/doc/index.html.in +++ b/doc/index.html.in @@ -199,7 +199,7 @@ devices. IIO started as a Linux kernel subsystem to support for devices that included - analog-to-digital convertors (ADCs) and/or digital-to-analog convertors + analog-to-digital converters (ADCs) and/or digital-to-analog converters (DACs). While the libIIO continues to provide an easy interface to the Linux kernel IIO subsystem, it has also expanded beyond that, and is now just as common to see this used inside an embedded system or hypervisor as diff --git a/iiod/dns-sd.c b/iiod/dns-sd.c index 36db81dbf..37fd2a746 100644 --- a/iiod/dns-sd.c +++ b/iiod/dns-sd.c @@ -310,7 +310,7 @@ void start_avahi(struct thread_pool *pool, uint16_t port) avahi.name = NULL; avahi.port = port; - /* In case dbus, or avahi deamon are not started, we create a thread + /* In case dbus, or avahi daemon are not started, we create a thread * that tries a few times to attach, if it can't within the first * minute, it gives up. */ diff --git a/local.c b/local.c index d058358a3..6a8d7b928 100644 --- a/local.c +++ b/local.c @@ -926,7 +926,7 @@ static int local_open(const struct iio_device *dev, /* * Set watermark to the buffer size; the driver will adjust to its - * maximum if it's too high without issueing an error. + * maximum if it's too high without issuing an error. */ ret = local_write_dev_attr(dev, "buffer/watermark", buf, strlen(buf) + 1, false); diff --git a/mainpage.dox b/mainpage.dox index f245ed835..6c4904903 100644 --- a/mainpage.dox +++ b/mainpage.dox @@ -11,7 +11,7 @@ License, version 2 or (at your option) any later version. This open-source license allows anyone to use the library for proprietary or open-source, commercial or non-commercial applications. -Seperately, the IIO Library also includes a set of test examples and utilities, (collectively known as iio-utils) which are developed and released under the terms of the GNU General Public License, version 2 or (at your option) any later version. +Separately, the IIO Library also includes a set of test examples and utilities, (collectively known as iio-utils) which are developed and released under the terms of the GNU General Public License, version 2 or (at your option) any later version. The full terms of the library license can be found at: http://opensource.org/licenses/LGPL-2.1 and the iio-utils license can be found at: https://opensource.org/licenses/GPL-2.0 @@ -31,7 +31,7 @@ A C++ API is provided in @ref iiopp.h @endif @section scan_contexts Scanning for IIO contexts -The first step when dealing with a collection of IIO devices (known as a context) is to find the context. This can be connected via usb, network, serial or local. Having these different connectivity options could prove to be problematic, but libiio abstracts the low level communications away, and allows you just to find contexts, and talk to devices without being interested in the low level aspects. Many find this convinent to develop applications and algorithms on a host, and quickly move to an embedded Linux system without having to change any code. +The first step when dealing with a collection of IIO devices (known as a context) is to find the context. This can be connected via usb, network, serial or local. Having these different connectivity options could prove to be problematic, but libiio abstracts the low level communications away, and allows you just to find contexts, and talk to devices without being interested in the low level aspects. Many find this convenient to develop applications and algorithms on a host, and quickly move to an embedded Linux system without having to change any code. To find what IIO contexts are available, use the following: - iio_create_scan_context(): Create a iio_scan_context object. Depending on what backends were enabled with compiling the library, some of them may not be available. The first argument to this function is a string which is used as a filter ("usb:", "ip:", "local:", "usb:ip", where the default (NULL) means any backend that is compiled in). diff --git a/man/iio_common_cmds.1 b/man/iio_common_cmds.1 index aee2e2462..ce5ccc9d7 100644 --- a/man/iio_common_cmds.1 +++ b/man/iio_common_cmds.1 @@ -15,4 +15,4 @@ on your system are up to date. This is also useful when reporting bugs. Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip:usb'. Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456,b673'. vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only) -If no argument is given, it checks all that are availble. +If no argument is given, it checks all that are available. diff --git a/man/make_man.sh.in b/man/make_man.sh.in index bdc5b2d39..e5d411ae0 100755 --- a/man/make_man.sh.in +++ b/man/make_man.sh.in @@ -32,7 +32,7 @@ cat <. .\" %%%LICENSE_END .\" -.\" This file is autogenerated, and should not be editted +.\" This file is autogenerated, and should not be edited .\" .if n .po 0 .TH INTRO 3LIBIIO "@CMAKE_DATE@" "libiio-@LIBIIO_VERSION_MAJOR@.@LIBIIO_VERSION_MINOR@" diff --git a/utilities.c b/utilities.c index 71787395d..5dc26887f 100644 --- a/utilities.c +++ b/utilities.c @@ -220,7 +220,7 @@ char *iio_strtok_r(char *str, const char *delim, char **saveptr) #elif defined(HAS_STRTOK_R) return strtok_r(str, delim, saveptr); #else -#error Need a implentation of strtok_r for this platform +#error Need a implementation of strtok_r for this platform #endif } From 8739c16973bd3efc1759894e2d75ce46a277ba43 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 5 Jun 2023 16:26:35 -0400 Subject: [PATCH 39/86] spelling: Ignore some false spelling errors Today, codespell looks at "\tRead" which is "tab" followed by "Read" as "tRead", and flags this as a spelling mistake. See: https://github.com/codespell-project/codespell/pull/1422 which was closed without merging. Once that is resolved upstream - we can undo this. Signed-off-by: Robin Getz --- .codespell-ignore.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.codespell-ignore.txt b/.codespell-ignore.txt index dfb45f504..67e412814 100644 --- a/.codespell-ignore.txt +++ b/.codespell-ignore.txt @@ -1,3 +1,8 @@ SOM som mitre +tread +elease +tREAD +tRead +tRead From 508e4bd99d9c3bcfb1d54fae2f8ab31902aa17a6 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Wed, 7 Jun 2023 09:45:25 +0300 Subject: [PATCH 40/86] CI:fix macOS tar balls Signed-off-by: Raluca Groza --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 444e02b4a..4e1bddc28 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -239,7 +239,7 @@ stages: - script: | set -e mkdir build_tar && cd build_tar - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DCMAKE_SYSTEM_NAME="Darwin" make make package cd .. From 8ab3029cf7e8afc932a70a5a824fd88638b43175 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 20 Jun 2023 14:42:28 +0200 Subject: [PATCH 41/86] cmake: Handle conflict between generated .deb and Debian package Update the generated .deb's metadata to enforce that it cannot be installed alongside the version of libiio shipped in the Debian repositories. Fixes #923. Signed-off-by: Paul Cercueil --- cmake/LinuxPackaging.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index a3f787628..30b76794f 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -137,4 +137,14 @@ if(${CMAKE_MAJOR_VERSION} LESS 3) OUTPUT_STRIP_TRAILING_WHITESPACE) ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) endif() + +# Make sure the generated .deb cannot be installed alongside the Debian ones +set(CPACK_DEBIAN_PACKAGE_PROVIDES + "libiio0 (= ${LIBIIO_VERSION}), " + "libiio-dev (= ${LIBIIO_VERSION}), " + "libiio-utils (= ${LIBIIO_VERSION}), " + "iiod (= ${LIBIIO_VERSION})") +set(CPACK_DEBIAN_PACKAGE_CONFLICTS "libiio0, libiio-dev, libiio-utils, iiod") +set(CPACK_DEBIAN_PACKAGE_REPLACES "libiio0, libiio-dev, libiio-utils, iiod") + include(CPack) From cb3bcf6220f52bbc99c3d1fe41681946d5f38a4b Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 21 Jun 2023 15:55:27 +0200 Subject: [PATCH 42/86] cmake: Fix invalid Provides: field in Debian packages CMake doesn't really like multi-line strings and considers it as a semicolon-separated list. Signed-off-by: Paul Cercueil --- cmake/LinuxPackaging.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index 30b76794f..d70cee9c4 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -140,10 +140,8 @@ endif() # Make sure the generated .deb cannot be installed alongside the Debian ones set(CPACK_DEBIAN_PACKAGE_PROVIDES - "libiio0 (= ${LIBIIO_VERSION}), " - "libiio-dev (= ${LIBIIO_VERSION}), " - "libiio-utils (= ${LIBIIO_VERSION}), " - "iiod (= ${LIBIIO_VERSION})") + "libiio0 (= ${LIBIIO_VERSION}), libiio-dev (= ${LIBIIO_VERSION}), libiio-utils (= ${LIBIIO_VERSION}), iiod (= ${LIBIIO_VERSION})" +) set(CPACK_DEBIAN_PACKAGE_CONFLICTS "libiio0, libiio-dev, libiio-utils, iiod") set(CPACK_DEBIAN_PACKAGE_REPLACES "libiio0, libiio-dev, libiio-utils, iiod") From 1032c8275ad415309c281d9640087f5dfd95c850 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 21 Jun 2023 11:09:12 -0400 Subject: [PATCH 43/86] README_BUILD: Add LOG_LEVEL to the doc LOG_LEVEL was not in the doc, so add it. Signed-off-by: Robin Getz --- README_BUILD.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README_BUILD.md b/README_BUILD.md index 7080b54ea..ff97f523f 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -81,6 +81,19 @@ Cmake Options | Default | Description | `WITH_NETWORK_GET_BUFFER` | OFF | Enable experimental zero-copy transfers | `WITH_ZSTD` | OFF | Support for ZSTD compressed metadata | +Developer options, which either increases verbosity, or decreases size. It can +be useful to keep track of things when you are developing with libiio to print +out warnings, to better understand what is going on. Most users should leave it +at 'Error' and Embedded Developers are free to set it to 'NoLog' to save space. +this is invoked as "-DLOG_LEVEL=Debug". + +Cmake Options | Default | Description | +----------------- | ------- | ---------------------------------------------- | + | | NoLog : Remove all warning/error messages | +LOG_LEVEL | | Error : Print errors only | + | | Warning : Print warnings and errors | + | Info | Info : Print info, warnings and errors | + | | Debug : Print debug/info/warnings/errors (very verbose) | Options which effect iiod only. These are only available on Linux. From 2a361bc049149852bd19d5502542d2c5190ba70c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 22 Jun 2023 14:42:19 +0200 Subject: [PATCH 44/86] README_BUILD.md: Fix Github not displaying array properly Github was getting confused as it thought some rows had two cells and others had three. Signed-off-by: Paul Cercueil --- README_BUILD.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README_BUILD.md b/README_BUILD.md index ff97f523f..5ab81bad6 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -89,11 +89,11 @@ this is invoked as "-DLOG_LEVEL=Debug". Cmake Options | Default | Description | ----------------- | ------- | ---------------------------------------------- | - | | NoLog : Remove all warning/error messages | -LOG_LEVEL | | Error : Print errors only | - | | Warning : Print warnings and errors | - | Info | Info : Print info, warnings and errors | - | | Debug : Print debug/info/warnings/errors (very verbose) | +| | | NoLog : Remove all warning/error messages | +|`LOG_LEVEL` | | Error : Print errors only | +| | | Warning : Print warnings and errors | +| | Info | Info : Print info, warnings and errors | +| | | Debug : Print debug/info/warnings/errors (very verbose) | Options which effect iiod only. These are only available on Linux. From 5116cc0aa2753e840cc14d72691c9a6a5922e9e1 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 20 Jun 2023 14:53:52 +0200 Subject: [PATCH 45/86] codespell: ignore 'mis' Otherwise Codespell fails when processing the examples. Signed-off-by: Paul Cercueil --- .codespell-ignore.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.codespell-ignore.txt b/.codespell-ignore.txt index 67e412814..ce3d55bf9 100644 --- a/.codespell-ignore.txt +++ b/.codespell-ignore.txt @@ -1,6 +1,7 @@ SOM som mitre +mis tread elease tREAD From 7ed5ed7e1f9e80e02520aa60ccc1f68644975826 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 13 May 2023 16:47:32 -0400 Subject: [PATCH 46/86] packaging: update DEB_DETECT_DEPENDENCIES when things moved from travis-ci to azure, some packaging options were lost. Specifically DEB_DETECT_DEPENDENCIES for debian based systems. This ensures that the version numbers from the host systems are put in the deb files so that things are actually compatible with the downstream systems. This patch removes the option, and makes it the default behavior, and makes RPM based systems do the same. basically - fixing issues that weren't seen over the last 3 years while this was turned off. Signed-off-by: Robin Getz --- cmake/LinuxPackaging.cmake | 274 +++++++++++++++++++++++++------------ 1 file changed, 184 insertions(+), 90 deletions(-) diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index d70cee9c4..750e13772 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -1,12 +1,47 @@ # support creating some basic binpkgs via `make package` set(CPACK_SET_DESTDIR ON) -set(CPACK_GENERATOR TGZ;DEB) +set(CPACK_GENERATOR TGZ) -FIND_PROGRAM(RPMBUILD_CMD rpmbuild) -if (RPMBUILD_CMD) - set(CPACK_PACKAGE_RELOCATABLE OFF) +# Top level settings +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) +set(CPACK_PACKAGE_VERSION_MAJOR ${LIBIIO_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${LIBIIO_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_GIT}) +set(CPACK_BUNDLE_NAME libiio) +set(CPACK_PACKAGE_VERSION ${LIBIIO_VERSION}) + +# Determine the distribution we are on +file(STRINGS /etc/os-release distro REGEX "^NAME=") +string(REGEX REPLACE "NAME=\"(.*)\"" "\\1" distro "${distro}") +file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=") +string(REGEX REPLACE "VERSION_ID=\"(.*)\"" "\\1" disversion "${disversion}") + +if(distro MATCHES "\\.*Ubuntu\\.*") + set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) +elseif (distro MATCHES "\\.*Debian\\.*") + set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) +elseif (distro MATCHES "\\.*Fedora\\.*") + set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) +elseif (distro MATCHES "\\.*CentOS\\.*") set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) - set(CPACK_RPM_PACKAGE_REQUIRES "libaio >= 0.3.107, avahi >= 0.6.25, libusb1 >= 1.0.9, libxml2 >= 2.7.6") +elseif (distro MATCHES "\\.*SUSE\\.*") + set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) +else() + message(STATUS "found unknown distribution ${distro}, Version : ${disversion}") + message(FATAL_ERROR "please report an error to https:\\/\\/github.com\\/analogdevicesinc\\/libiio\\/issues") +endif() + +if (CPACK_GENERATOR MATCHES "RPM") + FIND_PROGRAM(RPMBUILD rpmbuild) + FIND_PROGRAM(RPM_CMD rpm) + set(CPACK_PACKAGE_RELOCATABLE OFF) + if (NOT RPMBUILD) + message (FATAL_ERROR "To build packages, please install rpmbuild") + elseif(NOT RPM_CMD) + message(STATUS "assuming default package versions") + else() + message(STATUS "querying ${RPM_CMD} for package dependencies") + endif() # Add these for CentOS 7 set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION @@ -21,121 +56,180 @@ if (RPMBUILD_CMD) ) endif() -set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) -set(CPACK_PACKAGE_VERSION_MAJOR ${LIBIIO_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${LIBIIO_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_GIT}) -set(CPACK_BUNDLE_NAME libiio) -set(CPACK_PACKAGE_VERSION ${LIBIIO_VERSION}) -# debian specific package settings -set(CPACK_PACKAGE_CONTACT "Engineerzone ") - -option(DEB_DETECT_DEPENDENCIES "Detect dependencies for .deb packages" OFF) - # if we are going to be looking for things, make sure we have the utilities -if(DEB_DETECT_DEPENDENCIES) +if(CPACK_GENERATOR MATCHES "DEB") FIND_PROGRAM(DPKG_CMD dpkg) FIND_PROGRAM(DPKGQ_CMD dpkg-query) + if (NOT DPKG_CMD) + message (FATAL_ERROR "To build packages, please install dpkg") + elseif (NOT DPKGQ_CMD) + message(STATUS "assuming default package versions") + else() + message(STATUS "querying ${DPKGQ_CMD} for package dependencies") + endif() + # debian specific package settings + set(CPACK_PACKAGE_CONTACT "Engineerzone ") endif() -# if we want to, and have the capabilities find what is needed, -# based on what backends are turned on and what libraries are installed -if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) - message(STATUS "querying installed packages on system for dependencies") - execute_process(COMMAND "${DPKG_CMD}" --print-architecture +if(NOT CMAKE_CROSSCOMPILING) + execute_process(COMMAND "${DPKG_CMD}" --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) - # don't add a package dependency if it is not installed locally - # these should be the debian package names +else() + message(FATAL_ERROR "package building with cross compile not handled - please -DENABLE_PACKAGING=OFF") +endif() + +# don't add a package dependency if it is not installed locally +# these should be the debian package names +if (CPACK_GENERATOR MATCHES "DEB") set(PACKAGES "libc6") - if (WITH_LOCAL_BACKEND) - set(PACKAGES "${PACKAGES} libaio") + set(DEFAULT_DEB "libc6 (>= 2.17), ") +elseif(CPACK_GENERATOR MATCHES "RPM") + set(PACKAGES "glibc") + set(DEFAULT_RPM "glibc >=2.17, ") +endif() + +if (WITH_ZSTD) + set(PACKAGES "${PACKAGES} libzstd") + if (CPACK_GENERATOR MATCHES "DEB") + set(DEFAULT_DEB "${DEFAULT_DEB}libzstd (>= 1.5.0), ") + elseif (CPACK_GENERATOR MATCHES "RPM") + set(DEFAULT_RPM "${DEFAULT_RPM}libzstd >= 1.5.0, ") + endif() +endif() +# libpthread.so is provided by libc6, so don't check NEED_THREADS +if (WITH_LOCAL_BACKEND) + set(PACKAGES "${PACKAGES} libaio") + if (CPACK_GENERATOR MATCHES "DEB") + set(DEFAULT_DEB "${DEFAULT_DEB}libaio (>= 0.3.109), ") + elseif(CPACK_GENERATOR MATCHES "RPM") + set(DEFAULT_RPM "${DEFAULT_RPM}libaio >=0.3.109, ") endif() - if(HAVE_AVAHI) + # librt.so is provided by libc6 which is already included +endif() +if(HAVE_AVAHI) + if (CPACK_GENERATOR MATCHES "DEB") set(PACKAGES "${PACKAGES} libavahi-client libavahi-common") + set(DEFAULT_DEB "${DEFAULT_DEB}libavahi-client3 (>= 0.6.31), libavahi-common3 (>= 0.6.31), ") + elseif(CPACK_GENERATOR MATCHES "RPM") + set(PACKAGES "${PACKAGES} avahi") + set(DEFAULT_RPM "${DEFAULT_RPM}avahi >= 0.6.31, avahi-libs >= 0.6.31, ") endif() - if(WITH_USB_BACKEND) +endif() +if(WITH_USB_BACKEND) + if (CPACK_GENERATOR MATCHES "DEB") set(PACKAGES "${PACKAGES} libusb-1") + set(DEFAULT_DEB "${DEFAULT_DEB}libusb-1 (<2:1.0.5), ") + elseif(CPACK_GENERATOR MATCHES "RPM") + set(PACKAGES "${PACKAGES} libusb") + set(DEFAULT_RPM "${DEFAULT_RPM}libuse>= 0.1.5, ") endif() - if(WITH_XML_BACKEND) - set(PACKAGES "${PACKAGES} libxml2") - endif() - if(WITH_SERIAL_BACKEND) +endif() +if(WITH_XML_BACKEND) + set(PACKAGES "${PACKAGES} libxml2") + if (CPACK_GENERATOR MATCHES "DEB") + set(DEFAULT_DEB "${DEFAULT_DEB}libxml2 (>= 2.9.4), ") + elseif (CPACK_GENERATOR MATCHES "RPM") + set(DEFAULT_RPM "${DEFAULT_RPM}libxml2 >= 2.9.4, ") + endif() +endif() +if(WITH_SERIAL_BACKEND) + if (CPACK_GENERATOR MATCHES "DEB") set(PACKAGES "${PACKAGES} libserialport0") + set(DEFAULT_DEB "${DEFAULT_DEB}libserialport0 (>= 0.1.1), ") + else() + set(PACKAGES "${PACKAGES} libserialport") + set(DEFAULT_RPM "${DEFAULT_RPM}libserialport >= 0.1.1, ") endif() - # find the version of the installed package, which is hard to do in - # cmake first, turn the list into an list (separated by semicolons) - string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES}) - # then iterate over each - foreach(package ${PACKAGES}) - # List packages matching given pattern ${package}, - # key is the glob (*) at the end of the ${package} name, - # so we don't need to be so specific +endif() + +# find the version of the installed package, which is hard to do in +# cmake first, turn the list into a list (separated by semicolons) +string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES}) +# then iterate over each +foreach(package ${PACKAGES}) + # List packages matching given pattern ${package}, + # key is the glob (*) at the end of the ${package} name, + # so we don't need to be so specific + if (CPACK_GENERATOR MATCHES "DEB" AND DPKG_CMD) execute_process(COMMAND "${DPKG_CMD}" -l ${package}* OUTPUT_VARIABLE DPKG_PACKAGES) # returns a string, in a format: # ii libxml2:amd64 2.9.4+dfsg1- amd64 GNOME XML library # 'ii' means installed - which is what we are looking for - STRING(REGEX MATCHALL "ii ${package}[a-z0-9A-Z.-]*" + STRING(REGEX MATCHALL "ii ${package}[a-z0-9A-Z.-]*:${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" DPKG_INSTALLED_PACKAGES ${DPKG_PACKAGES}) # get rid of the 'ii', and split things up, so we can look # at the name STRING(REGEX REPLACE "ii " ";" NAME_INSTALLED_PACKAGES ${DPKG_INSTALLED_PACKAGES}) - foreach(match ${NAME_INSTALLED_PACKAGES}) - # ignore packages marked as dev, debug, - # documentations, or utils - STRING(REGEX MATCHALL "dev|dbg|doc|utils" TEMP_TEST - ${match}) + elseif (CPACK_GENERATOR MATCHES "RPM" AND RPM_CMD) + execute_process(COMMAND "${RPM_CMD}" -qa --qf "%{n};" "${package}*" + OUTPUT_VARIABLE NAME_INSTALLED_PACKAGES) + else() + set(NAME_INSTALLED_PACKAGES ${package}) + endif() + list(REMOVE_DUPLICATES NAME_INSTALLED_PACKAGES) + string(STRIP "${NAME_INSTALLED_PACKAGES}" NAME_INSTALLED_PACKAGES) + if (NAME_INSTALLED_PACKAGES STREQUAL "") + message(FATAL_ERROR "could not find ${package} installed") + endif() + foreach(match ${NAME_INSTALLED_PACKAGES}) + # ignore packages marked as dev, debug, + # documentations, utils, data or cross + STRING(REGEX MATCHALL "-dev|-dbg|-doc|-lang|-extra|-data|-utils|-cross|-plugins|-python|-headers|-gobject|-locale|-tools|glibc-common|libusbmuxd|libusbx" TEMP_TEST + ${match}) + if(NOT "${TEMP_TEST}" STREQUAL "") + continue() + endif() + if (CPACK_GENERATOR MATCHES "DEB" AND DPKGQ_CMD) + # find the actual version, executes: + # dpkg-query --showformat='\${Version}' + # --show libusb-1.0-0 + execute_process(COMMAND "${DPKGQ_CMD}" + --showformat='\${Version}' + --show "${match}" + OUTPUT_VARIABLE DPKGQ_VER) + # debian standard is package_ver-debian_ver, + # "'2.9.4+dfsg1-2.1'" + # ignore patches and debian suffix version, and + # remove single quote + string(REGEX REPLACE "[+-][a-z0-9A-Z.]*" "" DPKGQ_VER ${DPKGQ_VER}) + string(REGEX REPLACE "'" "" DPKGQ_VER ${DPKGQ_VER}) + # build the string for the Debian dependency + STRING(REGEX REPLACE ":.*" "" TEMP_TEST ${match}) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" + "${TEMP_TEST} (>= ${DPKGQ_VER}), ") + elseif (CPACK_GENERATOR MATCHES "RPM" AND RPM_CMD) + # find the actual version, executes: + # rpm -qp --queryformat '%{VERSION}' libusb1 + execute_process(COMMAND "${RPM_CMD}" -q --queryformat '%{VERSION}' ${match} + OUTPUT_VARIABLE RPM_VER) + STRING(REGEX REPLACE "'" "" RPM_VER ${RPM_VER}) + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}" + "${match} >= ${RPM_VER}, ") + endif() if("${TEMP_TEST}" STREQUAL "") - # find the actual version, executes: - # dpkg-query --showformat='\${Version}' - # --show libusb-1.0-0 - execute_process(COMMAND "${DPKGQ_CMD}" - --showformat='\${Version}' - --show "${match}" - OUTPUT_VARIABLE DPKGQ_VER) - # debian standard is package_ver-debian_ver, - # "'2.9.4+dfsg1-2.1'" - # ignore patches and debian suffix version, and - # remove single quote - string(REGEX REPLACE "[+-][a-z0-9A-Z.]*" "" - DPKGQ_VER ${DPKGQ_VER}) - string(REGEX REPLACE "'" "" DPKGQ_VER - ${DPKGQ_VER}) - # build the string for the Debian dependency - set(CPACK_DEBIAN_PACKAGE_DEPENDS - "${CPACK_DEBIAN_PACKAGE_DEPENDS}" - "${match} (>= ${DPKGQ_VER}), ") + continue() endif() - endforeach(match) - endforeach(package) + endforeach(match) +endforeach(package) + +if (CPACK_GENERATOR MATCHES "DEB") + if (NOT DPKGQ_CMD) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${DEFAULT_DEB}") + endif() # remove the dangling end comma string(REGEX REPLACE ", $" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -else() - # assume everything is turned on, and running on a modern OS - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaio1 (>= 0.3.109), libavahi-client3 (>= 0.6.31), libavahi-common3 (>= 0.6.31), libavahi-common-data (>= 0.6.31), libc6 (>= 2.19), libusb-1.0-0 (>= 2:1.0.17), libxml2 (>= 2.9.1), libserialport0 (>=0.1.1)") - message(STATUS "Using default dependencies for packaging") -endif() - -message(STATUS "Package dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -if (CPACK_RPM_PACKAGE_REQUIRES) - message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES}) -endif() - -if(${CMAKE_MAJOR_VERSION} LESS 3) - # old versions of cmake dont include this, but the same vintage of dpkg requires it - IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) - FIND_PROGRAM(DPKG_CMD dpkg) - IF(NOT DPKG_CMD) - MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") - SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) - ENDIF(NOT DPKG_CMD) - EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture - OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) - ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) + message(STATUS "Dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS}) +elseif (CPACK_GENERATOR MATCHES "RPM") + if (NOT RPM_CMD) + set(CPACK_RPM_PACKAGE_REQUIRES "${DEFAULT_RPM}") + endif() + string(REGEX REPLACE ", $" "" CPACK_RPM_PACKAGE_REQUIRES + ${CPACK_RPM_PACKAGE_REQUIRES}) + message(STATUS "Dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES}) endif() # Make sure the generated .deb cannot be installed alongside the Debian ones From 41d14d4373d8452416e560ecd0e55108dcc68395 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 10 Jun 2023 21:25:17 -0400 Subject: [PATCH 47/86] update packaging: add requirements into debian tar.gz files When using the tar balls - it's problematic sometime, since we don't include the required libraries that are needed to run, and have no way to communicate these to a end user (like a deb or rpm does). This fixes that by adding a "required2tar" target which can be run after "make package", which fixes this problem, by adding the required libraries to the tar ball, just like we do for the windows zip file. Signed-off-by: Robin Getz --- CI/azure/ci-ubuntu.sh | 1 + azure-pipelines.yml | 1 + cmake/LinuxPackaging.cmake | 39 ++++++++++++++++++ cmake/add_requirements2tar.sh.in | 69 ++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 cmake/add_requirements2tar.sh.in diff --git a/CI/azure/ci-ubuntu.sh b/CI/azure/ci-ubuntu.sh index 25ccea0b1..f7fce9340 100644 --- a/CI/azure/ci-ubuntu.sh +++ b/CI/azure/ci-ubuntu.sh @@ -6,3 +6,4 @@ mkdir build && cd build cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}" make make package +make required2tar diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4e1bddc28..e39eeb035 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -73,6 +73,7 @@ stages: fi make make package + make required2tar displayName: 'Build' - task: CopyFiles@2 inputs: diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index 750e13772..396b391f9 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -10,6 +10,10 @@ set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_GIT}) set(CPACK_BUNDLE_NAME libiio) set(CPACK_PACKAGE_VERSION ${LIBIIO_VERSION}) +# Start with empty file +set(REQUIRES "${CMAKE_BINARY_DIR}/require_manifest.txt") +file(WRITE ${REQUIRES} "") + # Determine the distribution we are on file(STRINGS /etc/os-release distro REGEX "^NAME=") string(REGEX REPLACE "NAME=\"(.*)\"" "\\1" distro "${distro}") @@ -209,12 +213,47 @@ foreach(package ${PACKAGES}) set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}" "${match} >= ${RPM_VER}, ") endif() + # find the actual so files + STRING(REGEX MATCHALL "libc6|glibc" TEMP_TEST ${match}) + if(NOT "${TEMP_TEST}" STREQUAL "") + continue() + endif() + if (CPACK_GENERATOR MATCHES "DEB" AND DPKG_CMD) + # build up the so locations + execute_process(COMMAND "${DPKG_CMD}" + -L "${match}" + OUTPUT_VARIABLE DPK_RESULT) + elseif (CPACK_GENERATOR MATCHES "RPM" AND RPM_CMD) + execute_process(COMMAND "${RPM_CMD}" -ql ${match} + OUTPUT_VARIABLE DPK_RESULT) + else() + continue() + endif() + STRING(STRIP ${DPK_RESULT} STRIPPED) + STRING(REGEX REPLACE "[\r\n]" ";" POSSIBLE_SO "${STRIPPED}") + foreach(is_so ${POSSIBLE_SO}) + # match with ".so." or ".so" (and the end) + STRING(REGEX MATCHALL "\\.so$|\\.so\\." TEMP_TEST ${is_so}) if("${TEMP_TEST}" STREQUAL "") continue() endif() + if(IS_SYMLINK ${is_so}) + continue() + endif() + file(APPEND ${REQUIRES} "${is_so}\n") + endforeach(is_so) endforeach(match) endforeach(package) +configure_file( "${CMAKE_SOURCE_DIR}/cmake/add_requirements2tar.sh.in" + "${CMAKE_BINARY_DIR}/add_requirements2tar.sh" + IMMEDIATE @ONLY + ) +add_custom_target(required2tar + COMMAND sh ${CMAKE_BINARY_DIR}/add_requirements2tar.sh + COMMENT "Adding requirements to tarball" + ) + if (CPACK_GENERATOR MATCHES "DEB") if (NOT DPKGQ_CMD) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${DEFAULT_DEB}") diff --git a/cmake/add_requirements2tar.sh.in b/cmake/add_requirements2tar.sh.in new file mode 100644 index 000000000..848a13bed --- /dev/null +++ b/cmake/add_requirements2tar.sh.in @@ -0,0 +1,69 @@ +#!/bin/sh +# should be called from "make required2tar" +set -e + +cd @CMAKE_BINARY_DIR@ + +manifest=./require_manifest.txt +if [ ! -f ${manifest} ] ; then + echo "Can not find manifest at ${manifest}" + exit 1 +fi + +gz=$(ls ./libiio*.tar.gz) +if [ -z "${gz}" ] ; then + echo "try make package first" + exit 1 +fi +if [ "$(echo -n ${gz} | tr -cd ' \t' | wc -c)" -ne "0" ] ; then + echo "too many tar, there should be only one, but found ${gz}" + exit 1 +fi +tar=$(echo ${gz} | sed 's/\.gz$//') + +#unzip the file (can not append while it is gzipped) +#gunzip ${gz} + +# We should be able to just "tar --append -f ${tar} -T manufest.txt, but the tar on +# CenrOS7 doesn't support that - so we we need to split it apart, and add +# files manually. + +if [ -d tarball_fixup ] ; then + rm -rf tarball_fixup +fi +mkdir tarball_fixup +tar -xzf ${gz} -C ./tarball_fixup + +while read -r line +do + if [ -f ${line} ] ; then + echo "adding ${line} to architve" + #make sure the directory exists as a target + mkdir -p ./tarball_fixup$(dirname ${line}) + cp ${line} ./tarball_fixup${line} + + cd ./tarball_fixup$(dirname ${line}) + line=$(basename ${line}) + + until echo ${line} | grep -q \.so.[0-9]*$ + do + tmp=$(echo ${line} | sed 's/\.[0-9]*$//') + if [ ! -f "${tmp}" ] ; then + ln -s ${line} ${tmp} + else + echo "target ${tmp} already exists" + ls -l ${tmp} + fi + line=${tmp} + done + cd @CMAKE_BINARY_DIR@ + + else + echo "could not find ${line} to copy" + exit 1 + fi +done < ${manifest} + +tar -czf ${gz} -C ./tarball_fixup/ . +rm -rf tarball_fixup + From ad199c63b0cf2e0fcfde001f118b0d610dcd1fb3 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 22 Jun 2023 15:50:27 +0200 Subject: [PATCH 48/86] IIOD: Better handle errors of iio_buffer_{refill,push} Pass the error code to the connected clients, instead of disconnecting them. This means that for a very slow device, a connected client will simply get a -ETIMEDOUT error when a configured timeout expires, and will still be able to communicate with the server. Fixes: #981. Signed-off-by: Paul Cercueil --- iiod/ops.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/iiod/ops.c b/iiod/ops.c index 4184872f3..07c6c6f09 100644 --- a/iiod/ops.c +++ b/iiod/ops.c @@ -678,9 +678,22 @@ static void rw_thd(struct thread_pool *pool, void *d) } if (ret < 0) { - IIO_ERROR("Reading from device failed: %i\n", - (int) ret); - break; + /* Reading from the device failed - signal the + * error to all connected clients. */ + + /* Don't use SLIST_FOREACH - see comment below */ + for (thd = SLIST_FIRST(&entry->thdlist_head); + thd; thd = next_thd) { + next_thd = SLIST_NEXT(thd, dev_list_entry); + + if (!thd->active || thd->is_writer) + continue; + + signal_thread(thd, ret); + } + + pthread_mutex_unlock(&entry->thdlist_lock); + continue; } nb_bytes = ret; @@ -750,18 +763,18 @@ static void rw_thd(struct thread_pool *pool, void *d) pthread_mutex_unlock(&entry->thdlist_lock); continue; } - if (ret < 0) { - IIO_ERROR("Writing to device failed: %i\n", - (int) ret); - break; - } /* Signal threads which completed their RW command */ for (thd = SLIST_FIRST(&entry->thdlist_head); thd; thd = next_thd) { next_thd = SLIST_NEXT(thd, dev_list_entry); - if (thd->active && thd->is_writer && - thd->nb < sample_size) + + if (!thd->active || !thd->is_writer) + continue; + + if (ret < 0) + signal_thread(thd, ret); + else if (thd->nb < sample_size) signal_thread(thd, thd->nb); } From 28e1b304bc3e10cec7d2aa70e1de2eb60dc68bb6 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 3 Jul 2023 09:19:30 +0200 Subject: [PATCH 49/86] CMake: Find libusb include dir using pkg-config Prior to this, only the library was discovered using pkg-config, while the header was searched manually. This caused troubles on the CI when building for OSX, as it would succeed to find the library but not the header file. Now, the manual search is now performed only when pkg-config cannot locate a libusb package; which is what was already done for the library file itself. Signed-off-by: Paul Cercueil --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f53fe17e0..e286905df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,11 +156,12 @@ if (WITH_USB_BACKEND) if (NOT LIBUSB_FOUND) #Handle FreeBSD libusb and Linux libusb-1.0 libraries find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb) + find_path(LIBUSB_INCLUDE_DIR libusb.h PATH_SUFFIXES libusb-1.0) else() set(LIBUSB_LIBRARIES ${LIBUSB_LINK_LIBRARIES}) + set(LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIRS}) endif() endif() - find_path(LIBUSB_INCLUDE_DIR libusb.h PATH_SUFFIXES libusb-1.0) if (NOT LIBUSB_LIBRARIES OR NOT LIBUSB_INCLUDE_DIR) message(SEND_ERROR "Unable to find libusb-1.0 dependency.\n" "If you want to disable the USB backend, set WITH_USB_BACKEND=OFF.") From 25714d1ffcdb6f503d6a1de1d6c4f88549e81c5e Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Fri, 23 Jun 2023 10:42:11 +0300 Subject: [PATCH 50/86] network: fix snprintf format string for MinGW MinGW build fail on unsigned int argument because long unsigned int is expected. Signed-off-by: Raluca Groza --- network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network.c b/network.c index 511322adb..cabc6fa2c 100644 --- a/network.c +++ b/network.c @@ -320,7 +320,7 @@ static char * network_get_description(struct addrinfo *res) if (errno == 0) { /* Windows uses numerical interface identifiers */ ptr = description + strnlen(description, len) + 1; - iio_snprintf(ptr, IF_NAMESIZE, "%u", in->sin6_scope_id); + iio_snprintf(ptr, IF_NAMESIZE, "%u", (unsigned int)in->sin6_scope_id); } else #endif { From 9cc2e10f6ec165a594d4780887f99362740c8ad0 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Fri, 23 Jun 2023 10:43:12 +0300 Subject: [PATCH 51/86] CI:add MinGW build Add MinGW build and modify related files to add artifacts to SwDownloads and GitHub release. Signed-off-by: Raluca Groza --- CI/azure/{zip.txt => README.txt} | 11 ++--- CI/azure/prepare_assets.sh | 21 +++++++-- CI/build_win.ps1 | 3 +- CI/publish_deps.ps1 | 38 ++++++++++------ artifact_manifest.txt.cmakein | 20 ++++++++ azure-pipelines.yml | 78 ++++++++++++++++++++++++++++++++ 6 files changed, 148 insertions(+), 23 deletions(-) rename CI/azure/{zip.txt => README.txt} (86%) diff --git a/CI/azure/zip.txt b/CI/azure/README.txt similarity index 86% rename from CI/azure/zip.txt rename to CI/azure/README.txt index 042735739..b67369afc 100644 --- a/CI/azure/zip.txt +++ b/CI/azure/README.txt @@ -7,17 +7,16 @@ In this archive, you should find the following directories: o ./include : Common include files -o ./MinGW32 : 32-bit binaries compiled by the MinGW toolchain -o ./MinGW64 : 64-bit binaries compiled by the MinGW toolchain -o ./MS32 : 32-bit binaries compiled by the MicroSoft toolchain -o ./MS64 : 364bit binaries compiled by the MicroSoft toolchain +o ./Windows-MinGW-W64 : 64-bit binaries compiled by the MinGW toolchain +o ./Windows-VS-2019-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2019 +o ./Windows-VS-2022-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2022 o Visual Studio: - Open existing or create a new project for your application - Copy iio.h, from the include\ directory, into your project and make sure that the location where the file reside appears in the 'Additional Include Directories' section (Configuration Properties -> C/C++ -> General). - - Copy the relevant .lib file from MS32\ or MS64\ and add 'libiio.lib' to + - Copy the relevant .lib file from Windows-VS-2019-x64\ or Windows-VS-2022-x64\ and add 'libiio.lib' to your 'Additional Dependencies' (Configuration Properties -> Linker -> Input) Also make sure that the directory where libiio.lib resides is added to 'Additional Library Directories' (Configuration Properties -> Linker @@ -44,7 +43,7 @@ o WDK/DDK: SOURCES=your_app.c o MinGW/cygwin - - Copy libiio.h, from include/ to your default include directory, + - Copy iio.h, from include/ to your default include directory, and copy the MinGW32/ or MinGW64/ .a files to your default library directory. Or, if you don't want to use the default locations, make sure that you feed the relevant -I and -L options to the compiler. diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh index 18912d024..a32ef7959 100755 --- a/CI/azure/prepare_assets.sh +++ b/CI/azure/prepare_assets.sh @@ -31,12 +31,23 @@ release_artifacts() { rm -r "${i}" done - local zip_assets='2019 2022' + local zip_assets='VS-2019-x64 VS-2022-x64 MinGW-W64' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" + mkdir Windows + cd Windows + mkdir include + cd .. + cp ./Windows-VS-2019-x64/iio.h ./Windows/include for i in $zip_assets; do - zip -r "Windows-VS-${i}-x64".zip "Windows-VS-${i}-x64" - rm -r "Windows-VS-${i}-x64" + rm ./"Windows-${i}"/iio.h + mv ./"Windows-${i}" Windows done + cp /home/vsts/work/1/s/CI/azure/README.txt ./Windows + cd Windows + zip Windows.zip ./* + cp ./Windows.zip ../ + cd .. + rm -r Windows local deb_arm_assets='arm32v7 arm64v8 ppc64le x390x' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" @@ -88,6 +99,10 @@ swdownloads_artifacts() { cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/Libiio-Setup-Exe" mv libiio-setup.exe ../libiio-setup.exe rm -r ../Libiio-Setup-Exe + + cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" + zip -r Windows-MinGW-W64-latest_master_libiio.zip Windows-MinGW-W64 + rm -r Windows-MinGW-W64 } check_artifacts() { diff --git a/CI/build_win.ps1 b/CI/build_win.ps1 index 2d35ceb19..34d04bc4f 100644 --- a/CI/build_win.ps1 +++ b/CI/build_win.ps1 @@ -3,6 +3,7 @@ $ErrorActionPreference = "Stop" $ErrorView = "NormalView" $COMPILER=$Env:COMPILER +$USE_CSHARP=$Env:USE_CSHARP $src_dir=$pwd echo "Running cmake for $COMPILER on 64 bit..." @@ -10,7 +11,7 @@ mkdir build-x64 cp .\libiio.iss.cmakein .\build-x64 cd build-x64 -cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. +cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=$USE_CSHARP -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. cmake --build . --config Release if ( $LASTEXITCODE -ne 0 ) { throw "[*] cmake build failure" diff --git a/CI/publish_deps.ps1 b/CI/publish_deps.ps1 index 76ec7955a..1ac02fb86 100644 --- a/CI/publish_deps.ps1 +++ b/CI/publish_deps.ps1 @@ -5,22 +5,34 @@ $ErrorView = "NormalView" $src_dir=$pwd $COMPILER=$Env:COMPILER -if ($COMPILER -eq "Visual Studio 16 2019") { - cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' - cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY - cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -}else { - cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' - cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY - cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} - cd $src_dir mkdir dependencies cd dependencies wget http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip -OutFile "libiio-win-deps.zip" 7z x -y "libiio-win-deps.zip" -cp .\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -cp .\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -cp .\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY +if ($COMPILER -eq "MinGW Makefiles") { + cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.2.8\mingw\bin\libgcc_s_seh-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libiconv-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\zlib1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\liblzma-5.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libwinpthread-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libxml2-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.2.8\mingw\bin\libstdc++-6.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + cp $src_dir\dependencies\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + + if ($COMPILER -eq "Visual Studio 16 2019") { + cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' + cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + } else { + cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' + cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + } +} diff --git a/artifact_manifest.txt.cmakein b/artifact_manifest.txt.cmakein index 9e296aac4..0d7427b20 100644 --- a/artifact_manifest.txt.cmakein +++ b/artifact_manifest.txt.cmakein @@ -83,3 +83,23 @@ Windows-VS-2022-x64/libusb-1.0.dll Windows-VS-2022-x64/libxml2.dll Windows-VS-2022-x64/msvcp140.dll Windows-VS-2022-x64/vcruntime140.dll + +Windows-MinGW--W64/iio.h +Windows-MinGW-W64/iio_attr.exe +Windows-MinGW-W64/iio_genxml.exe +Windows-MinGW-W64/iio_info.exe +Windows-MinGW-W64/iio_readdev.exe +Windows-MinGW-W64/iio_reg.exe +Windows-MinGW-W64/iio_writedev.exe +Windows-MinGW-W64/libgcc_s_seh-1.dll +Windows-MinGW-W64/libiconv-2.dll +Windows-MinGW-W64/libiio.dll +Windows-MinGW-W64/libiio.dll.a +Windows-MinGW-W64/liblzma-5.dll +Windows-MinGW-W64/libserialport-0.dll +Windows-MinGW-W64/libstdc++-6.dll +Windows-MinGW-W64/libusb-1.0.dll +Windows-MinGW-W64/libwinpthread-1.dll +Windows-MinGW-W64/libxml2-2.dll +Windows-MinGW-W64/zlib1.dll +Windows-MinGW-W64/libiio-py39-amd64.tar.gz diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e39eeb035..ee86d0e92 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -96,6 +96,82 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' + ############################################# + - job: MinGWBuilds + strategy: + matrix: + MinGW_W64: + COMPILER: 'MinGW Makefiles' + ARCH: 'x86_64' + USE_CSHARP: 'OFF' + artifactName: 'Windows-MinGW-W64' + pool: + vmImage: 'windows-2022' + steps: + - checkout: self + fetchDepth: 1 + clean: true + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + - task: PowerShell@2 + displayName: 'Dependencies' + inputs: + targetType: inline + script: | + git submodule update --init + if ( !( Test-Path deps ) ) { + mkdir deps + } + cd deps + mkdir libxml + wget https://www.zlatkovic.com/pub/libxml/64bit/libxml2-2.9.3-win32-x86_64.7z -OutFile "libxml.7z" + 7z x -y libxml.7z + rm libxml.7z + cd C:\ + wget http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip -OutFile "libiio-win-deps.zip" + 7z x -y "C:\libiio-win-deps.zip" + - task: PowerShell@2 + inputs: + targetType: 'filePath' + filePath: .\CI\build_win.ps1 + displayName: 'Build' + - task: CopyFiles@2 + displayName: 'Copy .exe files' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64/tests' + contents: '*.exe' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy iio.h header' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/' + contents: 'iio.h' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy libiio.dll and libiio.dll.a' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64' + contents: | + libiio.dll + libiio.dll.a + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy .tar.gz files' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64/bindings/python' + contents: '*.gz' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: PowerShell@2 + displayName: 'Copy dependencies' + inputs: + targetType: 'filePath' + filePath: .\CI\publish_deps.ps1 + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: '$(artifactName)' + ############################################# - job: WindowsBuilds # Host Box @@ -105,11 +181,13 @@ stages: vmImage: 'windows-2022' COMPILER: 'Visual Studio 17 2022' ARCH: 'x64' + USE_CSHARP: 'ON' artifactName: 'Windows-VS-2022-x64' VS2019: vmImage: 'windows-2019' COMPILER: 'Visual Studio 16 2019' ARCH: 'x64' + USE_CSHARP: 'ON' artifactName: 'Windows-VS-2019-x64' pool: vmImage: $[ variables['vmImage'] ] From 4b71f072abf0e21d868e2277f6be93165cbf3010 Mon Sep 17 00:00:00 2001 From: "Travis F. Collins" Date: Tue, 27 Jun 2023 12:05:26 -0600 Subject: [PATCH 52/86] Add rpathing and libusb updates for macOS CI Signed-off-by: Travis F. Collins --- CI/azure/macos_tar_fixup.sh | 71 +++++++++++++++++++++++++++++++++++++ CI/azure/prepare_assets.sh | 0 azure-pipelines.yml | 3 ++ 3 files changed, 74 insertions(+) create mode 100644 CI/azure/macos_tar_fixup.sh mode change 100755 => 100644 CI/azure/prepare_assets.sh diff --git a/CI/azure/macos_tar_fixup.sh b/CI/azure/macos_tar_fixup.sh new file mode 100644 index 000000000..3b4b30f84 --- /dev/null +++ b/CI/azure/macos_tar_fixup.sh @@ -0,0 +1,71 @@ +#!/bin/bash -xe + +# Extract tar.gz to temp folder +tarname=$(find . -maxdepth 1 -name '*.tar.gz') +if [ -z "${tarname}" ]; then + echo "tar.gz not found" + exit 1 +fi +# Remove .tar.gz from filename +subfoldername=$(echo "${tarname}" | rev | cut -b 8- | rev) + +mkdir -p temp_tar +tar -xzf "${tarname}" -C temp_tar +mv "temp_tar/${subfoldername}" temp +cd temp + +# Update rpath of library and tools +libusb_loc=$(find $(brew --cellar) -name libusb-1.0.dylib) +libxml_loc=$(find $(brew --cellar) -name libxml2.dylib) +libserialport_loc=$(find $(brew --cellar) -name libserialport.dylib) +libiio_loc=$(find . -name iio | grep Versions) +libiioheader_loc=$(find . -name iio.h) + +if [ ! -f "${libusb_loc}" ]; then + echo "libusb library not found" + exit 1 +fi +if [ ! -f "${libxml_loc}" ]; then + echo "libxml library not found" + exit 1 +fi +if [ ! -f "${libserialport_loc}" ]; then + echo "libserialport library not found" + exit 1 +fi + +# Create links to framework files +mkdir -p usr/local/{lib,include} +ln -fs "${libiio_loc}" usr/local/lib/libiio.dylib +ln -fs "${libiioheader_loc}" usr/local/include/iio.h + +# Copy dependent libs to local libs +cp "${libusb_loc}" usr/local/lib/ +cp "${libxml_loc}" usr/local/lib/ +cp "${libserialport_loc}" usr/local/lib/ +chmod +w usr/local/lib/libusb-1.0.dylib +chmod +w usr/local/lib/libxml2.dylib +chmod +w usr/local/lib/libserialport.dylib +install_name_tool -id @rpath/libusb-1.0.dylib usr/local/lib/libusb-1.0.dylib +install_name_tool -id @rpath/libxml2.dylib usr/local/lib/libxml2.dylib +install_name_tool -id @rpath/libserialport.dylib usr/local/lib/libserialport.dylib + +# Update rpath of library +install_name_tool -change "${libusb_loc}" "@rpath/libusb-1.0.dylib" "${libiio_loc}" +install_name_tool -change "${libxml_loc}" "@rpath/libxml2.dylib" "${libiio_loc}" +install_name_tool -change "${libserialport_loc}" "@rpath/libserialport.dylib" "${libiio_loc}" +install_name_tool -add_rpath @loader_path/. "${libiio_loc}" + +# Update tools +cd Library/Frameworks/iio.framework/Tools +for tool in *; +do + install_name_tool -add_rpath @loader_path/../.. "${tool}" +done +cd ../../../../ + +# Remove old tar and create new one +rm "../${tarname}" +tar -czf "../${tarname}" . +cd .. +rm -rf temp diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh old mode 100755 new mode 100644 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee86d0e92..95bf6481d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -321,6 +321,9 @@ stages: cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DCMAKE_SYSTEM_NAME="Darwin" make make package + mv ../CI/azure/macos_tar_fixup.sh . + chmod +x macos_tar_fixup.sh + ./macos_tar_fixup.sh cd .. displayName: 'Build tar' - script: | From 3346657f02993e2827368d815d8c9fde14ccc861 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Wed, 28 Jun 2023 12:10:21 +0300 Subject: [PATCH 53/86] CI: add macOS-13 arm64 build Signed-off-by: Raluca Groza --- azure-pipelines.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 95bf6481d..320269991 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -284,21 +284,36 @@ stages: strategy: matrix: macOS_11: + poolName: 'Azure Pipelines' vmImage: 'macOS-11' + agentName: 'Azure Pipelines 4' artifactName: 'macOS-11' macOS_12: + poolName: 'Azure Pipelines' vmImage: 'macOS-12' + agentName: 'Azure Pipelines 3' artifactName: 'macOS-12' - macOS_13: + macOS_13_x64: + poolName: 'Azure Pipelines' vmImage: 'macOS-13' - artifactName: 'macOS-13' + agentName: 'Azure Pipelines 2' + artifactName: 'macOS-13-x64' + macOS_13_arm64: + poolName: 'Default' + vmImage: + agentName: 'macOS_arm64' + artifactName: 'macOS-13-arm64' pool: - vmImage: $[ variables['vmImage'] ] + name: $(poolName) + vmImage: $(vmImage) + demands: + - agent.name -equals $(agentName) steps: - checkout: self fetchDepth: 1 clean: true - task: UsePythonVersion@0 + condition: ne(variables['agentName'],'macOS_arm64') inputs: versionSpec: '3.x' addToPath: true @@ -307,6 +322,7 @@ stages: brew install doxygen libusb libxml2 ncurses cdk libserialport sphinx-doc pkg-config pip3 install sphinx displayName: 'Dependencies' + condition: ne(variables['agentName'],'macOS_arm64') - script: | set -e mkdir build && cd build From baf2d391f2214c4b03d6699d2bb63c98dae73cc6 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Wed, 28 Jun 2023 12:11:23 +0300 Subject: [PATCH 54/86] tests/examples: Fix non-compliant function declarations A function declaration without a prototype is deprecated in all versions of C. Signed-off-by: Raluca Groza --- examples/ad9361-iiostream.c | 2 +- examples/ad9371-iiostream.c | 2 +- examples/adrv9009-iiostream.c | 2 +- examples/dummy-iiostream.c | 2 +- tests/gen_code.c | 2 +- tests/gen_code.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/ad9361-iiostream.c b/examples/ad9361-iiostream.c index d84222b2d..408e7e935 100644 --- a/examples/ad9361-iiostream.c +++ b/examples/ad9361-iiostream.c @@ -50,7 +50,7 @@ static struct iio_buffer *txbuf = NULL; static bool stop; /* cleanup and exit */ -static void shutdown() +static void shutdown(void) { printf("* Destroying buffers\n"); if (rxbuf) { iio_buffer_destroy(rxbuf); } diff --git a/examples/ad9371-iiostream.c b/examples/ad9371-iiostream.c index b8c5e857b..121f07745 100644 --- a/examples/ad9371-iiostream.c +++ b/examples/ad9371-iiostream.c @@ -48,7 +48,7 @@ static struct iio_buffer *txbuf = NULL; static bool stop; /* cleanup and exit */ -static void shutdown() +static void shutdown(void) { printf("* Destroying buffers\n"); if (rxbuf) { iio_buffer_destroy(rxbuf); } diff --git a/examples/adrv9009-iiostream.c b/examples/adrv9009-iiostream.c index 19f68973e..267dec69d 100644 --- a/examples/adrv9009-iiostream.c +++ b/examples/adrv9009-iiostream.c @@ -48,7 +48,7 @@ static struct iio_buffer *txbuf = NULL; static bool stop; /* cleanup and exit */ -static void shutdown() +static void shutdown(void) { printf("* Destroying buffers\n"); if (rxbuf) { iio_buffer_destroy(rxbuf); } diff --git a/examples/dummy-iiostream.c b/examples/dummy-iiostream.c index 031e00609..3eb7fce57 100644 --- a/examples/dummy-iiostream.c +++ b/examples/dummy-iiostream.c @@ -109,7 +109,7 @@ static bool stop; static bool has_repeat; /* cleanup and exit */ -static void shutdown() +static void shutdown(void) { int ret; diff --git a/tests/gen_code.c b/tests/gen_code.c index 2b7ce24d3..9f10bec42 100644 --- a/tests/gen_code.c +++ b/tests/gen_code.c @@ -171,7 +171,7 @@ void gen_context (const char *uri_in) } } -void gen_context_destroy() +void gen_context_destroy(void) { if (!fd) return; diff --git a/tests/gen_code.h b/tests/gen_code.h index 125404cbc..0e1d5d41c 100644 --- a/tests/gen_code.h +++ b/tests/gen_code.h @@ -13,7 +13,7 @@ void gen_start(const char *gen_file); bool gen_test_path(const char *gen_file); void gen_context (const char *uri); -void gen_context_destroy(); +void gen_context_destroy(void); void gen_context_attr(const char *key); void gen_dev(const struct iio_device *dev); void gen_ch(const struct iio_channel *ch); From 405204ec01930bd2a05fd1e47e054ff4be55f7f2 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Mon, 3 Jul 2023 11:46:16 +0300 Subject: [PATCH 55/86] CI: update artifacts Signed-off-by: Raluca Groza --- CI/azure/prepare_assets.sh | 4 ++-- README.md | 12 +++++++----- artifact_manifest.txt.cmakein | 6 ++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh index a32ef7959..a44295d20 100644 --- a/CI/azure/prepare_assets.sh +++ b/CI/azure/prepare_assets.sh @@ -14,7 +14,7 @@ release_artifacts() { rm -r "Linux-${i}" done - local pkg_assets='macOS-11 macOS-12' + local pkg_assets='macOS-11 macOS-12 macOS-13-x64 macOS-13-arm64' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" for i in $pkg_assets; do cd "${i}" @@ -73,7 +73,7 @@ swdownloads_artifacts() { rm -r ../Linux-"${distribution}" done - local macOS_dist='macOS-11 macOS-12' + local macOS_dist='macOS-11 macOS-12 macOS-13-x64 macOS-13-arm64' for distribution in $macOS_dist; do cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/${distribution}" find . -name '*.pkg' -exec mv {} ../"${distribution}_latest_master_libiio.pkg" ";" diff --git a/README.md b/README.md index 582a3bb9f..cbd91eb61 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,19 @@ As with many open source packages, we use [GitHub](https://github.com/analogdevi |:-----------------------:|:---------------------:|:-------:|:-------------------:|:--------------:| | Windows | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=WindowsBuilds&configuration=WindowsBuilds%20VS2019)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Windows-64 Server 2019 | [![Latest Windows installer](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/win_box.png)](https://swdownloads.analog.com/cse/azure_builds/libiio-setup.exe)
    [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=GenerateSetupExe)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | [![Latest Windows zip](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/win_box.png)](https://swdownloads.analog.com/cse/azure_builds/Windows-VS-2019-x64-latest_master_libiio.zip) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=WindowsBuilds&configuration=WindowsBuilds%20VS2022)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Windows-64 Server 2022 | (libiio-setup.exe works for both Windows Server 2019 and Windows Server 2022) | [![Latest Windows zip](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/win_box.png)](https://swdownloads.analog.com/cse/azure_builds/Windows-VS-2022-x64-latest_master_libiio.zip) | -| OS X | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=macOSBuilds&configuration=macOSBuilds%20macOS_12)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | macOS Monterey
    (v 12) | [![OS-X package 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.pkg) | [![OS-X tarball 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.tar.gz) | +| OS X | | macOS Ventura
    (v 13 x64) | [![OS-X package 13-x64](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-13-x64_latest_master_libiio.pkg) | [![OS-X tarball 13-x64](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-13-x64_latest_master_libiio.tar.gz) | +| | | macOS Ventura
    (v 13 arm64) | [![OS-X package 13-arm64](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-13-arm64_latest_master_libiio.pkg) | [![OS-X tarball 13-arm64](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-13-arm64_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=macOSBuilds&configuration=macOSBuilds%20macOS_12)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | macOS Monterey
    (v 12) | [![OS-X package 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.pkg) | [![OS-X tarball 12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-12_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=macOSBuilds&configuration=macOSBuilds%20macOS_11)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | macOS Big Sur
    (v 11) | [![OS-X package 11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-11_latest_master_libiio.pkg) | [![OS-X tarball 11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-11_latest_master_libiio.tar.gz) | | | Unsupported. Last artifacts from Sept 6, 2022 | macOS Catalina
    (v 10.15) | [![OS-X package 10.15](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-10.15_latest_master_libiio.pkg) | [![OS-X tarball 10.15](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](https://swdownloads.analog.com/cse/azure_builds/macOS-10.15_latest_master_libiio.tar.gz) | | Linux | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_22_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Jammy Jellyfish
    (v 22.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-22.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-22.04_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20ubuntu_20_04)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu Focal Fossa
    (v 20.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-20.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-20.04_latest_master_libiio.tar.gz) | | | Unsupported. Last artifact from Feb 22, 2023 | Ubuntu Bionic Beaver
    (v 18.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-18.04_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-18.04_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20fedora34)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Fedora 34 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-34_latest_master_libiio.tar.gz) | -| | | Fedora 28 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.tar.gz) | -| | | CentOS 7 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.tar.gz) | -| | | Debian Bullseye | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.tar.gz) | -| | | openSUSE 15.4 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status%2Fanalogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20fedora28)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master)| Fedora 28 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Fedora-28_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status%2Fanalogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20centos_7)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master)| CentOS 7 | [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.rpm) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/CentOS-7_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status%2Fanalogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20debian_bullseye)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master)| Debian Bullseye | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Debian-11_latest_master_libiio.tar.gz) | +| | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status%2Fanalogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=LinuxBuilds&configuration=LinuxBuilds%20opensuse_15_4)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master)| openSUSE 15.4 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/openSUSE-15.4_latest_master_libiio.tar.gz) | | ARM | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-ppc64le)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-ppc64le | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-ppc64le_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-ppc64le_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-x390x)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-x390x | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-x390x_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-x390x_latest_master_libiio.tar.gz) | | | [![Build Status](https://dev.azure.com/AnalogDevices/OpenSource/_apis/build/status/analogdevicesinc.libiio?branchName=master&stageName=Builds&jobName=ARMBuilds&configuration=ARMBuilds%20ubuntu-arm64v8)](https://dev.azure.com/AnalogDevices/OpenSource/_build/latest?definitionId=9&branchName=master) | Ubuntu-arm64v8 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm64v8_latest_master_libiio.deb) | [![Linux tarball](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](https://swdownloads.analog.com/cse/azure_builds/Ubuntu-arm64v8_latest_master_libiio.tar.gz) | diff --git a/artifact_manifest.txt.cmakein b/artifact_manifest.txt.cmakein index 0d7427b20..26ce54b1f 100644 --- a/artifact_manifest.txt.cmakein +++ b/artifact_manifest.txt.cmakein @@ -34,6 +34,12 @@ macOS-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg macOS-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-12.tar.gz macOS-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg +macOS-13-x64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-13-x64.tar.gz +macOS-13-x64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg + +macOS-13-arm64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-13-arm64.tar.gz +macOS-13-arm64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg + Ubuntu-arm32v7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm32v7.deb Ubuntu-arm32v7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm32v7.tar.gz From ee1d39c6ea0e33fb6c60d046f2d47a0261f3f7be Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Mon, 3 Jul 2023 14:49:42 +0300 Subject: [PATCH 56/86] CI: make file executable Signed-off-by: Raluca Groza --- CI/azure/prepare_assets.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 CI/azure/prepare_assets.sh diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh old mode 100644 new mode 100755 From eee8cba6f42177a094ebe16759606a719676fda7 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 3 Jul 2023 16:30:23 +0200 Subject: [PATCH 57/86] CMake: Bump version to v0.25 Bump the library version to v0.25 prior to the release. Signed-off-by: Paul Cercueil --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e286905df..310636421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ if (MINGW) endif() set(LIBIIO_VERSION_MAJOR 0) -set(LIBIIO_VERSION_MINOR 24) +set(LIBIIO_VERSION_MINOR 25) set(VERSION "${LIBIIO_VERSION_MAJOR}.${LIBIIO_VERSION_MINOR}") if (WIN32) string(TIMESTAMP BUILD_YEAR "%Y") From c34084e59d2412e42b991cb89a8649258fa016a3 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 4 Jul 2023 15:15:01 +0200 Subject: [PATCH 58/86] dns_sd_windows: Fix invalid printf format string It should use "%zu" to print a size_t. This fixes a compiler warning under MinGW when the log level is set to Debug. Signed-off-by: Paul Cercueil --- dns_sd_windows.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dns_sd_windows.c b/dns_sd_windows.c index ca6087b88..110263e0d 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -453,7 +453,7 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) for (isock = 0; isock < num_sockets; ++isock) mdns_socket_close(sockets[isock]); - IIO_DEBUG("Closed %i socket%s, processed %i record%s\n", + IIO_DEBUG("Closed %i socket%s, processed %zu record%s\n", num_sockets, (num_sockets > 1) ? "s" : "", records, (records > 1) ? "s" : "" ); From 879e49b976748e08639ca9ebe88a628c1633eed0 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Thu, 6 Jul 2023 08:57:43 +0300 Subject: [PATCH 59/86] CI: fix macOS checkout Clean workspace before each build on macOS builds. Signed-off-by: Raluca Groza --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 320269991..bb7545413 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -281,6 +281,8 @@ stages: ############################################# - job: macOSBuilds # Host Box + workspace: + clean: all strategy: matrix: macOS_11: From 209163ae9ca4d23a8078c179b2dd1971d4e6f878 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 23 Nov 2022 12:23:32 +0000 Subject: [PATCH 60/86] utilities.c: Add utility function iio_read_counter_us() This function can be used to get the value of a counter with a precision of a microsecond. The value returned is not properly defined, and as such does not allow to represent a specific point in time, but allows to compute periods and delays. Signed-off-by: Paul Cercueil --- iio-private.h | 1 + utilities.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/iio-private.h b/iio-private.h index 9cc50a5c5..3435798cc 100644 --- a/iio-private.h +++ b/iio-private.h @@ -264,6 +264,7 @@ char *iio_strndup(const char *str, size_t n); char *iio_strtok_r(char *str, const char *delim, char **saveptr); size_t iio_strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize); char * iio_getenv (char * envvar); +uint64_t iio_read_counter_us(void); int iio_context_add_device(struct iio_context *ctx, struct iio_device *dev); diff --git a/utilities.c b/utilities.c index 5dc26887f..92e29af7f 100644 --- a/utilities.c +++ b/utilities.c @@ -20,6 +20,12 @@ #include #include +#ifdef _WIN32 +#include +#else +#include +#endif + #if defined(_WIN32) || \ (defined(__APPLE__) && defined(__MACH__)) || \ (defined(__USE_XOPEN2K8) && \ @@ -359,3 +365,25 @@ ssize_t __iio_printf iio_snprintf(char *buf, size_t len, const char *fmt, ...) return (ssize_t)ret; } + +uint64_t iio_read_counter_us(void) +{ + uint64_t value; + +#ifdef _WIN32 + LARGE_INTEGER freq, cnt; + + QueryPerformanceFrequency(&freq); + QueryPerformanceCounter(&cnt); + + value = (1000000 * cnt.QuadPart) / freq.QuadPart; +#else + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + + value = ts.tv_sec * 1000000ull + (uint64_t)ts.tv_nsec / 1000ull; +#endif + + return value; +} From eebff52af4154d56e85afabc19b707cb8f2891b3 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 5 Jul 2023 16:07:49 -0600 Subject: [PATCH 61/86] mdns: update windows to properly timeout The current mdns code returns when there has not been any mdns traffic for 2 seconds. However, on a noisy network there is sometimes mdns traffic we don't care about, and we never timeout. Refactor things, so it keeps track of when we last success (that matches "_iio._tcp"...). Signed-off-by: Robin Getz Signed-off-by: Paul Cercueil --- dns_sd_windows.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dns_sd_windows.c b/dns_sd_windows.c index 110263e0d..dbc5c83ff 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -24,6 +24,9 @@ #define STRINGIFY(x) _STRINGIFY(x) #define MDNS_PORT_STR STRINGIFY(MDNS_PORT) +static uint64_t lasttime; +#define TIMEOUT 2 + #ifdef HAVE_IPV6 static const unsigned char localhost[] = { 0, 0, 0, 0, 0, 0, 0, 0, @@ -347,6 +350,7 @@ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, } } #endif /* HAVE_IPV6 */ + lasttime = iio_read_counter_us(); iio_mutex_unlock(dd->lock); quit: return 0; @@ -370,6 +374,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) int transaction_id[32]; int nfds, res, ret = -ENOMEM; struct timeval timeout; + uint64_t nowtime; + int64_t diff; if (WSAStartup(versionWanted, &wsaData)) { IIO_ERROR("Failed to initialize WinSock\n"); @@ -422,9 +428,11 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) IIO_DEBUG("Reading mDNS query replies\n"); records = 0; + lasttime = iio_read_counter_us(); + do { nfds = 0; - timeout.tv_sec = 2; + timeout.tv_sec = TIMEOUT; timeout.tv_usec = 0; fd_set readfs; @@ -448,6 +456,16 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) FD_SET(sockets[isock], &readfs); } } + + /* res > 0 even if we didn't process anything :( + * timeout from the last time we successfully added a proper mdns record + */ + nowtime = iio_read_counter_us(); + + /* convert to ms */ + diff = (nowtime - lasttime) / 1000ull; + if (diff > (TIMEOUT * 1000)) + res = 0; } while (res > 0); for (isock = 0; isock < num_sockets; ++isock) From 8904ef7d8c84c568f552277661ecb2e04fc03e91 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 6 Jul 2023 16:56:06 +0200 Subject: [PATCH 62/86] avahi: Fix detection of contexts at IPv6 addresses The IPv6 addresses at which a IIO context has been detected were translated to Libiio URIs, so that the final part can create a Libiio context to verify that the contexts actually exist. However, those URIs were built without the interface specifier, which caused the contexts at IPv6 link-local addresses to being skipped as the Libiio context wouldn't create properly. Signed-off-by: Paul Cercueil --- dns_sd.h | 6 +++++- dns_sd_avahi.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dns_sd.h b/dns_sd.h index 7906837e2..a49f0127d 100644 --- a/dns_sd.h +++ b/dns_sd.h @@ -15,11 +15,15 @@ #ifdef _WIN32 #include +#include +#include #else +#include #include #endif -#define DNS_SD_ADDRESS_STR_MAX (40) /* IPv6 Max = 4*8 + 7 + 1 for NUL */ +/* IPv6 Max = 4*8 + 7 + 1 for '%' + interface length */ +#define DNS_SD_ADDRESS_STR_MAX (40 + IF_NAMESIZE) #define FQDN_LEN (255) /* RFC 1035 */ /* MacOS doesn't include ENOMEDIUM (No medium found) like Linux does */ diff --git a/dns_sd_avahi.c b/dns_sd_avahi.c index c8d917726..6535d3f80 100644 --- a/dns_sd_avahi.c +++ b/dns_sd_avahi.c @@ -51,10 +51,13 @@ static struct dns_sd_discovery_data *new_discovery_data(void) } static void avahi_process_resolved(struct dns_sd_discovery_data *ddata, + AvahiIfIndex iface, const AvahiAddress *addr, const char *host_name, const uint16_t port) { + char *ptr; + /* Avahi is multi-threaded, so lock the list */ iio_mutex_lock(ddata->lock); ddata->resolved++; @@ -83,6 +86,16 @@ static void avahi_process_resolved(struct dns_sd_discovery_data *ddata, } iio_mutex_unlock(ddata->lock); + ptr = ddata->addr_str + strnlen(ddata->addr_str, DNS_SD_ADDRESS_STR_MAX); + + if (addr->proto == AVAHI_PROTO_INET6 + && addr->data.ipv6.address[0] == 0xfe + && addr->data.ipv6.address[1] == 0x80 + && iface != AVAHI_IF_UNSPEC + && if_indextoname((unsigned int)iface, ptr + 1)) { + *ptr = '%'; + } + IIO_DEBUG("\t\t%s:%u (%s)\n", host_name, port, ddata->addr_str); } @@ -126,7 +139,7 @@ static void __avahi_resolver_cb(AvahiServiceResolver *resolver, avahi_strerror(err)); break; case AVAHI_RESOLVER_FOUND: { - avahi_process_resolved(ddata, address, host_name, port); + avahi_process_resolved(ddata, iface, address, host_name, port); IIO_DEBUG("Avahi Resolver : service '%s' of type '%s' in domain '%s':\n", name, type, domain); break; @@ -157,7 +170,7 @@ static void avahi_host_resolver(AvahiHostNameResolver *resolver, host_name, avahi_strerror(err)); break; case AVAHI_RESOLVER_FOUND: - avahi_process_resolved(ddata, address, host_name, IIOD_PORT); + avahi_process_resolved(ddata, iface, address, host_name, IIOD_PORT); break; } From 79ae05b3efe7bc8b15351bc4a5e784148dfdf51c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 6 Jul 2023 17:28:59 +0200 Subject: [PATCH 63/86] network: Fix read-only strings being overwritten POSIX sucks and here we have another example. strchr() / strrchr() take a pointer to a const string, and return a pointer to the character found as a non-const "char *". The compiler and static analyzers would then detect the follow-up code, which would overwrite the static string through that non-const pointer, as perfectly valid C. Address this issue by copying the const string into a temporary buffer. Signed-off-by: Paul Cercueil --- network.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/network.c b/network.c index cabc6fa2c..44f8d0cbe 100644 --- a/network.c +++ b/network.c @@ -1060,7 +1060,7 @@ static bool msg_trunc_supported(struct iiod_client_pdata *io_ctx) } #endif -struct iio_context * network_create_context(const char *host) +struct iio_context * network_create_context(const char *hostname) { struct addrinfo hints, *res; struct iio_context *ctx; @@ -1072,6 +1072,10 @@ struct iio_context * network_create_context(const char *host) char *description, *uri, *end, *port = NULL; char port_str[6]; uint16_t port_num = IIOD_PORT; + char host_buf[FQDN_LEN + sizeof(":65535") + 1]; + char *host = hostname ? host_buf : NULL; + + iio_strlcpy(host_buf, hostname, sizeof(host_buf)); #ifdef _WIN32 WSADATA wsaData; From 007d10a3eb38e7a47ac4e23ff5b53758bc9227a2 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 10 Jul 2023 11:53:23 +0200 Subject: [PATCH 64/86] iio.h: Document URI for IPv6 addresses with interface name Add information about how to construct a URI with a IPv6 address that contains the interface name. This pattern is used with link-local addresses. Signed-off-by: Paul Cercueil --- iio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iio.h b/iio.h index 135e335c9..50510f0a6 100644 --- a/iio.h +++ b/iio.h @@ -475,6 +475,8 @@ __api __check_ret struct iio_context * iio_create_network_context(const char *ho * - ip:192.168.1.119:40000 Port 40000 * - ip:2601:190:400:da:47b3:55ab:3914:bff1 Default Port * - ip:[2601:190:400:da:9a90:96ff:feb5:acaa]:40000 Port 40000 + * - ip:fe80::f14d:3728:501e:1f94%eth0 Link-local through eth0, default port + * - ip:[fe80::f14d:3728:501e:1f94%eth0]:40000 Link-local through eth0, port 40000 * - USB backend, "usb:"\n When more than one usb device is attached, requires * bus, address, and interface parts separated with a dot. For example * "usb:3.32.5". Where there is only one USB device attached, the shorthand From a59036301de63decf7c1738f5a54f316af3a695d Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 11 Jul 2023 10:12:48 +0200 Subject: [PATCH 65/86] dns_sd_windows: Append interface number to IPv6 link-local addresses Just like we do with Avahi, append the interface identifier to the IPv6 link-local addresses. Signed-off-by: Paul Cercueil --- dns_sd_windows.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/dns_sd_windows.c b/dns_sd_windows.c index dbc5c83ff..a27fa33dd 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -71,6 +71,8 @@ static struct dns_sd_discovery_data *new_discovery_data(struct dns_sd_discovery_ static mdns_string_t ip_address_to_string(char *buffer, size_t capacity, const struct sockaddr *addr, size_t addrlen) { + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr; + struct sockaddr_in *addr4 = (struct sockaddr_in *)addr; char host[NI_MAXHOST] = { 0 }; char service[NI_MAXSERV] = { 0 }; int ret, len = 0; @@ -80,15 +82,27 @@ static mdns_string_t ip_address_to_string(char *buffer, size_t capacity, NI_MAXHOST, service, NI_MAXSERV, NI_NUMERICSERV | NI_NUMERICHOST); if (ret == 0) { - if (addr->sa_family == AF_INET6 && - ((struct sockaddr_in6 *)addr)->sin6_port != 0 && - strncmp(service, MDNS_PORT_STR, sizeof(MDNS_PORT_STR))) - len = snprintf(buffer, capacity, "[%s]:%s", host, service); - else if (((struct sockaddr_in *)addr)->sin_port != 0 && - strncmp(service, MDNS_PORT_STR, sizeof(MDNS_PORT_STR))) + if (addr->sa_family == AF_INET6) { + if (addr6->sin6_port != 0 + && strncmp(service, MDNS_PORT_STR, sizeof(MDNS_PORT_STR))) { + if (IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) { + len = snprintf(buffer, capacity, "[%s%%%lu]:%s", + host, addr6->sin6_scope_id, service); + } else { + len = snprintf(buffer, capacity, "[%s]:%s", host, service); + } + } else if (IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) { + len = snprintf(buffer, capacity, "%s%%%lu", + host, addr6->sin6_scope_id); + } else { + len = snprintf(buffer, capacity, "%s", host); + } + } else if (addr4->sin_port != 0 + && strncmp(service, MDNS_PORT_STR, sizeof(MDNS_PORT_STR))) { len = snprintf(buffer, capacity, "%s:%s", host, service); - else + } else { len = snprintf(buffer, capacity, "%s", host); + } } if (len >= (int)capacity) From c74e32e16fd828b7e26616d94ba5308f42c666c2 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 13 Jul 2023 11:25:16 +0200 Subject: [PATCH 66/86] bonjour: Fix discovery on IPv6 network The code would discard discovered IPv6 addresses in favour of IPv4 ones. Also, the IPv6 addresses discovered did not have the interface specifier, which caused context creation to fail. Signed-off-by: Paul Cercueil --- dns_sd_bonjour.c | 60 +++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/dns_sd_bonjour.c b/dns_sd_bonjour.c index 2d7ed5e11..ff5a0cb75 100644 --- a/dns_sd_bonjour.c +++ b/dns_sd_bonjour.c @@ -28,12 +28,10 @@ static void __cfnet_browser_cb(CFNetServiceBrowserRef browser, { const CFNetServiceRef netService = (CFNetServiceRef)domainOrService; struct dns_sd_discovery_data *dd = info; - char address_v4[DNS_SD_ADDRESS_STR_MAX+1] = ""; - char address_v6[DNS_SD_ADDRESS_STR_MAX+1] = ""; + char address[DNS_SD_ADDRESS_STR_MAX+1] = ""; char hostname[FQDN_LEN]; char name[FQDN_LEN]; - bool have_v4 = false; - bool have_v6 = false; + struct sockaddr_in6 *sa6; struct sockaddr_in *sa; CFStreamError anError; CFStringRef targetHost; @@ -41,6 +39,7 @@ static void __cfnet_browser_cb(CFNetServiceBrowserRef browser, CFArrayRef addrArr; CFDataRef data; SInt32 port; + char *ptr; if ((flags & kCFNetServiceFlagIsDomain) != 0) { IIO_ERROR("DNS SD: FATAL! Callback called for domain, not service.\n"); @@ -97,45 +96,44 @@ static void __cfnet_browser_cb(CFNetServiceBrowserRef browser, goto exit; } + /* Set properties on the last element on the list. */ + while (dd->next) + dd = dd->next; + for (CFIndex i = 0; i < CFArrayGetCount(addrArr); i++) { data = CFArrayGetValueAtIndex(addrArr, i); sa = (struct sockaddr_in *) CFDataGetBytePtr(data); + sa6 = (struct sockaddr_in6 *) sa; switch(sa->sin_family) { case AF_INET: if (inet_ntop(sa->sin_family, &sa->sin_addr, - address_v4, sizeof(address_v4))) { - have_v4 = true; - } + address, sizeof(address))) + break; + continue; case AF_INET6: - if (inet_ntop(sa->sin_family, &sa->sin_addr, - address_v6, sizeof(address_v6))) { - have_v6 = true; - } + if (inet_ntop(sa->sin_family, &sa6->sin6_addr, + address, sizeof(address))) + break; + continue; + default: + continue; } - } - - if (!have_v4 && !have_v6) { - IIO_WARNING("DNS SD: Can't resolve valid address for " - "service %s.\n", name); - goto exit; - } - /* Set properties on the last element on the list. */ - while (dd->next) - dd = dd->next; + dd->port = port; + dd->hostname = strdup(hostname); - dd->port = port; - dd->hostname = strdup(hostname); + iio_strlcpy(dd->addr_str, address, sizeof(dd->addr_str)); - if (have_v4) - iio_strlcpy(dd->addr_str, address_v4, sizeof(dd->addr_str)); - else if(have_v6) - iio_strlcpy(dd->addr_str, address_v6, sizeof(dd->addr_str)); + ptr = dd->addr_str + strnlen(dd->addr_str, DNS_SD_ADDRESS_STR_MAX); - IIO_DEBUG("DNS SD: added %s (%s:%d)\n", hostname, dd->addr_str, port); + if (sa->sin_family == AF_INET6 + && sa6->sin6_addr.s6_addr[0] == 0xfe + && sa6->sin6_addr.s6_addr[1] == 0x80 + && if_indextoname((unsigned int)sa6->sin6_scope_id, ptr + 1)) { + *ptr = '%'; + } - if (have_v4 || have_v6) { /* A list entry was filled, prepare new item on the list. */ dd->next = zalloc(sizeof(*dd->next)); if (dd->next) { @@ -144,6 +142,10 @@ static void __cfnet_browser_cb(CFNetServiceBrowserRef browser, } else { IIO_ERROR("DNS SD Bonjour Resolver : memory failure\n"); } + + IIO_DEBUG("DNS SD: added %s (%s:%d)\n", hostname, dd->addr_str, port); + + dd = dd->next; } verify_flags: From a01da8a5008e813d4036783ee86a2b01dbae483a Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Thu, 13 Jul 2023 16:19:05 +0300 Subject: [PATCH 67/86] CI: fix macOS tar balls Create a symbolic link for libusb-1.0.0.dylib because iio tools is linked to libusb-1.0.0.dylib but we have libusb-1.0.dylib on machines. Signed-off-by: Raluca Groza --- CI/azure/macos_tar_fixup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CI/azure/macos_tar_fixup.sh b/CI/azure/macos_tar_fixup.sh index 3b4b30f84..46c8e4303 100644 --- a/CI/azure/macos_tar_fixup.sh +++ b/CI/azure/macos_tar_fixup.sh @@ -64,6 +64,9 @@ do done cd ../../../../ +# Create links to libusb-1.0.0.dylib +ln -s libusb-1.0.dylib usr/local/lib/libusb-1.0.0.dylib + # Remove old tar and create new one rm "../${tarname}" tar -czf "../${tarname}" . From 3d87084ddd7f949738dbfc3571cf7cf39711044c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 14 Jul 2023 14:39:10 +0200 Subject: [PATCH 68/86] device: Fix sample size calculation If we consider a system where channel 0 delivers 32-bit data and channel 1 delivers 16-bit data, the sample size computed would be (4 + 2) == 6 bytes. This is not correct, as it does not take into account the padding needed until the next sample, which must be computed in a way that all the elements of the next sample are aligned to their own size. This new algorithm follows what the Linux kernel does (see: iio_compute_scan_bytes() in drivers/iio/industrialio-buffer.c as of v6.4), and aligns the sample size to its largest element. Signed-off-by: Paul Cercueil --- device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/device.c b/device.c index 1b0612412..7439cd12f 100644 --- a/device.c +++ b/device.c @@ -442,7 +442,7 @@ ssize_t iio_device_get_sample_size_mask(const struct iio_device *dev, const uint32_t *mask, size_t words) { ssize_t size = 0; - unsigned int i; + unsigned int i, largest = 1; const struct iio_channel *prev = NULL; if (words != (dev->nb_channels + 31) / 32) @@ -463,6 +463,9 @@ ssize_t iio_device_get_sample_size_mask(const struct iio_device *dev, continue; } + if (length > largest) + largest = length; + if (size % length) size += 2 * length - (size % length); else @@ -470,6 +473,10 @@ ssize_t iio_device_get_sample_size_mask(const struct iio_device *dev, prev = chn; } + + if (size % largest) + size += largest - (size % largest); + return size; } From a5d9a2a25325dd69c43fa65201359169d0f3e08e Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 13 Jul 2023 17:32:47 +0200 Subject: [PATCH 69/86] python: Rework bindings install Compute the full path to the library, otherwise install of the bindings may fail as it cannot find the installed shared library on OSX. Signed-off-by: Paul Cercueil --- bindings/python/setup.py.cmakein | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/bindings/python/setup.py.cmakein b/bindings/python/setup.py.cmakein index c5d12e8ba..33a4eb91a 100644 --- a/bindings/python/setup.py.cmakein +++ b/bindings/python/setup.py.cmakein @@ -55,22 +55,18 @@ class InstallWrapper(install): from platform import system as _system from ctypes import CDLL as _cdll from ctypes.util import find_library + from os import getenv + from os.path import join + + iiolib = "iio" if "Darwin" in _system() else "libiio${CMAKE_SHARED_LIBRARY_SUFFIX}" + + destdir = getenv("DESTDIR", "") or "" + destdir = join("${CMAKE_INSTALL_FULL_LIBDIR}", destdir) + fulllibpath = find_recursive(destdir, iiolib) - if "Windows" in _system(): - _iiolib = "libiio.dll" - else: - # Non-windows, possibly Posix system - _iiolib = "iio" try: - import os - - destdir = os.getenv("DESTDIR", "") - if destdir: - destdir = os.path.join("${CMAKE_BINARY_DIR}", destdir) - fulllibpath = find_recursive(destdir, "libiio.so") - _lib = _cdll(fulllibpath, use_errno=True, use_last_error=True) - else: - _lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True) + + _lib = _cdll(fulllibpath, use_errno=True, use_last_error=True) if not _lib._name: raise OSError except OSError: From 647ff54f05c6af4aba0e94b83aef969726521384 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 13 Jul 2023 17:33:57 +0200 Subject: [PATCH 70/86] CI: Don't force CMAKE_SYSTEM_NAME for OSX It was done to address an issue with the Python bindings, which was solved differently. Signed-off-by: Paul Cercueil --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bb7545413..935f49bdf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -336,7 +336,7 @@ stages: - script: | set -e mkdir build_tar && cd build_tar - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DCMAKE_SYSTEM_NAME="Darwin" + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package mv ../CI/azure/macos_tar_fixup.sh . From f5ded6afd9efcae08b1845d9945800a05aeb9db5 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 13 Jul 2023 16:52:22 +0200 Subject: [PATCH 71/86] CI: Enable serial backend on OSX Compile Libiio against libserialport to activate the serial backend on OSX. Signed-off-by: Paul Cercueil --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 935f49bdf..dfd78f6df 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -328,7 +328,7 @@ stages: - script: | set -e mkdir build && cd build - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=ON -DWITH_ZSTD=OFF make sudo make install cd .. @@ -336,7 +336,7 @@ stages: - script: | set -e mkdir build_tar && cd build_tar - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=ON -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package mv ../CI/azure/macos_tar_fixup.sh . @@ -347,7 +347,7 @@ stages: - script: | set -e cd build - cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON make cd .. displayName: 'Build With Doc' From f6a452bf4fa2930f6a90c4cdeb615d72c61fc02d Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 16 Jul 2023 23:42:13 -0600 Subject: [PATCH 72/86] dnssd: Fix off by one error when adding device names for some reason, there was an off by one error, which means we always dropped the last device, and never saw it when we were looking at scan contexts... pi@raspberrypi:~/libiio/build $ iio_info -s Available contexts: 0: 169.254.231.18 (cpu_thermal) [ip:raspberrypi.local] should have been (and is after the fix): pi@raspberrypi:~/libiio/build $ ./tests/iio_info -s Available contexts: 0: 169.254.231.18 (cpu_thermal,rpi_volt) [ip:raspberrypi.local] Signed-off-by: Robin Getz --- dns_sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dns_sd.c b/dns_sd.c index 2856411da..30b2aac08 100644 --- a/dns_sd.c +++ b/dns_sd.c @@ -123,7 +123,7 @@ static int dnssd_fill_context_info(struct iio_context_info *info, } else { iio_snprintf(description, sizeof(description), "%s (", addr_str); p = description + strlen(description); - for (i = 0; i < iio_context_get_devices_count(ctx) - 1; i++) { + for (i = 0; i < iio_context_get_devices_count(ctx); i++) { const struct iio_device *dev = iio_context_get_device(ctx, i); const char *name = iio_device_get_name(dev); if (name) { From 8492a78330126f178e4cc70eb4d03da39b70be46 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 16 Jul 2023 23:45:24 -0600 Subject: [PATCH 73/86] sync results of local scans and network scans ./tests/iio_info -s Available contexts: 0: 169.254.231.18 (cpu_thermal,rpi_volt) [ip:raspberrypi.local] 1: (cpu_thermal, rpi_volt on Raspberry Pi 4 Model B Rev 1.1) [local:] This will remove the extra space between device names on the local context, that is not on the network context. Signed-off-by: Robin Getz --- local.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/local.c b/local.c index 6a8d7b928..b8c4ecbdc 100644 --- a/local.c +++ b/local.c @@ -2177,7 +2177,7 @@ static int build_names(void *d, const char *path) dst = cat_file(buf); if (dst) { len = strnlen(names, sizeof(buf)); - iio_snprintf(&names[len], BUF_SIZE - len - 1, "%s, ", dst); + iio_snprintf(&names[len], BUF_SIZE - len - 1, "%s,", dst); free(dst); } return 0; @@ -2212,7 +2212,7 @@ int local_context_scan(struct iio_scan_result *scan_result) if (machine) { if (names[0]) { ret = strnlen(names, sizeof(names)); - names[ret - 2] = '\0'; + names[ret - 1] = '\0'; iio_snprintf(buf, sizeof(buf), "(%s on %s)", names, machine); } else iio_snprintf(buf, sizeof(buf), "(Local IIO devices on %s)", machine); From 99cd3acd80a6406e960ea0f5a557375da895b4d6 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 16 Jul 2023 23:15:09 -0600 Subject: [PATCH 74/86] scanning: add hwmon only systems to scanning. previously scanning on devices like default Raspberry Pi, would show things like: pi@raspberrypi:~ $ iio_info -s No IIO context found. However, this is not correct, since it has HWMON devices (which libiio now understands). So make sure we add this to the scan context. After the patch is applied, we get things like: pi@raspberrypi:~/libiio $ ./build/tests/iio_info -s Available contexts: 0: (cpu_thermal, rpi_volt on Raspberry Pi 4 Model B Rev 1.1) [local:] which is correct. Signed-off-by: Robin Getz --- local.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/local.c b/local.c index b8c4ecbdc..78f2486dc 100644 --- a/local.c +++ b/local.c @@ -2170,7 +2170,7 @@ static int build_names(void *d, const char *path) char *names = (char *)d; size_t len; - if (!strstr(path, "iio:device")) + if (!strstr(path, "iio:device") && !(WITH_HWMON && strstr(path, "class/hwmon"))) return 0; iio_snprintf(buf, sizeof(buf), "%s/name", path); @@ -2195,15 +2195,32 @@ int local_context_scan(struct iio_scan_result *scan_result) bool exists = false; char *desc, *uri, *machine, buf[2 * BUF_SIZE], names[BUF_SIZE]; int ret; + bool no_iio; ret = foreach_in_dir(&exists, "/sys/bus/iio", true, check_device); - if (ret < 0 || !exists) + no_iio = ret == -ENOENT; + if (WITH_HWMON && no_iio) + ret = 0; /* Not an error, unless we also have no hwmon devices */ + if (ret < 0) return 0; names[0] = '\0'; - ret = foreach_in_dir(&names, "/sys/bus/iio/devices", true, build_names); - if (ret < 0) - return 0; + if (!no_iio) { + ret = foreach_in_dir(&names, "/sys/bus/iio/devices", true, build_names); + if (ret < 0) + return 0; + } + + if (WITH_HWMON) { + ret = foreach_in_dir(&exists, "/sys/class/hwmon", true, check_device); + if (ret == -ENOENT && !no_iio) + ret = 0; /* IIO devices but no hwmon devices - not an error */ + if (ret < 0) + return 0; + ret = foreach_in_dir(&names, "/sys/class/hwmon", true, build_names); + if (ret < 0) + return 0; + } machine = cat_file("/sys/firmware/devicetree/base/model"); if (!machine) From a231814007bb40ef607efea46b59fc16c9020606 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 19 Jul 2023 12:10:36 +0200 Subject: [PATCH 75/86] dns_sd_windows: Fix discovery on IPv6 once again The getnameinfo() function already returned the interface number appended to the IPv6 address in ip_address_to_string(); the problem was that the interface number was not properly specified in the sockaddr argument. Now, the sin6_scope_id field (which contains the interface number on Windows) is correctly set, to the interface number of the "from" sockaddr argument. From what I understand, one problem was that the IPv6 address was discovered twice; once with the mDNS socket on IPv6, and once with the mDNS socket on IPv4. The AAAA entry discovered from the IPv4 socket would override the one obtained from the IPv6 socket, but wouldn't contain information about the interface number. Address this issue by only handling AAAA entries on the IPv6 interface. Signed-off-by: Paul Cercueil --- dns_sd_windows.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dns_sd_windows.c b/dns_sd_windows.c index a27fa33dd..534b1396e 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -85,15 +85,7 @@ static mdns_string_t ip_address_to_string(char *buffer, size_t capacity, if (addr->sa_family == AF_INET6) { if (addr6->sin6_port != 0 && strncmp(service, MDNS_PORT_STR, sizeof(MDNS_PORT_STR))) { - if (IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) { - len = snprintf(buffer, capacity, "[%s%%%lu]:%s", - host, addr6->sin6_scope_id, service); - } else { - len = snprintf(buffer, capacity, "[%s]:%s", host, service); - } - } else if (IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)) { - len = snprintf(buffer, capacity, "%s%%%lu", - host, addr6->sin6_scope_id); + len = snprintf(buffer, capacity, "[%s]:%s", host, service); } else { len = snprintf(buffer, capacity, "%s", host); } @@ -233,6 +225,11 @@ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, rtype != MDNS_RECORDTYPE_AAAA) goto quit; +#ifdef HAVE_IPV6 + if (rtype == MDNS_RECORDTYPE_AAAA && from->sa_family != AF_INET6) + goto quit; +#endif + if (entry != MDNS_ENTRYTYPE_ANSWER) goto quit; @@ -326,6 +323,7 @@ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, struct sockaddr_in6 addr; mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr); + addr.sin6_scope_id = ((struct sockaddr_in6 *)from)->sin6_scope_id; addrstr = ip_address_to_string(namebuffer, sizeof(namebuffer), (struct sockaddr *) &addr, sizeof(addr)); IIO_DEBUG("%.*s : %.*s AAAA %.*s\n", MDNS_STRING_FORMAT(fromaddrstr), From 3e176c502b1f70d14b3d135f792d80d25f860b36 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Mon, 24 Jul 2023 12:01:46 +0300 Subject: [PATCH 76/86] CI: fix empty Windows.zip release artifact For the zip command without the -r option, Windows.zip on release contained empty folders. Signed-off-by: Raluca Groza --- CI/azure/prepare_assets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh index a44295d20..878b8bc5f 100755 --- a/CI/azure/prepare_assets.sh +++ b/CI/azure/prepare_assets.sh @@ -44,7 +44,7 @@ release_artifacts() { done cp /home/vsts/work/1/s/CI/azure/README.txt ./Windows cd Windows - zip Windows.zip ./* + zip -r Windows.zip ./* cp ./Windows.zip ../ cd .. rm -r Windows From 924bd0e675fe3384761224c0e80b59ea9549bba5 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 21 Jul 2023 12:37:30 +0200 Subject: [PATCH 77/86] CI: OSX: Fix rpath of libiio + dependencies - Install the dependencies to Library/Frameworks/iio.framework/Versions/Current/Dependencies, and fix the rpath which did not work properly. - Re-sign dependencies after updating their rpath, or anything using libiio will segfault. - Fix the broken symbolic links in /usr/local/{lib,include} Signed-off-by: Paul Cercueil --- CI/azure/macos_tar_fixup.sh | 57 +++++++++++-------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/CI/azure/macos_tar_fixup.sh b/CI/azure/macos_tar_fixup.sh index 46c8e4303..a500de951 100644 --- a/CI/azure/macos_tar_fixup.sh +++ b/CI/azure/macos_tar_fixup.sh @@ -14,58 +14,35 @@ tar -xzf "${tarname}" -C temp_tar mv "temp_tar/${subfoldername}" temp cd temp -# Update rpath of library and tools -libusb_loc=$(find $(brew --cellar) -name libusb-1.0.dylib) -libxml_loc=$(find $(brew --cellar) -name libxml2.dylib) -libserialport_loc=$(find $(brew --cellar) -name libserialport.dylib) -libiio_loc=$(find . -name iio | grep Versions) -libiioheader_loc=$(find . -name iio.h) +deps_dir=Library/Frameworks/iio.framework/Versions/Current/Dependencies +libiio_loc=Library/Frameworks/iio.framework/Versions/Current/iio +libiioheader_loc=Library/Frameworks/iio.framework/Versions/Current/Headers/iio.h -if [ ! -f "${libusb_loc}" ]; then - echo "libusb library not found" - exit 1 -fi -if [ ! -f "${libxml_loc}" ]; then - echo "libxml library not found" - exit 1 -fi -if [ ! -f "${libserialport_loc}" ]; then - echo "libserialport library not found" - exit 1 -fi +mkdir -p "${deps_dir}" # Create links to framework files mkdir -p usr/local/{lib,include} -ln -fs "${libiio_loc}" usr/local/lib/libiio.dylib -ln -fs "${libiioheader_loc}" usr/local/include/iio.h - -# Copy dependent libs to local libs -cp "${libusb_loc}" usr/local/lib/ -cp "${libxml_loc}" usr/local/lib/ -cp "${libserialport_loc}" usr/local/lib/ -chmod +w usr/local/lib/libusb-1.0.dylib -chmod +w usr/local/lib/libxml2.dylib -chmod +w usr/local/lib/libserialport.dylib -install_name_tool -id @rpath/libusb-1.0.dylib usr/local/lib/libusb-1.0.dylib -install_name_tool -id @rpath/libxml2.dylib usr/local/lib/libxml2.dylib -install_name_tool -id @rpath/libserialport.dylib usr/local/lib/libserialport.dylib +ln -fs "../../../${libiio_loc}" usr/local/lib/libiio.dylib +ln -fs "../../../${libiioheader_loc}" usr/local/include/iio.h # Update rpath of library -install_name_tool -change "${libusb_loc}" "@rpath/libusb-1.0.dylib" "${libiio_loc}" -install_name_tool -change "${libxml_loc}" "@rpath/libxml2.dylib" "${libiio_loc}" -install_name_tool -change "${libserialport_loc}" "@rpath/libserialport.dylib" "${libiio_loc}" install_name_tool -add_rpath @loader_path/. "${libiio_loc}" +# Copy dependent libs to local libs, and update rpath of dependencies +for each in $(otool -L "${libiio_loc}" |grep homebrew |cut -f2 | cut -d' ' -f1) ; do + name=$(basename "${each}") + cp "${each}" "${deps_dir}" + chmod +w "${deps_dir}/${name}" + install_name_tool -id "@rpath/Dependencies/${name}" "${deps_dir}/${name}" + install_name_tool -change "${each}" "@rpath/Dependencies/${name}" "${libiio_loc}" + codesign --force -s - "${deps_dir}/${name}" +done + # Update tools -cd Library/Frameworks/iio.framework/Tools -for tool in *; +for tool in Library/Frameworks/iio.framework/Tools/*; do install_name_tool -add_rpath @loader_path/../.. "${tool}" done -cd ../../../../ - -# Create links to libusb-1.0.0.dylib -ln -s libusb-1.0.dylib usr/local/lib/libusb-1.0.0.dylib # Remove old tar and create new one rm "../${tarname}" From 0c322636404f5160ea87aa37cde93de1076b1d6d Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 26 Jul 2023 16:13:28 +0200 Subject: [PATCH 78/86] CMake: Bump minimal required version to 3.10 CMake v3.10 is from 2018. All stable distributions like Ubuntu 18.04, OpenSUSE 15 or CentOS 7 provide a version of CMake >= 3.10. Since CMake v3.27 refuses to build anything that claims compatibility with CMake 2.x, bump the minimal required version to CMake 3.10. Signed-off-by: Paul Cercueil --- CMakeLists.txt | 9 +-------- bindings/cpp/CMakeLists.txt | 2 +- bindings/csharp/CMakeLists.txt | 2 +- bindings/python/CMakeLists.txt | 6 +----- examples/CMakeLists.txt | 2 +- iiod/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 310636421..5f7223ed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ message(STATUS "cmake version: ${CMAKE_VERSION}") -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(libiio C) if (MINGW) @@ -94,13 +94,6 @@ elseif (CMAKE_COMPILER_IS_GNUCC) if (HAS_WSHADOW) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") endif() - # cmake 2.8 doesn't support C_STANDARD defined in set_target_properties - if (${CMAKE_VERSION} VERSION_LESS "3.2") - check_c_compiler_flag(-std=c99 HAS_C99) - if (HAS_C99) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") - endif() - endif() # Per http://www.mingw.org/wiki/Use_more_recent_defined_functions if (MINGW) diff --git a/bindings/cpp/CMakeLists.txt b/bindings/cpp/CMakeLists.txt index 728cb3263..15bb1b09f 100644 --- a/bindings/cpp/CMakeLists.txt +++ b/bindings/cpp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(iiopp-enum CXX) add_executable(iiopp-enum examples/iiopp-enum.cpp iiopp.h ${LIBIIO_RC}) diff --git a/bindings/csharp/CMakeLists.txt b/bindings/csharp/CMakeLists.txt index 22127bc68..417d93bba 100644 --- a/bindings/csharp/CMakeLists.txt +++ b/bindings/csharp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(libiio-sharp NONE) if (WIN32) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index cd2b27cfa..e12d93c9f 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(libiio-py NONE) if(${CMAKE_VERSION} VERSION_LESS "3.12.0") @@ -42,10 +42,6 @@ else() endif() if(WITH_DOC) - if(${CMAKE_VERSION} VERSION_LESS "3.2.0") - # cmake -E env was added in 3.2 - message(FATAL_ERROR "Sorry, you can't build python doc with ancient cmake, please update") - endif() find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Sphinx Documentation Builder (sphinx-doc.org)" diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2ed4d9f50..bc6ec7520 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(ad9361-iiostream C) project(ad9371-iiostream C) diff --git a/iiod/CMakeLists.txt b/iiod/CMakeLists.txt index b269f0c3e..b1c75e814 100644 --- a/iiod/CMakeLists.txt +++ b/iiod/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(iiod C) include(FindBISON) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7c67a695f..a50c6efae 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(iio_genxml C) project(iio_info C) From b31f4c954a5403118c02582ce46c728b4ecfa9f4 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 26 Jul 2023 10:54:34 +0200 Subject: [PATCH 79/86] serial: Pass port name/description as context attributes Instead of overriding the context description that comes from the XML, pass the serial port name and description as context attributes, and keep the context description as-is. Fixes #926. Signed-off-by: Paul Cercueil --- serial.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/serial.c b/serial.c index 1f957d74c..a7b5736f4 100644 --- a/serial.c +++ b/serial.c @@ -105,26 +105,6 @@ static int serial_get_version(const struct iio_context *ctx, major, minor, git_tag); } -static char * serial_get_description(struct sp_port *port) -{ - char *description, *name, *desc; - size_t desc_len; - - name = sp_get_port_name(port); - desc = sp_get_port_description(port); - - desc_len = sizeof(": \0") + strlen(name) + strlen(desc); - description = malloc(desc_len); - if (!description) { - errno = ENOMEM; - return NULL; - } - - iio_snprintf(description, desc_len, "%s: %s", name, desc); - - return description; -} - static int serial_open(const struct iio_device *dev, size_t samples_count, bool cyclic) { @@ -421,7 +401,7 @@ static struct iio_context * serial_create_context(const char *port_name, struct sp_port *port; struct iio_context_pdata *pdata; struct iio_context *ctx; - char *description, *uri, buf[16]; + char *uri, buf[16]; size_t uri_len; unsigned int i; int ret; @@ -466,14 +446,10 @@ static struct iio_context * serial_create_context(const char *port_name, } } while (ret); - description = serial_get_description(port); - if (!description) - goto err_close_port; - pdata = zalloc(sizeof(*pdata)); if (!pdata) { errno = ENOMEM; - goto err_free_description; + goto err_close_port; } pdata->port = port; @@ -490,7 +466,6 @@ static struct iio_context * serial_create_context(const char *port_name, ctx->name = "serial"; ctx->ops = &serial_ops; ctx->pdata = pdata; - ctx->description = description; for (i = 0; i < iio_context_get_devices_count(ctx); i++) { struct iio_device *dev = iio_context_get_device(ctx, i); @@ -510,6 +485,15 @@ static struct iio_context * serial_create_context(const char *port_name, goto err_context_destroy; free(uri); + ret = iio_context_add_attr(ctx, "serial,port", sp_get_port_name(port)); + if (ret < 0) + goto err_context_destroy; + + ret = iio_context_add_attr(ctx, "serial,description", + sp_get_port_description(port)); + if (ret < 0) + goto err_context_destroy; + return ctx; err_context_destroy: @@ -522,8 +506,6 @@ static struct iio_context * serial_create_context(const char *port_name, iiod_client_destroy(pdata->iiod_client); err_free_pdata: free(pdata); -err_free_description: - free(description); err_close_port: sp_close(port); err_free_port: From bbbbc4211568b2a13486954c275d4961400b4580 Mon Sep 17 00:00:00 2001 From: Raluca Groza Date: Wed, 26 Jul 2023 13:14:22 +0300 Subject: [PATCH 80/86] CI: add next_stable branch to CI triggers Signed-off-by: Raluca Groza --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dfd78f6df..17ab1bc18 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,7 @@ trigger: include: - main - master + - next_stable - staging/* - 20* tags: From 9892815a322aa3e0181d084cc6893119417bc9fd Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 2 Aug 2023 10:12:45 +0200 Subject: [PATCH 81/86] dns-sd: Remove duplicates before probing URIs Remove the duplicates in the list of detected URIs before probing those URIs, otherwise we end up with many more connections than necesary. Signed-off-by: Paul Cercueil --- dns_sd_avahi.c | 4 ++-- dns_sd_bonjour.c | 2 +- dns_sd_windows.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dns_sd_avahi.c b/dns_sd_avahi.c index 6535d3f80..bd50c3331 100644 --- a/dns_sd_avahi.c +++ b/dns_sd_avahi.c @@ -293,8 +293,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) avahi_simple_poll_loop(d->poll); if (d->resolved) { - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); } else ret = -ENXIO; @@ -378,8 +378,8 @@ int dnssd_resolve_host(const char *hostname, #endif if (d->resolved) { - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); } else { ret = -ENXIO; goto err_mutex_destroy; diff --git a/dns_sd_bonjour.c b/dns_sd_bonjour.c index ff5a0cb75..f6cef76f1 100644 --- a/dns_sd_bonjour.c +++ b/dns_sd_bonjour.c @@ -238,8 +238,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) } } - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); *ddata = d; } diff --git a/dns_sd_windows.c b/dns_sd_windows.c index 534b1396e..6c7258b85 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -487,8 +487,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) num_sockets, (num_sockets > 1) ? "s" : "", records, (records > 1) ? "s" : "" ); - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); /* since d may have changed, make sure we pass back the start */ *ddata = d; From 74623f4d492d7d296a452617e725b1a24c6f0320 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 26 Jul 2023 13:51:20 +0200 Subject: [PATCH 82/86] dnssd: windows: Greatly enhance code The previous code was very complex and was not working properly with IPv6 addresses. The new code will use the SRV records to find the hostnames that support IIO functionality, and then add new entries when a AAAA record provides a new IPv6 address for a hostname we already know of. Link-local addresses are now supported, and the interface number will be appended to the address. Global addresses are supported as well. Signed-off-by: Paul Cercueil --- dns_sd.h | 2 +- dns_sd_windows.c | 187 ++++++++++++++++++----------------------------- 2 files changed, 71 insertions(+), 118 deletions(-) diff --git a/dns_sd.h b/dns_sd.h index a49f0127d..45706dfaa 100644 --- a/dns_sd.h +++ b/dns_sd.h @@ -48,7 +48,7 @@ struct dns_sd_discovery_data { uint16_t found, resolved; char addr_str[DNS_SD_ADDRESS_STR_MAX]; char *hostname; - uint16_t port; + uint16_t port, iface; struct dns_sd_discovery_data *next; }; diff --git a/dns_sd_windows.c b/dns_sd_windows.c index 6c7258b85..71d0be446 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -212,23 +212,22 @@ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, char entrybuffer[256]; char namebuffer[256]; mdns_record_srv_t srv; - bool found = false; - mdns_string_t entrystr, fromaddrstr, addrstr; - unsigned short port = 0; + mdns_string_t entrystr, fromaddrstr; if (!dd) { IIO_ERROR("DNS SD: Missing info structure. Stop browsing.\n"); goto quit; } - if (rtype != MDNS_RECORDTYPE_SRV && rtype != MDNS_RECORDTYPE_A && - rtype != MDNS_RECORDTYPE_AAAA) - goto quit; - + switch (rtype) { + case MDNS_RECORDTYPE_SRV: #ifdef HAVE_IPV6 - if (rtype == MDNS_RECORDTYPE_AAAA && from->sa_family != AF_INET6) - goto quit; + case MDNS_RECORDTYPE_AAAA: #endif + break; + default: + goto quit; + } if (entry != MDNS_ENTRYTYPE_ANSWER) goto quit; @@ -239,129 +238,83 @@ static int query_callback(int sock, const struct sockaddr *from, size_t addrlen, if (!strstr(entrystr.str, "_iio._tcp.local")) goto quit; - fromaddrstr = ip_address_to_string(addrbuffer, sizeof(addrbuffer), - from, addrlen); - iio_mutex_lock(dd->lock); + if (rtype == MDNS_RECORDTYPE_SRV) { srv = mdns_record_parse_srv(data, size, record_offset, record_length, namebuffer, sizeof(namebuffer)); + + fromaddrstr = ip_address_to_string(addrbuffer, sizeof(addrbuffer), + from, addrlen); + IIO_DEBUG("%.*s : %.*s SRV %.*s priority %d weight %d port %d\n", MDNS_STRING_FORMAT(fromaddrstr), MDNS_STRING_FORMAT(entrystr), MDNS_STRING_FORMAT(srv.name), srv.priority, srv.weight, srv.port); - - /* find a match based on name/port/ipv[46] & update it, otherwise add it */ - while (dd->next) { - if (dd->hostname && - !strncmp(dd->hostname, srv.name.str, srv.name.length - 1) && - (!dd->port || dd->port == srv.port) && - dd->found == (from->sa_family != AF_INET)) { - dd->port = srv.port; - IIO_DEBUG("DNS SD: updated SRV %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - found = true; - } - dd = dd->next; - } - if (!found) { - /* new hostname and port */ - if (srv.name.length > 1) { - dd->hostname = iio_strndup(srv.name.str, - srv.name.length - 1); - if (!dd->hostname) - goto mem_fail; - } - - iio_strlcpy(dd->addr_str, fromaddrstr.str, fromaddrstr.length + 1); - dd->port = srv.port; - dd->found = (from->sa_family != AF_INET); - IIO_DEBUG("DNS SD: added SRV %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - - /* A list entry was filled, prepare new item on the list */ - dd->next = new_discovery_data(dd); - if (!dd->next) - goto mem_fail; - } - } else if (rtype == MDNS_RECORDTYPE_A) { - struct sockaddr_in addr; - - mdns_record_parse_a(data, size, record_offset, record_length, &addr); - addrstr = ip_address_to_string(namebuffer, sizeof(namebuffer), - (struct sockaddr *) &addr, sizeof(addr)); - IIO_DEBUG("%.*s : %.*s A %.*s\n", MDNS_STRING_FORMAT(fromaddrstr), - MDNS_STRING_FORMAT(entrystr), MDNS_STRING_FORMAT(addrstr)); - - /* find a match based on name/ipv4 or 6 & update it, otherwise add it */ - while (dd->next) { - if (dd->hostname && - !strncmp(dd->hostname, entrystr.str, entrystr.length - 1) && - !dd->found) { - iio_strlcpy(dd->addr_str, addrstr.str, addrstr.length + 1); - IIO_DEBUG("DNS SD: updated A %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - found = true; - } - dd = dd->next; - } - if (!found) { - dd->hostname = iio_strndup(entrystr.str, entrystr.length - 1); - if (!dd->hostname) - goto mem_fail; - iio_strlcpy(dd->addr_str, addrstr.str, addrstr.length + 1); - dd->found = 0; - IIO_DEBUG("DNS SD: Added A %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - /* A list entry was filled, prepare new item on the list */ - dd->next = new_discovery_data(dd); - if (!dd->next) - goto mem_fail; - } } #ifdef HAVE_IPV6 - else if (rtype == MDNS_RECORDTYPE_AAAA) { + else { struct sockaddr_in6 addr; mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr); - addr.sin6_scope_id = ((struct sockaddr_in6 *)from)->sin6_scope_id; - addrstr = ip_address_to_string(namebuffer, sizeof(namebuffer), - (struct sockaddr *) &addr, sizeof(addr)); - IIO_DEBUG("%.*s : %.*s AAAA %.*s\n", MDNS_STRING_FORMAT(fromaddrstr), - MDNS_STRING_FORMAT(entrystr), MDNS_STRING_FORMAT(addrstr)); - - /* find a match based on name/port/ipv[46] & update it, otherwise add it */ - while (dd->next) { - if (dd->hostname && - !strncmp(dd->hostname, entrystr.str, entrystr.length - 1) && - dd->found) { - iio_strlcpy(dd->addr_str, addrstr.str, addrstr.length + 1); - IIO_DEBUG("DNS SD: updated AAAA %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - found = true; - } - else if (dd->hostname && - !strncmp(dd->hostname, entrystr.str, entrystr.length - 1)) { - port = dd->port; - } - dd = dd->next; + + /* Find a match based on hostname */ + for (; dd->next; dd = dd->next) { + if (dd->hostname + && dd->found + && !strncmp(dd->hostname, entrystr.str, entrystr.length - 1)) + break; } - if (!found) { - dd->hostname = iio_strndup(entrystr.str, entrystr.length - 1); - if (!dd->hostname) - goto mem_fail; - iio_strlcpy(dd->addr_str, addrstr.str, addrstr.length + 1); - dd->found = 1; - if (port) - dd->port = port; - IIO_DEBUG("DNS SD: added AAAA %s (%s port: %hu)\n", - dd->hostname, dd->addr_str, dd->port); - /* A list entry was filled, prepare new item on the list */ - dd->next = new_discovery_data(dd); - if (!dd->next) - goto mem_fail; + + if (!dd->next) { + IIO_DEBUG("No SRV found for hostname %.*s\n", + MDNS_STRING_FORMAT(entrystr)); + iio_mutex_unlock(dd->lock); + goto quit; } + + srv.name.str = dd->hostname; + srv.name.length = strlen(dd->hostname) + 1; + srv.port = dd->port; + + if (IN6_IS_ADDR_LINKLOCAL(&addr.sin6_addr)) + addr.sin6_scope_id = dd->iface; + else + addr.sin6_scope_id = 0; + + fromaddrstr = ip_address_to_string(addrbuffer, sizeof(addrbuffer), + (struct sockaddr *)&addr, sizeof(addr)); + + IIO_DEBUG("Found IPv6 address %.*s for hostname %s\n", + MDNS_STRING_FORMAT(fromaddrstr), dd->hostname); } -#endif /* HAVE_IPV6 */ +#endif + + while (dd->next) + dd = dd->next; + + /* new hostname and port */ + if (srv.name.length > 1) { + dd->hostname = iio_strndup(srv.name.str, + srv.name.length - 1); + if (!dd->hostname) + goto mem_fail; + } + + iio_strlcpy(dd->addr_str, fromaddrstr.str, fromaddrstr.length + 1); + dd->port = srv.port; + dd->found = (from->sa_family != AF_INET); +#ifdef HAVE_IPV6 + if (dd->found) + dd->iface = (uint16_t)((struct sockaddr_in6 *)from)->sin6_scope_id; +#endif + IIO_DEBUG("DNS SD: added SRV %s (%s port: %hu)\n", + dd->hostname, dd->addr_str, dd->port); + + /* A list entry was filled, prepare new item on the list */ + dd->next = new_discovery_data(dd); + if (!dd->next) + goto mem_fail; + lasttime = iio_read_counter_us(); iio_mutex_unlock(dd->lock); quit: From 035638201ec28703ffd277444dac34209a447a0c Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 1 Aug 2023 01:06:40 -0400 Subject: [PATCH 83/86] iiod: remove test code that slipped in IIO_ERROR("host %s\n", host"); isn't an error - it was just some debug things that got accidently committed, so remove it. Signed-off-by: Robin Getz --- iiod/dns-sd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/iiod/dns-sd.c b/iiod/dns-sd.c index 37fd2a746..724f33cf2 100644 --- a/iiod/dns-sd.c +++ b/iiod/dns-sd.c @@ -256,7 +256,6 @@ static void start_avahi_thd(struct thread_pool *pool, void *d) while(true) { ret = gethostname(host, sizeof(host)); - IIO_ERROR("host %s\n", host); if (ret || !strcmp(host, "none")) goto again; From 6ab7ff64f07c0031f0779edd5a5a8cfccf2582bb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 1 Aug 2023 01:07:59 -0400 Subject: [PATCH 84/86] iiod: fix the printing of IP addresses inside iiod when a IP client attaches to the current iiod, it prints out: New client connected from 0.0.0.0 This is because we this was coded when we only supported ipv4, but when we got a ipv6 socket (which is all the time now when we have ipv6 enabled), we didn't allocate the right size of structure, and the client/peer address didn't get decoded/printed out properly. So, fix that, and print out where the clients are at. Tested onm x86, ARM (32-bit and 64-bit) Signed-off-by: Robin Getz Signed-off-by: Paul Cercueil --- iiod/iiod.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/iiod/iiod.c b/iiod/iiod.c index 2cdf0356a..dc1bc0bf2 100644 --- a/iiod/iiod.c +++ b/iiod/iiod.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,12 @@ #define _STRINGIFY(x) #x #define STRINGIFY(x) _STRINGIFY(x) +#ifdef HAVE_IPV6 +#define IP_ADDR_LEN (INET6_ADDRSTRLEN + 1 + IF_NAMESIZE) +#else +#define IP_ADDR_LEN (INET_ADDRSTRLEN + 1 + IF_NAMESIZE) +#endif + static int start_iiod(const char *uri, const char *ffs_mountpoint, const char *uart_params, bool debug, bool interactive, bool use_aio, uint16_t port, unsigned int nb_pipes, @@ -265,7 +272,12 @@ static int main_server(struct iio_context *ctx, bool debug, while (true) { struct client_data *cdata; +#ifdef HAVE_IPV6 + struct sockaddr_in6 caddr; +#else struct sockaddr_in caddr; +#endif + socklen_t addr_len = sizeof(caddr); int new; @@ -330,8 +342,43 @@ static int main_server(struct iio_context *ctx, bool debug, cdata->xml_zstd = xml_zstd; cdata->xml_zstd_len = xml_zstd_len; - IIO_INFO("New client connected from %s\n", - inet_ntoa(caddr.sin_addr)); + if (LOG_LEVEL >= Info_L) { + struct sockaddr_in *caddr4 = (struct sockaddr_in *)&caddr; + char ipaddr[IP_ADDR_LEN]; + int zone = 0; + void *addr; + char *ptr; + + if (!ipv6 || caddr4->sin_family == AF_INET) { + addr = &caddr4->sin_addr; +#ifdef HAVE_IPV6 + } else { + addr = &caddr.sin6_addr; + zone = caddr.sin6_scope_id; +#endif + } + + if (!inet_ntop(caddr4->sin_family, addr, ipaddr, sizeof(ipaddr) - 1)) { + iio_strerror(errno, err_str, sizeof(err_str)); + IIO_ERROR("Error during inet_ntop: %s\n", err_str); + } else { + ipaddr[IP_ADDR_LEN - 1] = '\0'; + + if (zone) { + ptr = &ipaddr[strnlen(ipaddr, IP_ADDR_LEN)]; + + if (if_indextoname(zone, ptr + 1)) + *ptr = '%'; + } + + if (!strncmp(ipaddr, "::ffff:", sizeof("::ffff:") - 1)) + ptr = &ipaddr[sizeof("::ffff:") - 1]; + else + ptr = ipaddr; + + IIO_INFO("New client connected from %s\n", ptr); + } + } ret = thread_pool_add_thread(main_thread_pool, client_thd, cdata, "net_client_thd"); if (ret) { From 169172fd7b3b767ce6d69390f178645434611365 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 4 Aug 2023 10:04:32 +0200 Subject: [PATCH 85/86] debug.h: Update log macros Remove the coloring feature, because the WITH_COLOR_DEBUG macro was not set anywhere, and would trigger compilation errors when set (since we enforce strict C99 compliance). The log macros are also not conditionally-compiled anymore, and rely on the compiler detecting them as dead code instead. This should fix all issues with variables detected as unused by the compiler when the 'NoLog' level is used. Signed-off-by: Paul Cercueil --- debug.h | 84 ++++++++++++++++----------------------------------------- 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/debug.h b/debug.h index 75230f104..65ac9e76b 100644 --- a/debug.h +++ b/debug.h @@ -21,20 +21,6 @@ /* -------------------- */ -#ifdef WITH_COLOR_DEBUG -#ifndef COLOR_DEBUG -#define COLOR_DEBUG "\e[0;32m" -#endif -#ifndef COLOR_WARNING -#define COLOR_WARNING "\e[01;35m" -#endif -#ifndef COLOR_ERROR -#define COLOR_ERROR "\e[01;31m" -#endif - -#define COLOR_END "\e[0m" -#endif - /* Many of these debug printf include a Flawfinder: ignore, this is because, * according to https://cwe.mitre.org/data/definitions/134.html which describes * functions that accepts a format string as an argument, but the format @@ -42,52 +28,28 @@ * IIO_WARNING, and IIO_ERRRO functions are called internally from the * library, have fixed format strings and can not be modified externally. */ -#if (LOG_LEVEL >= Debug_L) -# ifdef COLOR_DEBUG -# define IIO_DEBUG(str, ...) \ - fprintf(stdout, COLOR_DEBUG "DEBUG: " str COLOR_END, ##__VA_ARGS__) /* Flawfinder: ignore */ -# else -# define IIO_DEBUG(...) \ - fprintf(stdout, "DEBUG: " __VA_ARGS__) /* Flawfinder: ignore */ -# endif -#else -#define IIO_DEBUG(...) do { } while (0) -#endif - -#if (LOG_LEVEL >= Info_L) -# ifdef COLOR_INFO -# define IIO_INFO(str, ...) \ - fprintf(stdout, COLOR_INFO str COLOR_END, ##__VA_ARGS__) /* Flawfinder: ignore */ -# else -# define IIO_INFO(...) \ - fprintf(stdout, __VA_ARGS__) /* Flawfinder: ignore */ -# endif -#else -#define IIO_INFO(...) do { } while (0) -#endif - -#if (LOG_LEVEL >= Warning_L) -# ifdef COLOR_WARNING -# define IIO_WARNING(str, ...) \ - fprintf(stderr, COLOR_WARNING "WARNING: " str COLOR_END, ##__VA_ARGS__) /* Flawfinder: ignore */ -# else -# define IIO_WARNING(...) \ - fprintf(stderr, "WARNING: " __VA_ARGS__) /* Flawfinder: ignore */ -# endif -#else -#define IIO_WARNING(...) do { } while (0) -#endif - -#if (LOG_LEVEL >= Error_L) -# ifdef COLOR_ERROR -# define IIO_ERROR(str, ...) \ - fprintf(stderr, COLOR_ERROR "ERROR: " str COLOR_END, ##__VA_ARGS__) /* Flawfinder: ignore */ -# else -# define IIO_ERROR(...) \ - fprintf(stderr, "ERROR: " __VA_ARGS__) /* Flawfinder: ignore */ -# endif -#else -#define IIO_ERROR(...) do { } while (0) -#endif +#define IIO_DEBUG(...) \ + do { \ + if (LOG_LEVEL >= Debug_L) \ + fprintf(stdout, "DEBUG: " __VA_ARGS__); /* Flawfinder: ignore */ \ + } while (0) + +#define IIO_INFO(...) \ + do { \ + if (LOG_LEVEL >= Info_L) \ + fprintf(stdout, __VA_ARGS__); /* Flawfinder: ignore */ \ + } while (0) + +#define IIO_WARNING(...) \ + do { \ + if (LOG_LEVEL >= Warning_L) \ + fprintf(stderr, "WARNING: " __VA_ARGS__); /* Flawfinder: ignore */ \ + } while (0) + +#define IIO_ERROR(...) \ + do { \ + if (LOG_LEVEL >= Error_L) \ + fprintf(stderr, "ERROR: " __VA_ARGS__); /* Flawfinder: ignore */ \ + } while (0) #endif From d62bc62b7764ece7f2233b81fd731d02be7a9850 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 4 Aug 2023 01:37:55 -0400 Subject: [PATCH 86/86] Make sure we print out LOG_LEVEL during Cmake print out the LOG_LEVEL, so you don't need to search in the source to find it. Signed-off-by: Robin Getz --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f7223ed9..858cb2391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -712,3 +712,4 @@ string(REPLACE ";" " " IIO_FEATURES_OFF "${IIO_FEATURES_OFF}") message(STATUS "Features enabled : ${IIO_FEATURES_ON}") message(STATUS "Features disabled: ${IIO_FEATURES_OFF}") +message(STATUS "LOG_LEVEL set to \"${LOG_LEVEL}\"")