From e85896d4d10e11eb67a95c9c4ec31ffe47111d51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 21:38:12 +0000 Subject: [PATCH 1/7] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yaml | 4 ++-- .github/workflows/debian.yml | 4 ++-- .github/workflows/isort.yml | 2 +- .github/workflows/lint.yaml | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fb0bfe819e..8408df474e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -50,13 +50,13 @@ jobs: run: apt-get update -y # See comments beginning at # https://github.com/actions/runner/issues/763#issuecomment-1435474884 - # Without Git, actions/checkout@v3 will resort to REST and will not + # Without Git, actions/checkout@v4 will resort to REST and will not # create a .git folder or .git.config. The Problem Matcher looks for # .git/config to find where the root of the repo is, so it must be # present. - name: Install Git run: apt-get -y install git - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install build tools shell: bash run: | diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index dbf285ba85..0ae5317ba0 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -21,13 +21,13 @@ jobs: run: apt-get update -y # See comments beginning at # https://github.com/actions/runner/issues/763#issuecomment-1435474884 - # Without Git, actions/checkout@v3 will resort to REST and will not + # Without Git, actions/checkout@v4 will resort to REST and will not # create a .git folder or .git.config. The Problem Matcher looks for # .git/config to find where the root of the repo is, so it must be # present. - name: Install Git run: apt-get -y install git - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install build tools run: apt-get -y install devscripts adduser fakeroot sudo - name: Install build dependencies diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index f314e5b555..9aff6b16d1 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -8,5 +8,5 @@ jobs: isort: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: isort/isort-action@v1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 731f617f5c..0c49e768a0 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -10,13 +10,13 @@ jobs: run: apt-get update -y # See comments beginning at # https://github.com/actions/runner/issues/763#issuecomment-1435474884 - # Without Git, actions/checkout@v3 will resort to REST and will not + # Without Git, actions/checkout@v4 will resort to REST and will not # create a .git folder or .git.config. The Problem Matcher looks for # .git/config to find where the root of the repo is, so it must be # present. - name: Install Git run: apt-get -y install git - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install build tools shell: bash run: | @@ -260,7 +260,7 @@ jobs: name: weblint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Node.js v18 uses: actions/setup-node@v3 with: From d158bdde091363004c47c5272ea0e1d7a72f95d0 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 10 Jan 2020 05:08:51 +0000 Subject: [PATCH 2/7] Add the ability to set a universe to blackout instead via ola_set_dmx Currently untested (cherry picked from commit 54ac1fb6ec9376944b0aec0a8c12f0d1a74243a0) --- examples/ola-client.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/examples/ola-client.cpp b/examples/ola-client.cpp index f6eeab53c9..aa001d2d2e 100644 --- a/examples/ola-client.cpp +++ b/examples/ola-client.cpp @@ -84,6 +84,7 @@ typedef struct { string cmd; // argv[0] string uni_name; // universe name string dmx; // DMX string + bool blackout; ola::port_priority_mode priority_mode; // port priority mode uint8_t priority_value; // port priority value bool list_plugin_ids; @@ -304,6 +305,7 @@ void InitOptions(options *opts) { opts->port_direction = ola::client::OUTPUT_PORT; opts->device_id = INVALID_VALUE; opts->merge_mode = OlaUniverse::MERGE_HTP; + opts->blackout = false; opts->priority_mode = ola::PRIORITY_MODE_INHERIT; opts->priority_value = 0; } @@ -358,6 +360,7 @@ void ParseOptions(int argc, char *argv[], options *opts) { static struct option long_options[] = { {"dmx", required_argument, 0, 'd'}, + {"blackout", no_argument, 0, 'b'}, {"help", no_argument, 0, 'h'}, {"ltp", no_argument, 0, 'l'}, {"name", required_argument, 0, 'n'}, @@ -373,7 +376,7 @@ void ParseOptions(int argc, char *argv[], options *opts) { int option_index = 0; while (1) { - c = getopt_long(argc, argv, "ld:n:u:p:s:hv", long_options, &option_index); + c = getopt_long(argc, argv, "ld:bn:u:p:s:hv", long_options, &option_index); if (c == -1) break; @@ -384,6 +387,9 @@ void ParseOptions(int argc, char *argv[], options *opts) { case 'd': opts->dmx = optarg; break; + case 'b': + opts->blackout = true; + break; case 'h': opts->help = true; break; @@ -656,7 +662,8 @@ void DisplayUniverseMergeHelp(const options &opts) { * Help message for set dmx */ void DisplaySetDmxHelp(const options &opts) { - cout << "Usage: " << opts.cmd << " --universe --dmx \n" + cout << "Usage: " << opts.cmd << " --universe [ --dmx ] " + "[ --blackout ]\n" "\n" "Sets the DMX values for a universe.\n" "\n" @@ -665,6 +672,7 @@ void DisplaySetDmxHelp(const options &opts) { " -d, --dmx Comma separated DMX values, e.g. " "0,255,128 sets first channel to 0, second channel to 255" " and third channel to 128.\n" + " -b, --blackout Send a universe to blackout instead.\n" << endl; } @@ -857,9 +865,16 @@ int SendDmx(OlaClientWrapper *wrapper, const options &opts) { SelectServer *ss = wrapper->GetSelectServer(); OlaClient *client = wrapper->GetClient(); ola::DmxBuffer buffer; - bool status = buffer.SetFromString(opts.dmx); + bool status = false; + if (opts.blackout) { + status = buffer.Blackout(); + } else { + status = buffer.SetFromString(opts.dmx); + } - if (opts.uni < 0 || !status || buffer.Size() == 0) { + // A dmx string and blackout are mutually exclusive + if (opts.uni < 0 || !status || (opts.blackout && !opts.dmx.empty) || + buffer.Size() == 0) { DisplaySetDmxHelp(opts); exit(1); } From 1d1c91a8fd7ffaa0f9bcd34e1991d2d213c22370 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 10 Jan 2020 05:13:46 +0000 Subject: [PATCH 3/7] Update the man page (cherry picked from commit bdb844efb97c5961223222014dd4bf76f111123b) --- man/ola_set_dmx.1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/man/ola_set_dmx.1 b/man/ola_set_dmx.1 index 0de61b95f7..89f95379bb 100644 --- a/man/ola_set_dmx.1 +++ b/man/ola_set_dmx.1 @@ -4,7 +4,7 @@ ola_set_dmx \- Sets the DMX values for a universe. .SH SYNOPSIS .B ola_set_dmx -\fI--universe --dmx \fR +\fI--universe [ --dmx ] [ --blackout ]\fR .SH DESCRIPTION Sets the DMX values for a universe. .TP @@ -15,3 +15,7 @@ Display this help message and exit. .TP \fB\-d\fR, \fB\-\-dmx\fR Comma separated DMX values, e.g. 0,255,128 sets first channel to 0, second channel to 255 and third channel to 128. +.HP +\fB\-b\fR, \fB\-\-blackout\fR +Send a universe to blackout instead. +.TP From e22dbcb0fa5188aad0e8837886c3a7dbf4af6817 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Thu, 7 Sep 2023 16:00:58 +0100 Subject: [PATCH 4/7] Fix the compilation --- examples/ola-client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ola-client.cpp b/examples/ola-client.cpp index aa001d2d2e..c639889efd 100644 --- a/examples/ola-client.cpp +++ b/examples/ola-client.cpp @@ -873,7 +873,7 @@ int SendDmx(OlaClientWrapper *wrapper, const options &opts) { } // A dmx string and blackout are mutually exclusive - if (opts.uni < 0 || !status || (opts.blackout && !opts.dmx.empty) || + if (opts.uni < 0 || !status || (opts.blackout && !opts.dmx.empty()) || buffer.Size() == 0) { DisplaySetDmxHelp(opts); exit(1); From 8f5b1931dbc72136e821cf168f5338a6ae0e3290 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 19 Sep 2023 15:44:05 +0100 Subject: [PATCH 5/7] Do some minor formatting tweaks --- libs/acn/DMPE131Inflator.cpp | 67 +++++++++++++++++------------ libs/acn/DMPE131Inflator.h | 82 ++++++++++++++++++------------------ 2 files changed, 80 insertions(+), 69 deletions(-) diff --git a/libs/acn/DMPE131Inflator.cpp b/libs/acn/DMPE131Inflator.cpp index 3e11c3e4b2..58aea78a58 100644 --- a/libs/acn/DMPE131Inflator.cpp +++ b/libs/acn/DMPE131Inflator.cpp @@ -71,8 +71,9 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, return true; } - if (universe_iter == m_handlers.end()) + if (universe_iter == m_handlers.end()) { return true; + } DMPHeader dmp_header = headers.GetDMPHeader(); @@ -104,16 +105,17 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, if (address->Increment() != 1) { OLA_INFO << "E1.31 DMP packet with increment " << address->Increment() - << ", disarding"; + << ", disarding"; return true; } unsigned int length_remaining = pdu_len - available_length; int start_code = -1; - if (e131_header.UsingRev2()) + if (e131_header.UsingRev2()) { start_code = static_cast(address->Start()); - else if (length_remaining && address->Number()) + } else if (length_remaining && address->Number()) { start_code = *(data + available_length); + } // The only time we want to continue processing a non-0 start code is if it // contains a Terminate message. @@ -132,14 +134,16 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, // Reaching here means that we actually have new data and we should merge. if (target_buffer && start_code == 0) { unsigned int channels = std::min(length_remaining, address->Number()); - if (e131_header.UsingRev2()) + if (e131_header.UsingRev2()) { target_buffer->Set(data + available_length, channels); - else - target_buffer->Set(data + available_length + 1, channels - 1); + } else { + target_buffer->Set(data + available_length + 1, channels - 1); + } } - if (universe_iter->second.priority) + if (universe_iter->second.priority) { *universe_iter->second.priority = universe_iter->second.active_priority; + } // merge the sources switch (universe_iter->second.sources.size()) { @@ -156,8 +160,9 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, universe_iter->second.buffer->Reset(); std::vector::const_iterator source_iter = universe_iter->second.sources.begin(); - for (; source_iter != universe_iter->second.sources.end(); ++source_iter) + for (; source_iter != universe_iter->second.sources.end(); ++source_iter) { universe_iter->second.buffer->HTPMerge(source_iter->buffer); + } universe_iter->second.closure->Run(); } return true; @@ -175,8 +180,9 @@ bool DMPE131Inflator::SetHandler(uint16_t universe, ola::DmxBuffer *buffer, uint8_t *priority, ola::Callback0 *closure) { - if (!closure || !buffer) + if (!closure || !buffer) { return false; + } UniverseHandlers::iterator iter = m_handlers.find(universe); @@ -265,38 +271,41 @@ bool DMPE131Inflator::TrackSourceIfRequired( iter++; } - if (sources.empty()) + if (sources.empty()) { universe_data->active_priority = 0; + } for (iter = sources.begin(); iter != sources.end(); ++iter) { - if (iter->cid == headers.GetRootHeader().GetCid()) + if (iter->cid == headers.GetRootHeader().GetCid()) { break; + } } if (iter == sources.end()) { // This is an untracked source if (e131_header.StreamTerminated() || - priority < universe_data->active_priority) + priority < universe_data->active_priority) { return false; + } if (priority > universe_data->active_priority) { - OLA_INFO << "Raising priority for universe " << - e131_header.Universe() << " from " << - static_cast(universe_data->active_priority) << " to " << - static_cast(priority); + OLA_INFO << "Raising priority for universe " << e131_header.Universe() + << " from " << static_cast(universe_data->active_priority) + << " to " << static_cast(priority); sources.clear(); universe_data->active_priority = priority; } if (sources.size() == MAX_MERGE_SOURCES) { // TODO(simon): flag this in the export map - OLA_WARN << "Max merge sources reached for universe " << - e131_header.Universe() << ", " << - headers.GetRootHeader().GetCid().ToString() << " won't be tracked"; + OLA_WARN << "Max merge sources reached for universe " + << e131_header.Universe() << ", " + << headers.GetRootHeader().GetCid().ToString() + << " won't be tracked"; return false; } else { - OLA_INFO << "Added new E1.31 source: " << - headers.GetRootHeader().GetCid().ToString(); + OLA_INFO << "Added new E1.31 source: " + << headers.GetRootHeader().GetCid().ToString(); dmx_source new_source; new_source.cid = headers.GetRootHeader().GetCid(); new_source.sequence = e131_header.Sequence(); @@ -311,19 +320,21 @@ bool DMPE131Inflator::TrackSourceIfRequired( int8_t seq_diff = static_cast(e131_header.Sequence() - iter->sequence); if (seq_diff <= 0 && seq_diff > SEQUENCE_DIFF_THRESHOLD) { - OLA_INFO << "Old packet received, ignoring, this # " << - static_cast(e131_header.Sequence()) << ", last " << - static_cast(iter->sequence); + OLA_INFO << "Old packet received, ignoring, this # " + << static_cast(e131_header.Sequence()) << ", last " + << static_cast(iter->sequence); return false; } iter->sequence = e131_header.Sequence(); if (e131_header.StreamTerminated()) { - OLA_INFO << "CID " << headers.GetRootHeader().GetCid().ToString() << - " sent a termination for universe " << e131_header.Universe(); + OLA_INFO << "CID " << headers.GetRootHeader().GetCid().ToString() + << " sent a termination for universe " + << e131_header.Universe(); sources.erase(iter); - if (sources.empty()) + if (sources.empty()) { universe_data->active_priority = 0; + } // We need to trigger a merge here else the buffer will be stale, we keep // the buffer as NULL though so we don't use the data. return true; diff --git a/libs/acn/DMPE131Inflator.h b/libs/acn/DMPE131Inflator.h index 35b62d845b..e1185b653b 100644 --- a/libs/acn/DMPE131Inflator.h +++ b/libs/acn/DMPE131Inflator.h @@ -36,58 +36,58 @@ class DMPE131Inflator: public DMPInflator { friend class DMPE131InflatorTest; public: - explicit DMPE131Inflator(bool ignore_preview): - DMPInflator(), - m_ignore_preview(ignore_preview) { - } - ~DMPE131Inflator(); + explicit DMPE131Inflator(bool ignore_preview): + DMPInflator(), + m_ignore_preview(ignore_preview) { + } + ~DMPE131Inflator(); - bool SetHandler(uint16_t universe, ola::DmxBuffer *buffer, - uint8_t *priority, ola::Callback0 *handler); - bool RemoveHandler(uint16_t universe); + bool SetHandler(uint16_t universe, ola::DmxBuffer *buffer, + uint8_t *priority, ola::Callback0 *handler); + bool RemoveHandler(uint16_t universe); - void RegisteredUniverses(std::vector *universes); + void RegisteredUniverses(std::vector *universes); protected: - virtual bool HandlePDUData(uint32_t vector, - const HeaderSet &headers, - const uint8_t *data, - unsigned int pdu_len); + virtual bool HandlePDUData(uint32_t vector, + const HeaderSet &headers, + const uint8_t *data, + unsigned int pdu_len); private: - typedef struct { - ola::acn::CID cid; - uint8_t sequence; - TimeStamp last_heard_from; - DmxBuffer buffer; - } dmx_source; + typedef struct { + ola::acn::CID cid; + uint8_t sequence; + TimeStamp last_heard_from; + DmxBuffer buffer; + } dmx_source; - typedef struct { - DmxBuffer *buffer; - Callback0 *closure; - uint8_t active_priority; - uint8_t *priority; - std::vector sources; - } universe_handler; + typedef struct { + DmxBuffer *buffer; + Callback0 *closure; + uint8_t active_priority; + uint8_t *priority; + std::vector sources; + } universe_handler; - typedef std::map UniverseHandlers; + typedef std::map UniverseHandlers; - UniverseHandlers m_handlers; - bool m_ignore_preview; - ola::Clock m_clock; + UniverseHandlers m_handlers; + bool m_ignore_preview; + ola::Clock m_clock; - bool TrackSourceIfRequired(universe_handler *universe_data, - const HeaderSet &headers, - DmxBuffer **buffer); + bool TrackSourceIfRequired(universe_handler *universe_data, + const HeaderSet &headers, + DmxBuffer **buffer); - // The max number of sources we'll track per universe. - static const uint8_t MAX_MERGE_SOURCES = 6; - // The max merge priority. - static const uint8_t MAX_E131_PRIORITY = 200; - // ignore packets that differ by less than this amount from the last one - static const int8_t SEQUENCE_DIFF_THRESHOLD = -20; - // expire sources after 2.5s - static const TimeInterval EXPIRY_INTERVAL; + // The max number of sources we'll track per universe. + static const uint8_t MAX_MERGE_SOURCES = 6; + // The max merge priority. + static const uint8_t MAX_E131_PRIORITY = 200; + // ignore packets that differ by less than this amount from the last one + static const int8_t SEQUENCE_DIFF_THRESHOLD = -20; + // expire sources after 2.5s + static const TimeInterval EXPIRY_INTERVAL; }; } // namespace acn } // namespace ola From 030a4fdb0348898ab6dbba546643890567b02b21 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Wed, 20 Sep 2023 11:23:16 +0100 Subject: [PATCH 6/7] Fix a lint issue and another minor tidy --- libs/acn/DMPE131Inflator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/acn/DMPE131Inflator.cpp b/libs/acn/DMPE131Inflator.cpp index 58aea78a58..ed011161d8 100644 --- a/libs/acn/DMPE131Inflator.cpp +++ b/libs/acn/DMPE131Inflator.cpp @@ -159,8 +159,9 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, // HTP Merge universe_iter->second.buffer->Reset(); std::vector::const_iterator source_iter = - universe_iter->second.sources.begin(); - for (; source_iter != universe_iter->second.sources.end(); ++source_iter) { + universe_iter->second.sources.begin(); + for (; source_iter != universe_iter->second.sources.end(); + ++source_iter) { universe_iter->second.buffer->HTPMerge(source_iter->buffer); } universe_iter->second.closure->Run(); From 66923704b6f5a21ae2b5cc09fa05b6b9b7368f58 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Thu, 19 Oct 2023 20:07:11 +0000 Subject: [PATCH 7/7] Fix spelling/grammar in RPC error message --- common/rpc/RpcChannel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/rpc/RpcChannel.cpp b/common/rpc/RpcChannel.cpp index 7d1c81d6fd..10b5211e93 100644 --- a/common/rpc/RpcChannel.cpp +++ b/common/rpc/RpcChannel.cpp @@ -166,7 +166,7 @@ void RpcChannel::DescriptorReady() { m_buffer_size = AllocateMsgBuffer(m_expected_size); if (m_buffer_size < m_expected_size) { - OLA_WARN << "buffer size to small " << m_buffer_size << " < " << + OLA_WARN << "buffer size too small: " << m_buffer_size << " < " << m_expected_size; return; }