Skip to content

Commit

Permalink
Merge 2c1ec48 into 058fd20
Browse files Browse the repository at this point in the history
  • Loading branch information
bkuhls committed Jan 31, 2016
2 parents 058fd20 + 2c1ec48 commit 741d089
Show file tree
Hide file tree
Showing 43 changed files with 389 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .travis-ci.sh
Expand Up @@ -99,7 +99,7 @@ elif [[ $TASK = 'flake8' ]]; then
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for flake8 to run against
make builtfiles
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E121,E127,E129 data/rdm include/ola python scripts tools/ola_mon tools/rdm
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129 data/rdm include/ola python scripts tools/ola_mon tools/rdm
else
# Otherwise compile and check as normal
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-ja-rule'
Expand Down
16 changes: 16 additions & 0 deletions NEWS
@@ -1,3 +1,19 @@
x/y/2016 ola-0.10.1
Features:
*

API:
*

RDM Tests:
*

Bugs:
* Check if a device exists before trying to acquire a UUCP lock file for it #1006

Internal:
*

3/1/2016 ola-0.10.0
Features:
* Add better logging for open()
Expand Down
7 changes: 4 additions & 3 deletions README.developer
Expand Up @@ -49,14 +49,15 @@ root ola directory is guaranteed to work).
Branches, Versioning & Releases
-------------------------------

Version numbers take the form MAJOR.MINOR.PATCH. The release lifecycle is:
Version numbers take the form MAJOR.MINOR.PATCH based on http://semver.org/.
The release lifecycle is:

