From e7bcd4e76619b8882d2744bb14afca3e38aff364 Mon Sep 17 00:00:00 2001 From: Ryan Oberholzer Date: Tue, 30 Aug 2016 10:46:37 -0400 Subject: [PATCH 1/7] Diagnostic requests now only show relevant response --- openxc/tools/diagnostics.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/openxc/tools/diagnostics.py b/openxc/tools/diagnostics.py index 929f2d6c..72fe7e17 100644 --- a/openxc/tools/diagnostics.py +++ b/openxc/tools/diagnostics.py @@ -39,8 +39,22 @@ def diagnostic_request(arguments, controller): wait_for_first_response=True) if len(responses) == 0: print("No response received before timeout") - for response in responses: - print("Response: %s" % response) + else: + for response in responses: + # After sending a diagnostic request, it will return with a signal message saying if the + # request was recieved. After that it used to show about 30 vehicle messages (rpm, speed, etc) + # with the actual diagnostic response mixed in. So, if the response length is more than + # 1, it's the response, if its less (only 1) it's the recieved message. + if len(response) > 1: + # Stripping all of the unnesseary data we get after sending a diag request in python + # Just like in enabler, it's a diag response if it contains the keys "mode", "bus", + # "id", and "success". + diagMsgReqKeys = ['mode', 'bus', 'id', 'success'] + indices = [i for i, s in enumerate(response) if all(x in s for x in diagMsgReqKeys)] + if indices: + print("Response: %s" % response[indices[0]]) + else: + print("Response: %s" % response) elif arguments.command == "cancel": if controller.delete_diagnostic_request(message, mode, bus=bus, pid=pid): From a1b08bafa8e208a3abb1ae24b94a5ccfcfa1875e Mon Sep 17 00:00:00 2001 From: Ryan Oberholzer Date: Tue, 30 Aug 2016 13:38:43 -0400 Subject: [PATCH 2/7] Added device platform command --- openxc/controllers/base.py | 8 ++++++++ openxc/tools/control.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openxc/controllers/base.py b/openxc/controllers/base.py index 89d9018a..d8cbb76c 100644 --- a/openxc/controllers/base.py +++ b/openxc/controllers/base.py @@ -356,6 +356,14 @@ def version(self): "command": "version" } return self._check_command_response_message(request) + + def platform(self): + """Request the VI platform. + """ + request = { + "command": "platform" + } + return self._check_command_response_message(request) def sd_mount_status(self): """Request for SD Mount status if available. diff --git a/openxc/tools/control.py b/openxc/tools/control.py index 9ecc48c7..f8726e59 100644 --- a/openxc/tools/control.py +++ b/openxc/tools/control.py @@ -17,6 +17,9 @@ def version(interface): print("Device is running version %s" % interface.version()) + +def platform(interface): + print("Device is a %s" % interface.platform()) def sd_mount_status(interface): result = interface.sd_mount_status() @@ -90,7 +93,7 @@ def parse_options(): parser = argparse.ArgumentParser(description="Send control messages to an " "attached OpenXC vehicle interface", parents=[device_options()]) parser.add_argument("command", type=str, - choices=['version', 'write', 'id', 'set', 'sd_mount_status']) + choices=['version', 'platform', 'write', 'id', 'set', 'sd_mount_status']) write_group = parser.add_mutually_exclusive_group() write_group.add_argument("--name", action="store", dest="write_name", help="name for message write request") @@ -141,6 +144,8 @@ def main(): if arguments.command == "version": version(interface) + elif arguments.command == "platform": + platform(interface) elif arguments.command == "sd_mount_status": sd_mount_status(interface) elif arguments.command == "id": From a84ceb7ebfaf5123d83e0ff39357ce4b25823ff5 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 10 Sep 2016 00:40:43 -0400 Subject: [PATCH 3/7] Drop support for Python 2.6, pin version of pyserial. pyserial no longer supports Python 2.6 (perhaps unintentionally - it is using Python 2.7+ style string formatting as of v3.1.1). In the interesting of looking to the future, we will use this opportunity to drop support for Python 2.6. Fixes #79. --- .travis.yml | 4 +--- CHANGELOG.rst | 5 +++++ README.rst | 2 +- docs/index.rst | 4 ++-- docs/installation.rst | 2 +- setup.py | 2 +- tox.ini | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84c38e44..b0c01109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,10 @@ language: python python: - - "2.6" - "2.7" before_install: - sudo apt-get update -qq - sudo apt-get install python-bluetooth -qq -y - - if [[ $TRAVIS_PYTHON_VERSION = '2.6' ]]; then pip install importlib; fi - - pip install pyserial + - pip install pyserial==3.1.1 - pip install coveralls install: pip install -q -e . script: python setup.py test diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e3ac9b5a..488b42d4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ OpenXC Python Library Changelog =============================== +v0.14.0-dev +---------- + +* Remove support for Python 2.6 + v0.13.0 ---------- diff --git a/README.rst b/README.rst index cef082a2..b6abdf1d 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ OpenXC for Python :target: http://python.openxcplatform.com :alt: Documentation Status -The OpenXC Python library (for Python 2.6 or 2.7) provides an interface to +The OpenXC Python library (for Python 2.7) provides an interface to vehicle data from the OpenXC Platform. The primary platform for OpenXC applications is Android, but for prototyping and testing, often it is preferrable to use a low-overhead environment like Python when developing. diff --git a/docs/index.rst b/docs/index.rst index 4d5ff242..3b518ae8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,7 +10,7 @@ OpenXC for Python :Documentation: http://python.openxcplatform.com :Source: http://github.com/openxc/openxc-python/ -The OpenXC Python library (for Python 2.6 or 2.7) provides an interface to +The OpenXC Python library (for Python 2.7) provides an interface to vehicle data from the OpenXC Platform. The primary platform for OpenXC applications is Android, but for prototyping and testing, often it is preferrable to use a low-overhead environment like Python when developing. @@ -19,7 +19,7 @@ In addition to a port of the Android library API, the package also contains a number of command-line tools for connecting to the vehicle interface and manipulating previously recorded vehicle data. -This Python package works with Python 2.6 and 2.7. Unfortunately we had to drop +This Python package works with Python 2.7. Unfortunately we had to drop support for Python 3 when we added the protobuf library as a dependency. For general documentation on the OpenXC platform, visit the main `OpenXC site`_. diff --git a/docs/installation.rst b/docs/installation.rst index 650841c2..ac302732 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -5,7 +5,7 @@ Install Python and Pip ---------------------- This library (obviously) requires a Python language runtime - the OpenXC library -currently works with Python 2.6 and 2.7, but not Python 3.x. +currently works with Python 2.7, but not Python 3.x. - **Mac OS X and Linux** diff --git a/setup.py b/setup.py index 707050bf..2f2c0f4c 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ tests_require=['nose'], install_requires=install_reqs, extras_require = { - 'serial': ["pyserial"], + 'serial': ["pyserial==3.1.1"], 'bluetooth': ["pybluez"], 'lxml': ["lxml"], }, diff --git a/tox.ini b/tox.ini index d4ea62bd..9bacdd66 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27 +envlist = py27 [testenv] commands = {envpython} setup.py test From a68382c8a7eaf88849fc557c418fa4e144381e19 Mon Sep 17 00:00:00 2001 From: kylewludwig Date: Fri, 14 Jul 2017 08:39:01 -0700 Subject: [PATCH 4/7] Updated command documentation to the current version * Corrected --message-id command to --message * Correct references of --network command to --network-host * Added a openxc-generate-firmware-code header and description * Updated to 2017 copyright date * Added openxc-control platform command *Clarified descriptions for the above commands --- README.rst | 3 ++- docs/conf.py | 2 +- docs/tools/codegen.rst | 2 +- docs/tools/control.rst | 27 ++++++++++++++++++++++----- docs/tools/diag.rst | 8 ++++---- docs/tools/scanner.rst | 2 +- docs/tools/tools.rst | 1 + 7 files changed, 32 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index b6abdf1d..02ca6ab1 100644 --- a/README.rst +++ b/README.rst @@ -30,9 +30,10 @@ In addition to a port of the Android library API, the package also contains a number of command-line tools for connecting to the CAN translator and manipulating previously recorded vehicle data. + License ======= -Copyright (c) 2012-2014 Ford Motor Company +Copyright (c) 2012-2017 Ford Motor Company Licensed under the BSD license. diff --git a/docs/conf.py b/docs/conf.py index 36a0b4c2..a6fc698e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,7 +41,7 @@ # General information about the project. project = u'OpenXC for Python' -copyright = u'2014, Ford Motor Company' +copyright = u'2017, Ford Motor Company' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/tools/codegen.rst b/docs/tools/codegen.rst index 09f1acb9..44095655 100644 --- a/docs/tools/codegen.rst +++ b/docs/tools/codegen.rst @@ -1,5 +1,5 @@ ============================================= -Vehicle Interface Firmware Configuration Tool +``openxc-generate-firmware-code`` - configure CAN messages, signals and buses ============================================= The `OpenXC vehicle interface diff --git a/docs/tools/control.rst b/docs/tools/control.rst index 4b3d0183..b2658d79 100644 --- a/docs/tools/control.rst +++ b/docs/tools/control.rst @@ -12,13 +12,18 @@ Basic use version -------- -Print the current firmware version and vehicle platform of the attached CAN +Print the current firmware version and firmware description of the attached CAN translator: .. code-block:: bash $ openxc-control version +An example response is ``v7.2.1 (default)``, where the ``default`` firmware +description can be modified in the JSON file via the ``"name"`` entry. +The first example in `Low-level CAN Features `_ +would return a value of ``passthrough``. + --- id --- @@ -30,6 +35,18 @@ the Bluetooth module. $ openxc-control id +--------- +platform +--------- + +Print the hardware platform of the vehicle interface. + +.. code-block:: bash + + $ openxc-control platform + +Supported platforms include ``CHIPKIT``, ``BLUEBOARD``, ``FORDBOARD``, ``CROSSCHASM_C5``, ``CROSSCHASM_C5_BT``, ``CROSSCHASM_C5_BLE``, and ``CROSSCHASM_C5_CELLULAR`` + --- set --- @@ -70,9 +87,9 @@ Set the host and port for the C5 Cellular device .. code-block:: bash - $ openxc-control set --host www.server.com --port 80 + $ openxc-control set --network-host www.server.com --port 80 -This will return true when successful. If host is supplied, but not port, +This will return true when successful. If network-host is supplied, but not port, port will default to 80. ------ @@ -116,11 +133,11 @@ a message with a lower ID using the extended frame format, you can use the sd_mount_status --------------- -This queries the device to see if the SD card is mounted correctly. +This queries the device to see if the SD card is mounted correctly. .. code-block:: bash - $ openxc-control sd_mount_status + $ openxc-control sd_mount_status This will return 'True' if the SD card is available for writing. Otherwise, it will return 'False'. diff --git a/docs/tools/diag.rst b/docs/tools/diag.rst index aa279f6a..63f5b4e8 100644 --- a/docs/tools/diag.rst +++ b/docs/tools/diag.rst @@ -10,7 +10,7 @@ Perform a single diagnostic request This example will add a new one-time diagnostic request - it will be sent once, and any respones will be printed to the terminal via stdout. The -``--message-id`` and ``--mode`` options are required. This particular request +``--message`` and ``--mode`` options are required. This particular request sends a functional broadcast request (ID ``0x7df``) for the mode 3 service, to store a "freeze frame". See the Unified Diagnostics Service and On-Board Diagnostics standards for more information on valid modes. @@ -20,7 +20,7 @@ bus if one is not specified. .. code-block:: bash - $ openxc-diag add --message-id 0x7df --mode 0x3 + $ openxc-diag add --message 0x7df --mode 0x3 .. note:: @@ -37,7 +37,7 @@ responses. .. code-block:: bash - $ openxc-diag add --message-id 0x7df --mode 0x1 --pid 0xc --frequency 1 + $ openxc-diag add --message 0x7df --mode 0x1 --pid 0xc --frequency 1 Cancel an existing recurring diagnostic request =============================================== @@ -48,7 +48,7 @@ and PID to identify a request. .. code-block:: bash - $ openxc-diag cancel --message-id 0x7df --mode 0x1 --pid 0xc + $ openxc-diag cancel --message 0x7df --mode 0x1 --pid 0xc Cancelling a non-recurring diagnostic request ========================================================= diff --git a/docs/tools/scanner.rst b/docs/tools/scanner.rst index b501be48..b3203875 100644 --- a/docs/tools/scanner.rst +++ b/docs/tools/scanner.rst @@ -35,7 +35,7 @@ If you wish to scan only a single message ID, you can skip right to it: .. code-block:: bash - $ openxc-scanner --message-id 0x7e0 + $ openxc-scanner --message 0x7e0 Command-line options ==================== diff --git a/docs/tools/tools.rst b/docs/tools/tools.rst index 4e284629..bc4607d0 100644 --- a/docs/tools/tools.rst +++ b/docs/tools/tools.rst @@ -12,6 +12,7 @@ explicitly set the protocol buffers: $ openxc-control set --bus 1 --passthrough --format protobuf +The following links describe the available openxc-python commands. .. toctree:: :maxdepth: 1 From 2d83c3795a17b8964fd06d9f2d78fb8ae66ba876 Mon Sep 17 00:00:00 2001 From: Eric Marsman Date: Fri, 14 Jul 2017 13:42:56 -0400 Subject: [PATCH 5/7] fix #91 by making file open w instead of wa --- openxc/sources/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openxc/sources/base.py b/openxc/sources/base.py index a838e97f..3f90c949 100644 --- a/openxc/sources/base.py +++ b/openxc/sources/base.py @@ -124,7 +124,7 @@ def __init__(self, source, mode="off"): if self.mode == "file": filename = "openxc-logs-%s.txt" % datetime.datetime.now().strftime( self.FILENAME_TEMPLATE) - self.file = open(filename, 'wa') + self.file = open(filename, 'w') def stop(self): self.running = False From 4ab03aacd4c47718223874435009fc2b5302b86c Mon Sep 17 00:00:00 2001 From: Eric Marsman Date: Fri, 21 Jul 2017 11:14:02 -0400 Subject: [PATCH 6/7] changelog.rst for current next state (#94) --- CHANGELOG.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 488b42d4..5c29517e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,11 @@ OpenXC Python Library Changelog v0.14.0-dev ---------- -* Remove support for Python 2.6 +* Fix: Remove support for Python 2.6 +* Fix: Diagnostic response cleanup +* Feature: Add "platform" command support +* Fix: Documentation improvements +* Fix: openxc-dump command file access v0.13.0 ---------- From d6f9edc8269a31cb5d58a0103b11ddc9e8774cdb Mon Sep 17 00:00:00 2001 From: Eric Marsman Date: Fri, 21 Jul 2017 11:15:50 -0400 Subject: [PATCH 7/7] Update version in README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 02ca6ab1..d8ed35a6 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ OpenXC for Python .. image:: /docs/_static/logo.png -:Version: 0.13.0 +:Version: 0.14.0-dev :Web: http://openxcplatform.com :Download: http://pypi.python.org/pypi/openxc/ :Documentation: http://python.openxcplatform.com