Skip to content

Commit

Permalink
Merge pull request #1763 from peternewman/master-resync
Browse files Browse the repository at this point in the history
Master resync
  • Loading branch information
peternewman committed Jan 20, 2022
2 parents 31bd61c + 2058e5c commit d1433a1
Show file tree
Hide file tree
Showing 30 changed files with 358 additions and 140 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/annotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 2.7
python-version: '2.7'
- name: Flake8 with annotations - Python 2
# Using the flake8 options in the .flake8 file
uses: TrueBrain/actions-flake8@main
Expand All @@ -18,9 +18,7 @@ jobs:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Flake8 with annotations - Python 3
# Using the flake8 options in the .flake8 file
uses: TrueBrain/actions-flake8@main
with:
only_warn: 1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ tools/ola_trigger/ola_trigger.exe
tools/ola_trigger/FileValidateTest.sh
tools/rdm/DataLocation.py
tools/rdm/ResponderTestTest.sh
tools/rdm/TestHelpersTest.sh
tools/rdm/TestStateTest.sh
tools/rdmpro/rdmpro_sniffer
tools/rdmpro/rdmpro_sniffer.exe
tools/slp/slp_client
Expand Down
12 changes: 10 additions & 2 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,24 @@ elif [[ $TASK = 'pychecker' ]]; then
travis_fold end "pychecker_a"
# More restricted checking for files that import files that break pychecker
travis_fold start "pychecker_b"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only $(find ./ -name "*.py" -and \( -wholename "./tools/rdm/ModelCollector.py" -or -wholename "./tools/rdm/DMXSender.py" -or -wholename "./tools/rdm/TestCategory.py" -or -wholename "./tools/rdm/TestHelpers.py" -or -wholename "./tools/rdm/TestState.py" -or -wholename "./tools/rdm/TimingStats.py" -or -wholename "./tools/rdm/list_rdm_tests.py" \) | xargs)
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only $(find ./ -name "*.py" -and \( -wholename "./tools/rdm/ModelCollector.py" -or -wholename "./tools/rdm/DMXSender.py" -or -wholename "./tools/rdm/TestCategory.py" -or -wholename "./tools/rdm/TestState.py" -or -wholename "./tools/rdm/TimingStats.py" -or -wholename "./tools/rdm/list_rdm_tests.py" \) | xargs)
travis_fold end "pychecker_b"
# Even more restricted checking for files that import files that break pychecker and have unused parameters
travis_fold start "pychecker_c"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only --no-argsused $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -name "ola_universe_info.py" -or -name "rdm_snapshot.py" -or -name "ClientWrapper.py" -or -name "PidStore.py" -or -name "enforce_licence.py" -or -name "ola_mon.py" -or -name "TestLogger.py" -or -name "TestRunner.py" -or -name "rdm_model_collector.py" -or -name "rdm_responder_test.py" -or -name "rdm_test_server.py" -or -wholename "./include/ola/gen_callbacks.py" \) | xargs)
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only --no-argsused $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -name "ola_universe_info.py" -or -name "rdm_snapshot.py" -or -name "ClientWrapper.py" -or -name "PidStore.py" -or -name "enforce_licence.py" -or -name "ola_mon.py" -or -name "TestLogger.py" -or -name "TestRunner.py" -or -name "rdm_model_collector.py" -or -name "rdm_responder_test.py" -or -name "rdm_test_server.py" -or -wholename "./include/ola/gen_callbacks.py" -or -wholename "./tools/rdm/ResponderTest.py" -or -wholename "./tools/rdm/TestHelpers.py" \) | xargs)
travis_fold end "pychecker_c"
# Special case checking for some python 3 compatibility workarounds
travis_fold start "pychecker_d"
pychecker --quiet --limit 500 --no-shadowbuiltin --no-noeffect ./include/ola/gen_callbacks.py
travis_fold end "pychecker_d"
# Special case checking for some python 3 compatibility workarounds that import files that break pychecker
travis_fold start "pychecker_e"
pychecker --quiet --limit 500 --only --no-shadowbuiltin --no-noeffect ./tools/rdm/TestHelpers.py
travis_fold end "pychecker_e"
# Extra special case checking for some python 3 compatibility workarounds that import files that break pychecker and have unused parameters
travis_fold start "pychecker_f"
pychecker --quiet --limit 500 --only --no-argsused --no-shadowbuiltin --no-noeffect ./tools/rdm/ResponderTest.py
travis_fold end "pychecker_f"
elif [[ $TASK = 'pychecker-wip' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
Expand Down
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ jobs:
- os: linux
dist: bionic
arch: arm64
env: TASK='check-licences'
env:
- TASK='check-licences'
- PYTHON='python3'
addons:
apt:
packages:
- *core_build
- *bionic_build_extras_python2
- *bionic_build_extras_python3
- os: linux
dist: bionic
arch: arm64
Expand Down Expand Up @@ -428,12 +430,6 @@ jobs:
- CPPUNIT='1.14'
- PROTOBUF='latest'
- LIBFTDI='1'
- os: linux
dist: bionic
arch: arm64
env:
- TASK='flake8'
- PYTHON='python3'
- os: linux
dist: bionic
arch: arm64
Expand Down
38 changes: 34 additions & 4 deletions common/io/ExtendedSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,26 @@
#ifdef HAVE_STROPTS_H
// this provides ioctl() definition without conflicting with asm/termios.h
#include <stropts.h>
#else
// otherwise use the sys/ioctl.h version for newer Linux which has dropped the
// stropts.h version
// N.B. This will pull in the kernel definition of struct termios, which may
// conflict with the libc version, so we wouldn't be able to use both in the
// same file
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif // HAVE_SYS_IOCTL_H
#ifdef HAVE_ASM_TERMBITS_H
#include <asm/termbits.h>
#endif // HAVE_ASM_TERMBITS_H
#endif // HAVE_STROPTS_H

#ifdef HAVE_ASM_TERMIOS_H
// use this not standard termios for custom baud rates
#if defined(HAVE_STROPTS_H) && defined(HAVE_ASM_TERMIOS_H)
// use this non-standard termios for custom baud rates
//
// On newer Linux, this duplicates winsize and termio as they're also defined
// in bits/ioctl-types.h, so only include this header if we also have the
// stropts.h sourced version of ioctl()
//
// On mips architectures, <asm/termios.h> sets some cpp macros which cause
// <cerrno> (included by <ostream>, used by <ola/Logging.h>) to not define
Expand All @@ -52,12 +68,15 @@ namespace ola {
namespace io {

bool LinuxHelper::SetDmxBaud(int fd) {
#if defined(HAVE_STROPTS_H) && defined(HAVE_TERMIOS2)
#if (defined(HAVE_STROPTS_H) || \
(defined(HAVE_SYS_IOCTL_H) && defined(HAVE_ASM_TERMBITS_H))) && \
defined(HAVE_TERMIOS2)
static const int rate = 250000;

struct termios2 tio; // linux-specific terminal stuff

if (ioctl(fd, TCGETS2, &tio) < 0) {
OLA_INFO << "Failed to get current serial port settings";
return false;
}

Expand All @@ -66,6 +85,7 @@ bool LinuxHelper::SetDmxBaud(int fd) {
tio.c_ispeed = rate;
tio.c_ospeed = rate; // set custom speed directly
if (ioctl(fd, TCSETS2, &tio) < 0) {
OLA_INFO << "Failed to update serial port settings";
return false;
}

Expand All @@ -79,9 +99,19 @@ bool LinuxHelper::SetDmxBaud(int fd) {
}
return true;
#else
OLA_INFO << "Failed to set baud rate, due to missing "
#if !defined(HAVE_STROPTS_H)
<< "stropts.h or "
#endif
#if !(defined(HAVE_SYS_IOCTL_H) && defined(HAVE_ASM_TERMBITS_H))
<< "sys/ioctl.h or asm/termbits.h or "
#endif
<< "termios2";
return false;
(void) fd;
#endif // defined(HAVE_STROPTS_H) && defined(HAVE_TERMIOS2)
#endif // (defined(HAVE_STROPTS_H) ||
// (defined(HAVE_SYS_IOCTL_H) && defined(HAVE_ASM_TERMBITS_H))) &&
// defined(HAVE_TERMIOS2)
}
} // namespace io
} // namespace ola
7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ AC_CHECK_HEADERS([arpa/inet.h bits/sockaddr.h fcntl.h float.h limits.h \
malloc.h netinet/in.h stdint.h stdlib.h string.h strings.h \
sys/file.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h \
syslog.h termios.h unistd.h])
AC_CHECK_HEADERS([asm/termios.h assert.h dlfcn.h endian.h execinfo.h \
linux/if_packet.h math.h net/ethernet.h stropts.h \
sys/param.h sys/types.h sys/uio.h sysexits.h])
AC_CHECK_HEADERS([asm/termbits.h asm/termios.h assert.h dlfcn.h endian.h \
execinfo.h linux/if_packet.h math.h net/ethernet.h \
stropts.h sys/ioctl.h sys/param.h sys/types.h sys/uio.h \
sysexits.h])
AC_CHECK_HEADERS([winsock2.h winerror.h])
AC_CHECK_HEADERS([random])

Expand Down
58 changes: 25 additions & 33 deletions include/ola/gen_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@


from __future__ import print_function
import sys
import textwrap


if sys.version_info >= (3, 0):
try:
xrange
except NameError:
xrange = range


def PrintLongLine(line):
optional_nolint = ''
if len(line) > 80:
Expand Down Expand Up @@ -171,11 +163,11 @@ def GenerateBase(number_of_args):
if number_of_args > 0:
optional_comma = ', '

typenames = ', '.join('typename Arg%d' % i for i in xrange(number_of_args))
arg_list = ', '.join('Arg%d arg%d' % (i, i) for i in xrange(number_of_args))
args = ', '.join('arg%d' % i for i in xrange(number_of_args))
typenames = ', '.join('typename Arg%d' % i for i in range(number_of_args))
arg_list = ', '.join('Arg%d arg%d' % (i, i) for i in range(number_of_args))
args = ', '.join('arg%d' % i for i in range(number_of_args))

arg_types = ', '.join('Arg%d' % i for i in xrange(number_of_args))
arg_types = ', '.join('Arg%d' % i for i in range(number_of_args))

# generate the base callback class
print(textwrap.dedent("""\
Expand Down Expand Up @@ -272,10 +264,10 @@ def GenerateHelperFunction(bind_count,
if bind_count > 0 or exec_count > 0:
optional_comma = ', '

typenames = (['typename A%d' % i for i in xrange(bind_count)] +
['typename Arg%d' % i for i in xrange(exec_count)])
bind_types = ['A%d' % i for i in xrange(bind_count)]
exec_types = ['Arg%d' % i for i in xrange(exec_count)]
typenames = (['typename A%d' % i for i in range(bind_count)] +
['typename Arg%d' % i for i in range(exec_count)])
bind_types = ['A%d' % i for i in range(bind_count)]
exec_types = ['Arg%d' % i for i in range(exec_count)]
method_types = ', '.join(bind_types + exec_types)
if exec_count > 0:
exec_types = [''] + exec_types
Expand All @@ -294,9 +286,9 @@ def GenerateHelperFunction(bind_count,
if is_method:
print(" * @tparam Class the class with the member function.")
print(" * @tparam ReturnType the return type of the callback.")
for i in xrange(bind_count):
for i in range(bind_count):
print(" * @tparam A%d a create-time argument type." % i)
for i in xrange(exec_count):
for i in range(exec_count):
print(" * @tparam Arg%d an exec-time argument type." % i)
if is_method:
print(" * @param object the object to call the member function on.")
Expand All @@ -305,7 +297,7 @@ def GenerateHelperFunction(bind_count,
else:
print(" * @param callback the function pointer to use when executing the "
"callback.")
for i in xrange(bind_count):
for i in range(bind_count):
print(" * @param a%d a create-time argument." % i)
if is_method:
print(" * @returns The same return value as the member function.")
Expand All @@ -320,7 +312,7 @@ def GenerateHelperFunction(bind_count,
print(' Class* object,')
if bind_count:
print(' ReturnType (%s)(%s),' % (signature, method_types))
for i in xrange(bind_count):
for i in range(bind_count):
suffix = ','
if i == bind_count - 1:
suffix = ') {'
Expand All @@ -340,13 +332,13 @@ def GenerateHelperFunction(bind_count,
print(' %sReturnType,' % padding)
else:
print(' %sReturnType>(' % padding)
for i in xrange(bind_count):
for i in range(bind_count):
if i == bind_count - 1 and exec_count == 0:
suffix = '>('
else:
suffix = ','
print(' %sA%d%s' % (padding, i, suffix))
for i in xrange(exec_count):
for i in range(exec_count):
suffix = ','
if i == exec_count - 1:
suffix = '>('
Expand All @@ -357,7 +349,7 @@ def GenerateHelperFunction(bind_count,
print(' %s,' % ptr_name)
else:
print(' %s);' % ptr_name)
for i in xrange(bind_count):
for i in range(bind_count):
suffix = ','
if i == bind_count - 1:
suffix = ');'
Expand All @@ -380,18 +372,18 @@ def GenerateMethodCallback(bind_count,
if bind_count > 0 or exec_count > 0:
optional_comma = ', '

typenames = (['typename A%d' % i for i in xrange(bind_count)] +
['typename Arg%d' % i for i in xrange(exec_count)])
typenames = (['typename A%d' % i for i in range(bind_count)] +
['typename Arg%d' % i for i in range(exec_count)])

bind_types = ['A%d' % i for i in xrange(bind_count)]
exec_types = ['Arg%d' % i for i in xrange(exec_count)]
bind_types = ['A%d' % i for i in range(bind_count)]
exec_types = ['Arg%d' % i for i in range(exec_count)]

method_types = ', '.join(bind_types + exec_types)
method_args = (['m_a%d' % i for i in xrange(bind_count)] +
['arg%d' % i for i in xrange(exec_count)])
method_args = (['m_a%d' % i for i in range(bind_count)] +
['arg%d' % i for i in range(exec_count)])

exec_args = ', '.join(['Arg%d arg%d' % (i, i) for i in xrange(exec_count)])
bind_args = ', '.join(['A%d a%d' % (i, i) for i in xrange(bind_count)])
exec_args = ', '.join(['Arg%d arg%d' % (i, i) for i in range(exec_count)])
bind_args = ', '.join(['A%d a%d' % (i, i) for i in range(bind_count)])

optional_class, method_or_function, class_name = (
'', 'Function', 'FunctionCallback')
Expand Down Expand Up @@ -431,7 +423,7 @@ def GenerateMethodCallback(bind_count,
print(' m_object(object),')
if bind_count:
print(' m_callback(callback),')
for i in xrange(bind_count):
for i in range(bind_count):
suffix = ','
if i == bind_count - 1:
suffix = ' {}'
Expand All @@ -450,7 +442,7 @@ def GenerateMethodCallback(bind_count,
if is_method:
print(' Class *m_object;')
print(' %s m_callback;' % method_or_function)
for i in xrange(bind_count):
for i in range(bind_count):
print(' A%d m_a%d;' % (i, i))
print('};')
print('')
Expand Down
2 changes: 1 addition & 1 deletion javascript/new-src/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# web-interface
the web interface for ola is build using
the web interface for ola is built using
- [angularjs](http://angularjs.com)
- [bootstrap](http://getbootstrap.com)
- [jquery](http://jquery.com)
Expand Down
2 changes: 1 addition & 1 deletion plugins/e131/E131Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool E131Plugin::StartHook() {

if (!StringToInt(m_preferences->GetValue(OUTPUT_PORT_COUNT_KEY),
&options.output_ports)) {
OLA_WARN << "Invalid value for input_ports";
OLA_WARN << "Invalid value for output_ports";
}

m_device = new E131Device(this, cid, ip_addr, m_plugin_adaptor, options);
Expand Down
4 changes: 2 additions & 2 deletions plugins/e131/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Enable the draft (2014) E1.31 discovery protocol.
Ignore preview data.

`input_ports = [int]`
The number of input ports to create up to a max of 32.
The number of input ports to create up to an arbitrary max of 512.

`ip = [a.b.c.d|<interface_name>]`
The IP address or interface name to bind to. If not specified it will use
the first non-loopback interface.

`output_ports = [int]`
The number of output ports to create up to a max of 32.
The number of output ports to create up to an arbitrary max of 512.

`prepend_hostname = [true|false]`
Prepend the hostname to the source name when sending packets.
Expand Down
1 change: 1 addition & 0 deletions plugins/ftdidmx/FtdiWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ void FtdiWidget::Widgets(vector<FtdiWidgetInfo> *widgets) {
<< sname << "', Serial: '" << sserial << "'";
ToUpper(&v);
if (std::string::npos != v.find("FTDI") ||
std::string::npos != v.find("JMS") ||
std::string::npos != v.find("KMTRONIC") ||
std::string::npos != v.find("KWMATIK") ||
std::string::npos != v.find("WWW.SOH.CZ")) {
Expand Down
2 changes: 1 addition & 1 deletion python/ola/ClientWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _CheckDescriptors(self, ready_set, all_descriptors):
runnable()

def _GetThreadID(self):
return threading.currentThread().ident
return threading.current_thread().ident

def _Stop(self):
self._quit = True
Expand Down
2 changes: 1 addition & 1 deletion python/ola/OlaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ def SendDmx(self, universe, data, callback=None):
controller = SimpleRpcController()
request = Ola_pb2.DmxData()
request.universe = universe
if sys.version >= '3.2':
if sys.version_info >= (3, 2):
request.data = data.tobytes()
else:
request.data = data.tostring()
Expand Down
Loading

0 comments on commit d1433a1

Please sign in to comment.