- New feature work occurs on the master branch.
- Once the new features are considered stable or enough time has passed, a new
minor release branch will be created, e.g. 0.9.
minor release branch will be created, e.g. 0.10.
- The minor release branch will be stablized with bugfixes, these bug fixes
will also be merged back into master.
- Once declared stable, a new patch branch 0 will be created e.g. 0.9.0
- Once declared stable, a new patch branch 0 will be created e.g. 0.10.0
- Release specific changes like the version number, debian files etc. will be
pushed to the patch branch.
- The release will occur.
Expand Down
11 changes: 9 additions & 2 deletions common/io/Serial.cpp
Expand Up @@ -22,8 +22,8 @@
#include <fcntl.h>
#include <signal.h>
#include <string.h>
#ifdef _WIN32
#include <sys/stat.h>
#ifdef _WIN32
#include <ola/win/CleanWindows.h>
#include <winioctl.h>
#else
Expand Down Expand Up @@ -143,7 +143,14 @@ bool AcquireUUCPLockAndOpen(const std::string &path, int oflag, int *fd) {
// If it was only a single process doing the locking we could use fnctl as
// described in 55.6 of the Linux Programing Interface book.

// First, clean up a stale lockfile.
// First, check if the path exists, there's no point trying to open it if not
if (!FileExists(path)) {
OLA_INFO << "Device " << path << " doesn't exist, so there's no point "
"trying to acquire a lock";
return false;
}

// Second, clean up a stale lockfile.
const string lock_file = GetLockFile(path);
OLA_DEBUG << "Checking for " << lock_file;
pid_t locked_pid;
Expand Down
3 changes: 3 additions & 0 deletions common/network/IPV4Address.cpp
Expand Up @@ -29,6 +29,9 @@
#endif
#endif

#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> // Required by FreeBSD
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
Expand Down
1 change: 1 addition & 0 deletions common/network/NetworkUtils.cpp
Expand Up @@ -55,6 +55,7 @@ typedef uint32_t in_addr_t;
// Do something else if we don't have Netlink/on Windows
#endif

#include <endian.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
Expand Down
4 changes: 2 additions & 2 deletions data/rdm/PidDataTest.py
Expand Up @@ -18,12 +18,12 @@

"""Test to check we can load the Pid data in Python."""

__author__ = 'nomis52@gmail.com (Simon Newton)'

import os
import unittest
from ola import PidStore

__author__ = 'nomis52@gmail.com (Simon Newton)'


class PidDataTest(unittest.TestCase):
# Implement assertIsNotNone for Python runtimes < 2.7 or < 3.1
Expand Down
1 change: 1 addition & 0 deletions plugins/spi/SPIWriter.cpp
Expand Up @@ -18,6 +18,7 @@
* Copyright (C) 2013 Simon Newton
*/

#include <linux/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/spi/spidev.h>
Expand Down
53 changes: 33 additions & 20 deletions python/examples/ola_artnet_params.py
Expand Up @@ -18,27 +18,40 @@

"""Fetch some ArtNet parameters."""

__author__ = 'nomis52@gmail.com (Simon Newton)'

from __future__ import print_function
from ola.ClientWrapper import ClientWrapper
from ola import ArtNetConfigMessages_pb2
import sys

__author__ = 'nomis52@gmail.com (Simon Newton)'


def ArtNetConfigureReply(status, response):
if status.Succeeded():
reply = ArtNetConfigMessages_pb2.Reply()
reply.ParseFromString(response)
print('Short Name: %s' % reply.options.short_name)
print('Long Name: %s' % reply.options.long_name)
print('Subnet: %d' % reply.options.subnet)
else:
print('Error: %s' % status.message, file=sys.stderr)

global wrapper
if wrapper:
wrapper.Stop()


def main():
# Set this appropriately
device_alias = 1
global wrapper
wrapper = ClientWrapper()
client = wrapper.Client()
artnet_request = ArtNetConfigMessages_pb2.Request()
artnet_request.type = artnet_request.ARTNET_OPTIONS_REQUEST
client.ConfigureDevice(device_alias, artnet_request.SerializeToString(),
ArtNetConfigureReply)
wrapper.Run()

def ArtNetConfigureReply(state, response):
reply = ArtNetConfigMessages_pb2.Reply()
reply.ParseFromString(response)
print('Short Name: %s' % reply.options.short_name)
print('Long Name: %s' % reply.options.long_name)
print('Subnet: %d' % reply.options.subnet)
wrapper.Stop()


# Set this appropriately
device_alias = 1
wrapper = ClientWrapper()
client = wrapper.Client()
artnet_request = ArtNetConfigMessages_pb2.Request()
artnet_request.type = artnet_request.ARTNET_OPTIONS_REQUEST
client.ConfigureDevice(device_alias, artnet_request.SerializeToString(),
ArtNetConfigureReply)
wrapper.Run()
if __name__ == '__main__':
main()
3 changes: 1 addition & 2 deletions python/examples/ola_candidate_ports.py
Expand Up @@ -50,8 +50,7 @@ def GetCandidatePortsCallback(status, devices):
'{p.supports_rdm}'
print(s.format(p=port))
else:
print('Error: {}'.format(status.message), file=sys.stderr)
wrapper.Stop()
print('Error: %s' % status.message, file=sys.stderr)


args = ParseArgs()
Expand Down
46 changes: 29 additions & 17 deletions python/examples/ola_devices.py
Expand Up @@ -18,9 +18,13 @@

"""Lists the devices / ports."""

from __future__ import print_function
from ola.ClientWrapper import ClientWrapper
import sys

__author__ = 'nomis52@gmail.com (Simon Newton)'

from ola.ClientWrapper import ClientWrapper
wrapper = None


def RDMString(port):
Expand All @@ -29,19 +33,27 @@ def RDMString(port):
return ''


def Devices(state, devices):
for device in sorted(devices):
print('Device %d: %s' % (device.alias, device.name))
print('Input ports:')
for port in device.input_ports:
print(' port %d, %s %s' % (port.id, port.description, RDMString(port)))
print('Output ports:')
for port in device.output_ports:
print(' port %d, %s %s' % (port.id, port.description, RDMString(port)))
wrapper.Stop()


wrapper = ClientWrapper()
client = wrapper.Client()
client.FetchDevices(Devices)
wrapper.Run()
def Devices(status, devices):
if status.Succeeded():
for device in sorted(devices):
print('Device %d: %s' % (device.alias, device.name))
print('Input ports:')
for port in device.input_ports:
print(' port %d, %s%s' % (port.id, port.description, RDMString(port)))
print('Output ports:')
for port in device.output_ports:
print(' port %d, %s%s' % (port.id, port.description, RDMString(port)))
else:
print('Error: %s' % status.message, file=sys.stderr)

global wrapper
if wrapper:
wrapper.Stop()


def main():
global wrapper
wrapper = ClientWrapper()
client = wrapper.Client()
client.FetchDevices(Devices)
wrapper.Run()
32 changes: 21 additions & 11 deletions python/examples/ola_patch_unpatch.py
Expand Up @@ -22,9 +22,12 @@
from ola.ClientWrapper import ClientWrapper
from ola.OlaClient import OlaClient
import argparse
import sys

__author__ = 'simon.marchi@polymtl.ca (Simon Marchi)'

wrapper = None


def ParseArgs():
description = 'Patch or unpatch an OLA port.'
Expand Down Expand Up @@ -55,18 +58,25 @@ def PatchPortCallback(status):
if status.Succeeded():
print('Success!')
else:
print('Oops: {}'.format(status.message))
print('Error: %s' % status.message, file=sys.stderr)
wrapper.Stop()

args = ParseArgs()

device = args.device
port = args.port
is_output = args.mode == 'output'
action = OlaClient.PATCH if args.action == 'patch' else OlaClient.UNPATCH
universe = args.universe
def main():
args = ParseArgs()

device = args.device
port = args.port
is_output = args.mode == 'output'
action = OlaClient.PATCH if args.action == 'patch' else OlaClient.UNPATCH
universe = args.universe

global wrapper
wrapper = ClientWrapper()
client = wrapper.Client()
client.PatchPort(device, port, is_output, action, universe, PatchPortCallback)
wrapper.Run()


wrapper = ClientWrapper()
client = wrapper.Client()
client.PatchPort(device, port, is_output, action, universe, PatchPortCallback)
wrapper.Run()
if __name__ == '__main__':
main()
30 changes: 24 additions & 6 deletions python/examples/ola_plugin_info.py
Expand Up @@ -18,12 +18,15 @@

"""Lists the loaded plugins."""

__author__ = 'nomis52@gmail.com (Simon Newton)'

from __future__ import print_function
from ola.ClientWrapper import ClientWrapper
import getopt
import textwrap
import sys
from ola.ClientWrapper import ClientWrapper

__author__ = 'nomis52@gmail.com (Simon Newton)'

wrapper = None


def Usage():
Expand All @@ -36,16 +39,30 @@ def Usage():
-p, --plugin <plugin_id> Plugin ID number."""))


def main():
def Plugins(state, plugins):
def Plugins(status, plugins):
if status.Succeeded():
for plugin in plugins:
print('%d %s' % (plugin.id, plugin.name))
else:
print('Error: %s' % status.message, file=sys.stderr)

global wrapper
if wrapper:
wrapper.Stop()

def PluginDescription(state, description):

def PluginDescription(status, description):
if status.Succeeded():
print(description)
else:
print('Error: %s' % status.message, file=sys.stderr)

global wrapper
if wrapper:
wrapper.Stop()


def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hp:", ["help", "plugin="])
except getopt.GetoptError as err:
Expand All @@ -61,6 +78,7 @@ def PluginDescription(state, description):
elif o in ("-p", "--plugin"):
plugin = int(a)

global wrapper
wrapper = ClientWrapper()
client = wrapper.Client()

Expand Down
4 changes: 2 additions & 2 deletions python/examples/ola_rdm_discover.py
Expand Up @@ -18,13 +18,13 @@

'''Show the UIDs for a universe.'''

__author__ = 'nomis52@gmail.com (Simon Newton)'

import getopt
import textwrap
import sys
from ola.ClientWrapper import ClientWrapper

__author__ = 'nomis52@gmail.com (Simon Newton)'


def Usage():
print(textwrap.dedent("""\
Expand Down
5 changes: 2 additions & 3 deletions python/examples/ola_rdm_get.py
Expand Up @@ -18,9 +18,6 @@

'''Get a PID from a UID.'''

__author__ = 'nomis52@gmail.com (Simon Newton)'


import cmd
import getopt
import os.path
Expand All @@ -33,6 +30,8 @@
from ola.RDMAPI import RDMAPI
from ola.UID import UID

__author__ = 'nomis52@gmail.com (Simon Newton)'


def Usage():
print(textwrap.dedent("""\
Expand Down

0 comments on commit 741d089

Please sign in to comment.