From fce1088cc34d06662b249027000ed7225bef2ccb Mon Sep 17 00:00:00 2001 From: John Date: Sun, 29 May 2022 15:25:01 +0200 Subject: [PATCH 01/10] fix for some architectures (fixes #608) --- src/lib/ebus/datatype.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ebus/datatype.cpp b/src/lib/ebus/datatype.cpp index b68abb33..d3108f69 100755 --- a/src/lib/ebus/datatype.cpp +++ b/src/lib/ebus/datatype.cpp @@ -43,7 +43,7 @@ using std::setw; using std::endl; -float uintToFloat(unsigned int value) { +float uintToFloat(unsigned int value, bool negative) { #ifdef HAVE_DIRECT_FLOAT_FORMAT # if HAVE_DIRECT_FLOAT_FORMAT == 2 value = __builtin_bswap32(value); @@ -826,7 +826,7 @@ result_t NumberDataType::readFromRawValue(unsigned int value, } if (m_bitCount == 32) { if (hasFlag(EXP)) { // IEEE 754 binary32 - float val = uintToFloat(value); + float val = uintToFloat(value, negative); if (val != val) { // !isnan(val) if (outputFormat & OF_JSON) { *output << "null"; From 8402727f037e7536516214502c270e74fca571ef Mon Sep 17 00:00:00 2001 From: Matthias Wellmeyer Date: Sun, 19 Jun 2022 14:14:26 +0200 Subject: [PATCH 02/10] fix receivetimeout unit in argpoptions (#610) --- src/ebusd/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 01ba4653..856e357d 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -232,7 +232,7 @@ static const struct argp_option argpoptions[] = { {"acquiretimeout", O_ACQTIM, "MSEC", 0, "Stop bus acquisition after MSEC ms [10]", 0 }, {"acquireretries", O_ACQRET, "COUNT", 0, "Retry bus acquisition COUNT times [3]", 0 }, {"sendretries", O_SNDRET, "COUNT", 0, "Repeat failed sends COUNT times [2]", 0 }, - {"receivetimeout", O_RCVTIM, "MSEC", 0, "Expect a slave to answer within MSEC us [25]", 0 }, + {"receivetimeout", O_RCVTIM, "MSEC", 0, "Expect a slave to answer within MSEC ms [25]", 0 }, {"numbermasters", O_MASCNT, "COUNT", 0, "Expect COUNT masters on the bus, 0 for auto detection [0]", 0 }, {"generatesyn", O_GENSYN, nullptr, 0, "Enable AUTO-SYN symbol generation", 0 }, From fa3361c014a353b3bcdf554816e3992fb67b7b40 Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Sun, 19 Jun 2022 14:17:44 +0200 Subject: [PATCH 03/10] fix compiler warning: deprecated std::binary_function (#609) --- src/lib/ebus/message.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/ebus/message.h b/src/lib/ebus/message.h index e09ad18a..70c6c36f 100644 --- a/src/lib/ebus/message.h +++ b/src/lib/ebus/message.h @@ -25,7 +25,6 @@ #include #include #include -#include #include "lib/ebus/data.h" #include "lib/ebus/result.h" #include "lib/ebus/symbol.h" @@ -800,7 +799,7 @@ class ChainedMessage : public Message { /** * A function that compares the weighted poll priority of two @a Message instances. */ -struct compareMessagePriority : binary_function { +struct compareMessagePriority { /** * Compare the weighted poll priority of the two @a Message instances. * @param x the first @a Message. From a8335ca24a30380151f18dacd6d545dc07934c0b Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Sun, 19 Jun 2022 14:42:27 +0200 Subject: [PATCH 04/10] allow using CMAKE_INSTALL_PREFIX (#605) --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43743b7a..1001360d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.7.1 FATAL_ERROR) # CMP0075 Include file check macros honor CMAKE_REQUIRED_LIBRARIES # For more information see: https://cmake.org/cmake/help/latest/policy/CMP0075.html @@ -42,7 +42,9 @@ endif(NOT REVISION) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g -O0 -ggdb -fsanitize=address -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -set(CMAKE_INSTALL_PREFIX "") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "" CACHE PATH "..." FORCE) +endif() include(GNUInstallDirs) include(CheckFunctionExists) include(CheckCXXSourceRuns) From afe72e166459d2afe5638ee22be978e87409b0ed Mon Sep 17 00:00:00 2001 From: John Date: Sun, 19 Jun 2022 15:10:39 +0200 Subject: [PATCH 05/10] add libseccomp hint (related to #520) --- contrib/docker/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/docker/README.md b/contrib/docker/README.md index 473e576d..2959231d 100644 --- a/contrib/docker/README.md +++ b/contrib/docker/README.md @@ -75,3 +75,10 @@ environment variables with the prefix `EBUSD_`, e.g. the following line can be u > docker run -d --name=ebusd --device=/dev/ttyUSB0 -p 8888 -e EBUSD_SCANCONFIG= -e EBUSD_DEVICE=/dev/ttyUSB0 -e EBUSD_MQTTPORT=1883 -e EBUSD_MQTTHOST=BROKERHOST john30/ebusd This eases use of e.g. docker-compose files. + + +Hints for running on arm32v7 host with Ubuntu 20.04 +--------------------------------------------------- +If the system time in the container is invalid, then retrieval of CSVs from the config webservice through HTTPS does not +work. This is due to an issue with an outdated [libseccomp library](https://github.com/moby/moby/issues/40734) on the host. +To circumvent this behaviour, updating the library might help as mentioned [here](https://serverfault.com/questions/1037146/docker-container-with-random-date/1048351#1048351). From 76dafd47838c44fd89b8a98ebcdbcd66db8d14fc Mon Sep 17 00:00:00 2001 From: John Date: Sun, 19 Jun 2022 16:02:15 +0200 Subject: [PATCH 06/10] continue initial scan until succeeded (solves #596) --- src/ebusd/mainloop.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index f49bc139..61f2d97c 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -291,8 +291,7 @@ void MainLoop::run() { } if (result != RESULT_OK) { logError(lf_main, "initial scan failed: %s", getResultCode(result)); - } - if (result != RESULT_ERR_NO_SIGNAL) { + } else { reload = false; } } From bb568abdd49a886164b979496e1f35eb279ef82c Mon Sep 17 00:00:00 2001 From: John Date: Sun, 17 Jul 2022 11:14:46 +0200 Subject: [PATCH 07/10] pass git revision to build process (#617) --- .github/workflows/build.yml | 6 +++++- configure.ac | 8 ++++++-- contrib/docker/Dockerfile | 4 +++- contrib/docker/Dockerfile.release | 4 +++- contrib/docker/Dockerfile.template | 2 ++ contrib/docker/build.sh | 1 + contrib/docker/update.sh | 6 +++--- 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4816644..b8396ff5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,10 @@ jobs: - name: checkout uses: actions/checkout@v2 + - + name: gh-describe + id: gittag + uses: proudust/gh-describe@v1.4.6 - name: set up QEMU uses: docker/setup-qemu-action@v1 @@ -46,4 +50,4 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: build - run: cd contrib/docker && LIMITARCH=${{ github.event.inputs.limitarch }} ./build.sh + run: cd contrib/docker && LIMITARCH=${{ github.event.inputs.limitarch }} GIT_REVISION=${{ steps.gittag.outputs.describe }} ./build.sh diff --git a/configure.ac b/configure.ac index fe9f68b6..3664ecc2 100755 --- a/configure.ac +++ b/configure.ac @@ -137,8 +137,12 @@ AC_DEFINE_UNQUOTED(PACKAGE_LOGFILE, LOCALSTATEDIR "/log/" PACKAGE ".log", [The p AC_DEFINE(SCAN_VERSION, "[m4_esyscmd_s([sed -e 's#^\([0-9]*\.[0-9]*\).*#\1#' -e 's#\.\([0-9]\)$#0\1#' -e 's#\.##' VERSION])]", [The version of the package formatted for the scan result.]) AC_DEFINE(PACKAGE_VERSION_MAJOR, "[m4_esyscmd_s([sed -e 's#^\([0-9]*\)\..*$#\1#' VERSION])]", [The major version of the package.]) AC_DEFINE(PACKAGE_VERSION_MINOR, "[m4_esyscmd_s([sed -e 's#^.*\.\([0-9]*\)$#\1#' VERSION])]", [The minor version of the package.]) -AC_DEFINE(REVISION, "[m4_esyscmd_s([git describe --always 2>/dev/null || (date +p%Y%m%d)])]", [The revision of the package.]) - +AC_ARG_VAR(GIT_REVISION, [Predefined value to use for revision instead of running git describe.]) +if test -n "$GIT_REVISION"; then + AC_DEFINE(REVISION, [m4_esyscmd_s([echo "$GIT_REVISION"])], [The revision of the package.]) +else + AC_DEFINE(REVISION, "[m4_esyscmd_s([git describe --always 2>/dev/null || (date +p%Y%m%d)])]", [The revision of the package.]) +fi AC_CHECK_PROGS([HAVE_DOXYGEN], [doxygen], []) if test -z "$HAVE_DOXYGEN"; then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support.]) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 56823e40..a999bf35 100755 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -13,12 +13,14 @@ WORKDIR /build ARG TARGETARCH ARG TARGETVARIANT ARG EBUSD_VERSION +ARG GIT_REVISION ENV EBUSD_ARCH $TARGETARCH$TARGETVARIANT ENV EBUSD_VERSION $EBUSD_VERSION +ENV GIT_REVISION $GIT_REVISION ADD . /build -RUN RUNTEST=full ./make_debian.sh +RUN RUNTEST=full GIT_REVISION=$GIT_REVISION ./make_debian.sh diff --git a/contrib/docker/Dockerfile.release b/contrib/docker/Dockerfile.release index 8c66666d..f4315732 100644 --- a/contrib/docker/Dockerfile.release +++ b/contrib/docker/Dockerfile.release @@ -13,12 +13,14 @@ WORKDIR /build ARG TARGETARCH ARG TARGETVARIANT ARG EBUSD_VERSION +ARG GIT_REVISION ENV EBUSD_ARCH $TARGETARCH$TARGETVARIANT ENV EBUSD_VERSION $EBUSD_VERSION +ENV GIT_REVISION $GIT_REVISION ADD . /build -RUN ./make_debian.sh +RUN GIT_REVISION=$GIT_REVISION ./make_debian.sh diff --git a/contrib/docker/Dockerfile.template b/contrib/docker/Dockerfile.template index 82e7f6da..ae486783 100644 --- a/contrib/docker/Dockerfile.template +++ b/contrib/docker/Dockerfile.template @@ -13,9 +13,11 @@ WORKDIR /build ARG TARGETARCH ARG TARGETVARIANT ARG EBUSD_VERSION +ARG GIT_REVISION ENV EBUSD_ARCH $TARGETARCH$TARGETVARIANT ENV EBUSD_VERSION $EBUSD_VERSION +ENV GIT_REVISION $GIT_REVISION ADD . /build RUN %EBUSD_MAKE% diff --git a/contrib/docker/build.sh b/contrib/docker/build.sh index 6b241e43..e52965db 100755 --- a/contrib/docker/build.sh +++ b/contrib/docker/build.sh @@ -58,6 +58,7 @@ for image in $images; do --build-arg "UPLOAD_URL=$UPLOAD_URL" \ --build-arg "UPLOAD_CREDENTIALS=$UPLOAD_CREDENTIALS" \ --build-arg "UPLOAD_OS=$image" \ + --build-arg "GIT_REVISION=$GIT_REVISION" \ -t $tagprefix$tagsuffix \ $extratag \ $output \ diff --git a/contrib/docker/update.sh b/contrib/docker/update.sh index 5c8e02d8..65a4a0f6 100755 --- a/contrib/docker/update.sh +++ b/contrib/docker/update.sh @@ -15,7 +15,7 @@ function replaceTemplate () { # devel update version_variant='-devel' -make='RUNTEST=full ./make_debian.sh' +make='RUNTEST=full GIT_REVISION=\$GIT_REVISION ./make_debian.sh' upload_lines='' copydeb='COPY --from=build /build/ebusd-*_mqtt1.deb ebusd.deb' debsrc='ebusd.deb \&\& rm -f ebusd.deb' @@ -25,7 +25,7 @@ replaceTemplate # release update version_variant='' -make='./make_debian.sh' +make='GIT_REVISION=\$GIT_REVISION ./make_debian.sh' copydeb="ADD https://github.com/john30/ebusd/releases/download/v\${EBUSD_VERSION}/ebusd-\${EBUSD_VERSION}_\${TARGETARCH}\${TARGETVARIANT}-\${EBUSD_IMAGE}_mqtt1.deb ebusd.deb" copyentry='COPY contrib/docker/docker-entrypoint.sh /' namesuffix='.release' @@ -33,7 +33,7 @@ replaceTemplate if [[ -n "$1" ]]; then # build releases update - make='./make_all.sh' + make='GIT_REVISION=\$GIT_REVISION ./make_all.sh' upload_lines='ARG UPLOAD_URL\nARG UPLOAD_CREDENTIALS\nARG UPLOAD_OS\nRUN if [ -n "\$UPLOAD_URL" ] \&\& [ -n "\$UPLOAD_CREDENTIALS" ]; then for img in ebusd-*.deb; do echo -n "upload \$img: "; curl -fsSk -u "\$UPLOAD_CREDENTIALS" -X POST --data-binary "@\$img" -H "Content-Type: application/octet-stream" "\$UPLOAD_URL/\$img?a=\$EBUSD_ARCH\&o=\$UPLOAD_OS\&v=\$EBUSD_VERSION" || echo "failed"; done; fi' upload_lines+='\n\n\nFROM scratch as deb\nCOPY --from=build /build/*.deb /' namesuffix='.build' From 7488b656ae1300fbda0e39571f571207a0797b08 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 17 Jul 2022 11:17:42 +0200 Subject: [PATCH 08/10] updated --- ChangeLog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index bb9c2922..0ae200b4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,12 @@ +# 22.4 (tbd) +## Bug Fixes +* fix some smaller glitches +* fix revision in gh build for update check + +## Features +* add continuation of initial scan until it succeeded + + # 22.3 (2022-05-08) ## Bug Fixes * fix potential race condition in connection handling From 338c73f80307396815a8a896336db51d91b9e3a5 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 17 Jul 2022 11:28:27 +0200 Subject: [PATCH 09/10] fix missing dquote --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3664ecc2..4b86f923 100755 --- a/configure.ac +++ b/configure.ac @@ -139,7 +139,7 @@ AC_DEFINE(PACKAGE_VERSION_MAJOR, "[m4_esyscmd_s([sed -e 's#^\([0-9]*\)\..*$#\1#' AC_DEFINE(PACKAGE_VERSION_MINOR, "[m4_esyscmd_s([sed -e 's#^.*\.\([0-9]*\)$#\1#' VERSION])]", [The minor version of the package.]) AC_ARG_VAR(GIT_REVISION, [Predefined value to use for revision instead of running git describe.]) if test -n "$GIT_REVISION"; then - AC_DEFINE(REVISION, [m4_esyscmd_s([echo "$GIT_REVISION"])], [The revision of the package.]) + AC_DEFINE(REVISION, "[m4_esyscmd_s([echo "$GIT_REVISION"])]", [The revision of the package.]) else AC_DEFINE(REVISION, "[m4_esyscmd_s([git describe --always 2>/dev/null || (date +p%Y%m%d)])]", [The revision of the package.]) fi From 2cb186da46327d9a8e640ff02f183cdcbad4d2ee Mon Sep 17 00:00:00 2001 From: John Date: Sat, 30 Jul 2022 17:53:25 +0200 Subject: [PATCH 10/10] fix high-speed enhanced serial mode --- src/lib/ebus/device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ebus/device.cpp b/src/lib/ebus/device.cpp index 9c72be49..5d712042 100755 --- a/src/lib/ebus/device.cpp +++ b/src/lib/ebus/device.cpp @@ -134,8 +134,8 @@ Device* Device::create(const char* name, unsigned int extraLatency, bool checkDe free(in); return new NetworkDevice(name, hostOrIp, port, extraLatency, readOnly, initialSend, udp, enhanced); } - // support enh:/dev/ - return new SerialDevice(name, checkDevice, extraLatency, readOnly, initialSend, enhanced); + // support enh:/dev/, ens:/dev/, and /dev/ + return new SerialDevice(name, checkDevice, extraLatency, readOnly, initialSend, enhanced, highSpeed); } result_t Device::open() {