diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-05-26 10:38:07 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-07-06 13:59:56 -0400 |
commit | ca7d98904253c7404c3e6384ebb53d922a3c538a (patch) | |
tree | d82bc0b67481bef7d64c1b15bfc7636bb58b0955 /recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch | |
parent | 785dae680241b989b92725a57255b1df77486d4a (diff) |
kuksa-dbc-feeder: add recipe and dependencies
Add a kuksa-dbc-feeder recipe to build the sample CAN feeder for the
KUKSA.val Vehicle Information Service (VIS) server and add it to the
agl-demo-platform image by adding it to packagegroup-agl-ivi-services.
Local patches are applied to enable building with OpenEmbedded, make
installation into standard Linux FHS locations feasible, and improve
usability on target with respect to logging and error handling.
These will be discussed with upstream to hopefully get them
integrated.
Additional changes:
- Add a recipe for the required kuksa-viss-client Python module
included with the KUKSA.val source tree. The module is also
available via pypi.org, but keeping all the pieces in lockstep for
now seems better, so it is built out of a clone of the kuksa.val
repo using the same SRCREV as the server and kuksa-dbc-feeder.
- Add new recipes for required Python modules:
python3-argparse-addons, python3-can-j1939,
python3-py-expression-eval, python3-setuptools-git-versioning
These will be upstreamed to meta-python as time permits.
- Add bbappend for python3-cantools to add a missing runtime
dependencies discovered during testing. This will be addressed
upstream in meta-python as time permits.
- Add minimal DBC file and mapping configuration. At present the
agl-vcar.dbc file only contains the minimum message definitions
known to be required for the AGL demo platform, namely vehicle
and engine speeds and the steering wheel events.
- Add can-dev-helper recipe to install a systemd unit and script to
ensure a CAN interface is available for testing. This is a tweaked
version of what was previously used with agl-service-can-low-level.
Bug-AGL: SPEC-4405
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Ic48ea71761fe3767ca3c1711c60b47e0d329d9e7
Diffstat (limited to 'recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch')
-rw-r--r-- | recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch new file mode 100644 index 000000000..12e366aa8 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch @@ -0,0 +1,120 @@ +From fe10a3645e77cd8122d3d312d317bedcb88bc683 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Thu, 12 May 2022 17:39:56 +0200 +Subject: [PATCH] dbc2val: usability improvements + +Changes: +- Tweaked default configuration file search path to better match + Linux FHS and kuksa-val-server. First look for a config.ini in + /etc/kuksa-dbc-feeder, then /etc/dbc_feeder.ini. +- Added a command-line option to specify configuration file, this + should allow running two instances against different interfaces. +- Added verbosity command-line option and made several messages + verbose mode only to avoid log spamming. +- Added '-u' option to python invocation to disable output buffering. + The intent is to make logging immediate, otherwise errors may not + get logged for some time (or at all). +- Add catching of exceptions around CAN device opening so that the + script can exit cleanly with an error message if the device is + not available. + +Upstream-Status: pending +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + kuksa_feeders/dbc2val/dbcfeeder.py | 40 ++++++++++++++++++++++-------- + 1 file changed, 29 insertions(+), 11 deletions(-) + +diff --git a/kuksa_feeders/dbc2val/dbcfeeder.py b/kuksa_feeders/dbc2val/dbcfeeder.py +index 56c316a..d2d70b9 100755 +--- a/kuksa_feeders/dbc2val/dbcfeeder.py ++++ b/kuksa_feeders/dbc2val/dbcfeeder.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env -S python -u + + ######################################################################## + # Copyright (c) 2020 Robert Bosch GmbH +@@ -15,15 +15,21 @@ import os, sys, signal + import configparser + import queue + import json ++import argparse + + from dbc2val import dbc2vssmapper, dbcreader, j1939reader, elm2canbridge +- +-scriptDir= os.path.dirname(os.path.realpath(__file__)) +-sys.path.append(os.path.join(scriptDir, "../../")) + from kuksa_viss_client import KuksaClientThread + +-print("kuksa.val DBC example feeder") +-config_candidates=['/config/dbc_feeder.ini', '/etc/dbc_feeder.ini', os.path.join(scriptDir, 'config/dbc_feeder.ini')] ++parser = argparse.ArgumentParser("kuksa.val DBC example feeder") ++parser.add_argument("-c", "--config", dest="userconfig") ++parser.add_argument("-v", "--verbose", action="store_true") ++args = parser.parse_args() ++ ++if args.verbose: ++ print("kuksa.val DBC example feeder") ++config_candidates=['/etc/kuksa-dbc-feeder/config.ini', '/etc/dbc_feeder.ini'] ++if args.userconfig is not None: ++ config_candidates.insert(0, args.userconfig) + configfile = None + for candidate in config_candidates: + if os.path.isfile(candidate): +@@ -54,10 +60,12 @@ cancfg = config['can'] + canport = cancfg['port'] + + if config["can"].getboolean("j1939", False): +- print("Use j1939 reader") ++ if args.verbose: ++ print("Use j1939 reader") + reader = j1939reader.J1939Reader(cancfg,canQueue,mapping) + else: +- print("Use dbc reader") ++ if args.verbose: ++ print("Use dbc reader") + reader = dbcreader.DBCReader(cancfg, canQueue,mapping) + + if canport == 'elmcan': +@@ -65,10 +73,18 @@ if canport == 'elmcan': + print("section {} missing from configuration, exiting".format(canport)) + sys.exit(-1) + +- print("Using elmcan. Trying to set up elm2can bridge") ++ if args.verbose: ++ print("Using elmcan. Trying to set up elm2can bridge") + elmbr=elm2canbridge.elm2canbridge(canport, config[canport], reader.canidwl) + +-reader.start_listening() ++try: ++ reader.start_listening() ++except: ++ print("Could not open {}, exiting".format(canport)) ++ kuksa.stop() ++ reader.stop() ++ sys.exit(-1) ++ + running = True + + def terminationSignalreceived(signalNumber, frame): +@@ -77,6 +93,7 @@ def terminationSignalreceived(signalNumber, frame): + kuksa.stop() + reader.stop() + print("Received termination signal. Shutting down") ++ sys.exit(0) + + signal.signal(signal.SIGINT, terminationSignalreceived) + signal.signal(signal.SIGQUIT, terminationSignalreceived) +@@ -88,7 +105,8 @@ while running: + for target in mapping[signal]['targets']: + tv=mapping.transform(signal,target,value) + if tv is not None: #none indicates the transform decided to not set the value +- print("Update VSS path {} to {} based on signal {}".format(target, tv, signal)) ++ if args.verbose: ++ print("Update VSS path {} to {} based on signal {}".format(target, tv, signal)) + resp=json.loads(kuksa.setValue(target, str(tv))) + if "error" in resp: + if "message" in resp["error"]: +-- +2.35.1 + |