diff options
author | 2024-06-18 16:30:05 -0400 | |
---|---|---|
committer | 2024-06-20 02:04:33 +0000 | |
commit | ec74e53f95f8a860bad8036ac492ae4a328f6b0c (patch) | |
tree | 3c3b64b2e165b6e265004b0f7a8c09972c0aefa1 /recipes-connectivity/kuksa-val | |
parent | d9f9ddd177a57110d9c67ea438436c3160f8e429 (diff) |
kuksa-dbc-feeder: Upgrade to kuksa-can-provider 0.4.3
Upgrade kuksa-dbc-feeder to 0.4.3 release, which includes a rename
to kuksa-can-provider and a new location on github. All references
to kuksa-dbc-feeder have been renamed throughout the tree to
hopefully maintain consistency, though note that the actual script
name upstream remains "dbcfeeder.py" at present.
Bug-AGL: SPEC-5179
Change-Id: I88cf1c29187ad6cb882ee538a98e6e138aa76bfa
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/30002
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Tested-by: Jenkins Job builder account
Diffstat (limited to 'recipes-connectivity/kuksa-val')
30 files changed, 406 insertions, 367 deletions
diff --git a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.service b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.service index 04e6a9c3..cc3b629a 100644 --- a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.service +++ b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.service @@ -1,6 +1,6 @@ [Unit] Description=CAN interface helper -Before=kuksa-dbc-feeder.service +Before=kuksa-can-provider.service [Service] ExecStart=/usr/sbin/can-dev-helper.sh diff --git a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh index d57604c0..ecac5cb7 100644 --- a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh +++ b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh @@ -2,7 +2,7 @@ # # Script to bring up CAN interface configured for the kuksa.val -# CAN feeder in /etc/kuksa-dbc-feeder/dbc_feeder.ini as vcan +# CAN provider in /etc/kuksa-can-provider/dbc_feeder.ini as vcan # interfaces if no physical interface is present. # @@ -14,7 +14,7 @@ vcan_up() { fi } -CONF=/etc/kuksa-dbc-feeder/config.ini +CONF=/etc/kuksa-can-provider/config.ini if [ $# -gt 0 ]; then CONF=$1 fi diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-control-panel.bb b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-control-panel.bb new file mode 100644 index 00000000..eba5f84c --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-control-panel.bb @@ -0,0 +1,25 @@ +SUMMARY = "KUKSA.val CAN provider configuration for gateway demo control panel" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://kuksa-can-provider.control-panel" + +S = "${WORKDIR}" + +inherit update-alternatives + +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/kuksa-can-provider.control-panel ${D}${sysconfdir}/default/ +} + +ALTERNATIVE_LINK_NAME[kuksa-can-provider.env] = "${sysconfdir}/default/kuksa-can-provider" + +RPROVIDES:${PN} = "kuksa-can-provider.env" +ALTERNATIVE:${PN} = "kuksa-can-provider.env" +ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-can-provider.control-panel" + +RDEPENDS:${PN} += "kuksa-can-provider" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-control-panel/kuksa-dbc-feeder.control-panel b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-control-panel/kuksa-can-provider.control-panel index 8e73a890..613f483c 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-control-panel/kuksa-dbc-feeder.control-panel +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-control-panel/kuksa-can-provider.control-panel @@ -1,4 +1,4 @@ # Leave DBC input disabled until cruise support is added to the # control panel simulator -EXTRA_ARGS="--val2dbc --no-dbc2val --dbc-default /etc/kuksa-dbc-feeder/dbc_default_values.json" +EXTRA_ARGS="--val2dbc --no-dbc2val --dbc-default /etc/kuksa-can-provider/dbc_default_values.json" #LOG_LEVEL=debug diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-control-panel.bb b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-control-panel.bb new file mode 100644 index 00000000..02483a87 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-control-panel.bb @@ -0,0 +1,25 @@ +SUMMARY = "KUKSA.val CAN provider configuration for gateway demo" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://kuksa-can-provider.gw-control-panel" + +S = "${WORKDIR}" + +inherit update-alternatives + +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/kuksa-can-provider.gw-control-panel ${D}${sysconfdir}/default/ +} + +ALTERNATIVE_LINK_NAME[kuksa-can-provider.env] = "${sysconfdir}/default/kuksa-can-provider" + +RPROVIDES:${PN} = "kuksa-can-provider.env" +ALTERNATIVE:${PN} = "kuksa-can-provider.env" +ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-can-provider.gw-control-panel" + +RDEPENDS:${PN} += "kuksa-can-provider" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-control-panel/kuksa-dbc-feeder.gw-control-panel b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-control-panel/kuksa-can-provider.gw-control-panel index d6d2e607..a01dd9f0 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-control-panel/kuksa-dbc-feeder.gw-control-panel +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-control-panel/kuksa-can-provider.gw-control-panel @@ -1,4 +1,4 @@ # Leave DBC output disabled until cruise support is added to the # control panel simulator -EXTRA_ARGS="--no-val2dbc --dbc2val --dbc-default /etc/kuksa-dbc-feeder/dbc_default_values.json" +EXTRA_ARGS="--no-val2dbc --dbc2val --dbc-default /etc/kuksa-can-provider/dbc_default_values.json" #LOG_LEVEL=debug diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware.bb b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware.bb new file mode 100644 index 00000000..1275235f --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware.bb @@ -0,0 +1,32 @@ +SUMMARY = "KUKSA.val CAN provider configuration for gateway demo (secondary CAN interface)" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://kuksa-can-provider.gw-hardware \ + file://config.ini.gw-hardware \ + file://kuksa-can-provider-can1.service \ +" + +S = "${WORKDIR}" + +inherit systemd update-alternatives + +SYSTEMD_SERVICE:${PN} = "kuksa-can-provider-can1.service" + +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/kuksa-can-provider.gw-hardware ${D}${sysconfdir}/default/ + install -d ${D}${sysconfdir}/kuksa-can-provider + install -m 0644 ${WORKDIR}/config.ini.gw-hardware ${D}${sysconfdir}/kuksa-can-provider/ + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/kuksa-can-provider-can1.service ${D}${systemd_system_unitdir} + fi +} + +FILES:${PN} += "${systemd_system_unitdir}" + +RDEPENDS:${PN} += "kuksa-can-provider vss-agl-gw-hardware" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/config.ini.gw-hardware b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/config.ini.gw-hardware index ee3541a5..6f29d121 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/config.ini.gw-hardware +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/config.ini.gw-hardware @@ -19,7 +19,7 @@ tls = True root_ca_path=/etc/kuksa-val/CA.pem # Token file for authorization. -token = /etc/kuksa-dbc-feeder/dbc_feeder.token +token = /etc/kuksa-can-provider/dbc_feeder.token [can] # CAN port @@ -27,4 +27,4 @@ port = can1 # Enable SAE-J1939 Mode. False: ignore j1939 = False # DBC file used to parse CAN messages -dbcfile = /etc/kuksa-dbc-feeder/agl-vcar.dbc +dbcfile = /etc/kuksa-can-provider/agl-vcar.dbc diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/kuksa-dbc-feeder-can1.service b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/kuksa-can-provider-can1.service index 6f123dd5..6eb5b034 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/kuksa-dbc-feeder-can1.service +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/kuksa-can-provider-can1.service @@ -1,10 +1,10 @@ [Unit] -Description=Eclipse KUKSA.val DBC feeder (can1) +Description=Eclipse KUKSA.val CAN provider (can1) Requires=kuksa-databroker.service can-dev-helper.service After=kuksa-databroker.service can-dev-helper.service [Service] -EnvironmentFile=-/etc/default/kuksa-dbc-feeder.gw-hardware +EnvironmentFile=-/etc/default/kuksa-can-provider.gw-hardware ExecStart=/usr/bin/dbcfeeder.py $EXTRA_ARGS Restart=on-failure diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/kuksa-can-provider.gw-hardware b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/kuksa-can-provider.gw-hardware new file mode 100644 index 00000000..7a11d5ca --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider-conf-gw-hardware/kuksa-can-provider.gw-hardware @@ -0,0 +1,3 @@ +# DBC input for steering wheel, output for HVAC +EXTRA_ARGS="--val2dbc --dbc2val --dbc-default /etc/kuksa-can-provider/dbc_default_values.json --config /etc/kuksa-can-provider/config.ini.gw-hardware" +#LOG_LEVEL=debug diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch b/recipes-connectivity/kuksa-val/kuksa-can-provider/0001-dbc2val-add-installation-mechanism.patch index 58ad3259..6a9c1ba1 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/0001-dbc2val-add-installation-mechanism.patch @@ -1,7 +1,7 @@ -From d23ce9baabaabff17a4bf6050462edd11feb7cef Mon Sep 17 00:00:00 2001 +From 73dd680486b72d15d6f4c7aa129219ecdbcbd7b2 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> Date: Wed, 19 Apr 2023 15:55:01 -0400 -Subject: [PATCH] dbc2val: add installation mechanism +Subject: [PATCH 1/4] dbc2val: add installation mechanism Add setup.py and setup.cfg to allow installing the dbcfeederlib module and dbcfeeder.py in a way suitable for packaging. @@ -9,32 +9,30 @@ module and dbcfeeder.py in a way suitable for packaging. Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> - - --- - dbc2val/setup.cfg | 30 ++++++++++++++++++++++++++++++ - dbc2val/setup.py | 14 ++++++++++++++ + setup.cfg | 30 ++++++++++++++++++++++++++++++ + setup.py | 14 ++++++++++++++ 2 files changed, 44 insertions(+) - create mode 100644 dbc2val/setup.cfg - create mode 100644 dbc2val/setup.py + create mode 100644 setup.cfg + create mode 100644 setup.py -diff --git a/dbc2val/setup.cfg b/dbc2val/setup.cfg +diff --git a/setup.cfg b/setup.cfg new file mode 100644 -index 0000000..03dc6d6 +index 0000000..cb64407 --- /dev/null -+++ b/dbc2val/setup.cfg ++++ b/setup.cfg @@ -0,0 +1,30 @@ +[metadata] +name = dbcfeeder +author = Sebastian Schildt, Naresh Nayak, Wenwen Chen +author_email = sebastian.schildt@de.bosch.com, naresh.nayak@de.bosch.com, wenwen.chen@de.bosch.com -+description = kuksa.val DBC feeder ++description = KUKSA.val CAN provider +long_description = file:README.md +long_description_content_type = text/markdown -+url=https://github.com/eclipse/kuksa.val.feeders ++url=https://github.com/eclipse-kuksa/kuksa-can-provider +project_urls= -+ Source=https://github.com/eclipse/kuksa.val.feeders/tree/master/dbc2val -+ Bug Tracker=https://github.com/eclipse/kuksa.val.feeders/issues ++ Source=https://github.com/eclipse-kuksa/kuksa-can-provider ++ Bug Tracker=https://github.com/eclipse-kuksa/kuksa-can-provider/issues +classifiers = + Intended Audience :: Developers + Development Status :: 3 - Alpha @@ -44,7 +42,7 @@ index 0000000..03dc6d6 + Operating System :: OS Independent + Topic :: Software Development + -+license_file = ../LICENSE.txt ++license_file = LICENSE + +[options] +python_requires = >=3.6 @@ -54,11 +52,11 @@ index 0000000..03dc6d6 + kuksa-client +packages=dbcfeederlib +scripts=dbcfeeder.py -diff --git a/dbc2val/setup.py b/dbc2val/setup.py +diff --git a/setup.py b/setup.py new file mode 100644 -index 0000000..65f9157 +index 0000000..c5fb2b7 --- /dev/null -+++ b/dbc2val/setup.py ++++ b/setup.py @@ -0,0 +1,14 @@ +from setuptools import setup + @@ -74,3 +72,6 @@ index 0000000..65f9157 + }, + setup_requires=['setuptools-git-versioning'], +) +-- +2.44.0 + diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider/0002-dbc2val-usability-improvements.patch b/recipes-connectivity/kuksa-val/kuksa-can-provider/0002-dbc2val-usability-improvements.patch new file mode 100644 index 00000000..91a30924 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/0002-dbc2val-usability-improvements.patch @@ -0,0 +1,80 @@ +From 2e4e1f9147f1ebe5b545ae0cab41341e3abb00ae Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Sat, 15 Jun 2024 13:13:17 -0400 +Subject: [PATCH 2/4] dbc2val: usability improvements + +Changes: +- Tweaked default configuration file search path to better match + Linux FHS. First look for a config.ini or dbc_feeder.ini in + /etc/kuksa-can-provider, then fall back to /etc/dbc_feeder.ini + before using trying other possible paths. +- 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. +- Tweaked DBC default value file command line argument parsing so + that it does not attempt to fallback to "dbc_default_values.json" + in the current working directory. That likely works for upstream + test scenarios, but prevents running on a target. + +Upstream-Status: pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + dbcfeeder.py | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/dbcfeeder.py b/dbcfeeder.py +index a1ef174..c252503 100755 +--- a/dbcfeeder.py ++++ b/dbcfeeder.py +@@ -144,7 +144,11 @@ class Feeder: + whitelisted_frame_ids.append(filter.can_id) # type: ignore + elm2canbridge.elm2canbridge(canport, self._elmcan_config, whitelisted_frame_ids) + +- self._reader.start() ++ try: ++ self._reader.start() ++ except: ++ log.error("Could not open %s, exiting", canport) ++ sys.exit(-1) + + receiver = threading.Thread(target=self._run_receiver) + receiver.start() +@@ -165,7 +169,12 @@ class Feeder: + # For now creating another bus + # Maybe support different buses for downstream/upstream in the future + +- self._canclient = CANClient(interface="socketcan", channel=canport, can_fd=can_fd) ++ self._canclient = None ++ try: ++ self._canclient = CANClient(interface="socketcan", channel=canport, can_fd=can_fd) ++ except: ++ log.error("Could not open %s, exiting", canport) ++ sys.exit(-1) + + transmitter = threading.Thread(target=self._run_transmitter) + transmitter.start() +@@ -335,8 +344,10 @@ def _parse_config(filename: str) -> configparser.ConfigParser: + configfile = filename + else: + config_candidates = [ +- "/config/dbc_feeder.ini", ++ "/etc/kuksa-can-provider/config.ini", ++ "/etc/kuksa-can-provider/dbc_feeder.ini", + "/etc/dbc_feeder.ini", ++ "/config/dbc_feeder.ini", + "config/dbc_feeder.ini", + ] + for candidate in config_candidates: +@@ -534,7 +545,7 @@ def main(argv): + elif os.environ.get("DBC_DEFAULT_FILE"): + dbc_default = os.environ.get("DBC_DEFAULT_FILE") + else: +- dbc_default = config.get(CONFIG_SECTION_CAN, CONFIG_OPTION_DBC_DEFAULT_FILE, fallback="dbc_default_values.json") ++ dbc_default = config.get(CONFIG_SECTION_CAN, CONFIG_OPTION_DBC_DEFAULT_FILE, fallback=None) + + if args.mapping: + mappingfile = args.mapping +-- +2.44.0 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-fix-token-file-configuration-option.patch b/recipes-connectivity/kuksa-val/kuksa-can-provider/0003-dbc2val-fix-token-file-configuration-option.patch index aae8b3dc..faf94e0a 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-fix-token-file-configuration-option.patch +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/0003-dbc2val-fix-token-file-configuration-option.patch @@ -1,7 +1,7 @@ -From dc20da27a73141b04cc6b0ce5d74e547d6fc7256 Mon Sep 17 00:00:00 2001 +From 0b5822c6a8f8fa489bc7ae67f91284ac150f6518 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Mon, 8 May 2023 14:58:06 -0400 -Subject: [PATCH] dbc2val: fix token file configuration option +Date: Sat, 15 Jun 2024 13:18:08 -0400 +Subject: [PATCH 3/4] dbc2val: fix token file configuration option The client library changed the token option name to 'token_or_tokenfile', update things to match so that token @@ -10,16 +10,15 @@ location can be configured again for dbcfeeder.py. Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> - --- - dbc2val/dbcfeederlib/serverclientwrapper.py | 2 +- + dbcfeederlib/serverclientwrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/dbc2val/dbcfeederlib/serverclientwrapper.py b/dbc2val/dbcfeederlib/serverclientwrapper.py -index 1219a76..63bc12e 100644 ---- a/dbc2val/dbcfeederlib/serverclientwrapper.py -+++ b/dbc2val/dbcfeederlib/serverclientwrapper.py -@@ -59,7 +59,7 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): +diff --git a/dbcfeederlib/serverclientwrapper.py b/dbcfeederlib/serverclientwrapper.py +index 498e1b6..fa43d28 100644 +--- a/dbcfeederlib/serverclientwrapper.py ++++ b/dbcfeederlib/serverclientwrapper.py +@@ -56,7 +56,7 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): self._client_config["insecure"] = not self._tls # Do not set token if it is empty to allow default client lib info to be used if self._token_path != "": @@ -28,3 +27,6 @@ index 1219a76..63bc12e 100644 if self._root_ca_path: self._client_config['cacertificate'] = self._root_ca_path +-- +2.44.0 + diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider/0004-Enable-val2dbc-for-sensor-values.patch b/recipes-connectivity/kuksa-val/kuksa-can-provider/0004-Enable-val2dbc-for-sensor-values.patch new file mode 100644 index 00000000..e45fb4cf --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/0004-Enable-val2dbc-for-sensor-values.patch @@ -0,0 +1,174 @@ +From 937218a357ac1914fe410cf3ad31a67d54a63270 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Mon, 17 Jun 2024 17:07:44 -0400 +Subject: [PATCH 4/4] Enable val2dbc for sensor values + +Rework to allow val2dbc mode to write out sensor values in +addition to actuator target values. + +Upstream-Status: pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + dbcfeeder.py | 8 ++++++-- + dbcfeederlib/databrokerclientwrapper.py | 18 ++++++++++++------ + dbcfeederlib/dbc2vssmapper.py | 21 ++++++++++----------- + dbcfeederlib/serverclientwrapper.py | 2 +- + mapping/README.md | 2 -- + 5 files changed, 29 insertions(+), 22 deletions(-) + +diff --git a/dbcfeeder.py b/dbcfeeder.py +index c252503..c1e20c4 100755 +--- a/dbcfeeder.py ++++ b/dbcfeeder.py +@@ -289,19 +289,23 @@ class Feeder: + log.debug("Processing %d VSS Data Entry updates", len(updates)) + dbc_signal_names: Set[str] = set() + for update in updates: ++ value = None + if update.entry.value is not None: +- # This should never happen as we do not subscribe to current value + log.warning( + "Current value for %s is now: %s of type %s", + update.entry.path, update.entry.value.value, type(update.entry.value.value) + ) ++ value = update.entry.value.value + + if update.entry.actuator_target is not None: + log.debug( + "Target value for %s is now: %s of type %s", + update.entry.path, update.entry.actuator_target, type(update.entry.actuator_target.value) + ) +- affected_signals = self._mapper.handle_update(update.entry.path, update.entry.actuator_target.value) ++ value = update.entry.actuator_target.value ++ ++ if value != None: ++ affected_signals = self._mapper.handle_update(update.entry.path, value) + dbc_signal_names.update(affected_signals) + + messages_to_send: Set[Message] = set() +diff --git a/dbcfeederlib/databrokerclientwrapper.py b/dbcfeederlib/databrokerclientwrapper.py +index 716ee6d..db2b80a 100644 +--- a/dbcfeederlib/databrokerclientwrapper.py ++++ b/dbcfeederlib/databrokerclientwrapper.py +@@ -199,14 +199,20 @@ class DatabrokerClientWrapper(clientwrapper.ClientWrapper): + def supports_subscription(self) -> bool: + return True + +- async def subscribe(self, vss_names: List[str], callback): ++ async def subscribe(self, vss_entries: dict[str, str], callback): + """Create a subscription and invoke the callback when data received.""" + entries: List[SubscribeEntry] = [] +- for name in vss_names: +- # Always subscribe to target +- subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) +- log.info("Subscribe entry: %s", subscribe_entry) +- entries.append(subscribe_entry) ++ for name, signal_type in vss_entries.items(): ++ if signal_type == "actuator": ++ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) ++ log.info("Subscribe entry: %s", subscribe_entry) ++ entries.append(subscribe_entry) ++ if signal_type == "sensor": ++ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.VALUE]) ++ log.info("Subscribe entry: %s", subscribe_entry) ++ entries.append(subscribe_entry) ++ if not entries: ++ return + + # If there is a path VSSClient will request a secure connection + if self._tls and self._root_ca_path: +diff --git a/dbcfeederlib/dbc2vssmapper.py b/dbcfeederlib/dbc2vssmapper.py +index 218f693..2be5e98 100644 +--- a/dbcfeederlib/dbc2vssmapper.py ++++ b/dbcfeederlib/dbc2vssmapper.py +@@ -69,12 +69,13 @@ class VSSMapping: + parser: Parser = Parser() + + def __init__(self, vss_name: str, dbc_name: str, transform: dict, interval_ms: int, +- on_change: bool, datatype: str, description: str): ++ on_change: bool, signal_type: str, datatype: str, description: str): + self.vss_name = vss_name + self.dbc_name = dbc_name + self.transform = transform + self.interval_ms = interval_ms + self.on_change = on_change ++ self.signal_type = signal_type + self.datatype = datatype + self.description = description + # For time comparison (interval_ms) we store last value used for comparison. Unit seconds. +@@ -347,7 +348,7 @@ class Mapper(DBCParser): + if can_signal_name not in self._dbc2vss_mapping: + self._dbc2vss_mapping[can_signal_name] = [] + mapping_entry = VSSMapping(expanded_name, can_signal_name, transformation_definition, interval, on_change, +- node["datatype"], node["description"]) ++ node["type"], node["datatype"], node["description"]) + self._dbc2vss_mapping[can_signal_name].append(mapping_entry) + + for msg_def in self.get_messages_for_signal(can_signal_name): +@@ -398,7 +399,7 @@ class Mapper(DBCParser): + log.warning("Ignoring \"interval_ms\" property of mapping definition for %s", expanded_name) + + mapping_entry = VSSMapping(expanded_name, can_signal_name, transform, interval, on_change, +- node["datatype"], node["description"]) ++ node["type"], node["datatype"], node["description"]) + if can_signal_name not in self._vss2dbc_mapping: + self._vss2dbc_mapping[expanded_name] = [] + self._vss2dbc_mapping[expanded_name].append(mapping_entry) +@@ -426,12 +427,7 @@ class Mapper(DBCParser): + if dbc2vss_def is not None: + self._analyze_dbc2vss(expanded_name, node, dbc2vss_def) + if "vss2dbc" in node: +- if node["type"] == "actuator": +- self._analyze_vss2dbc(expanded_name, node, node["vss2dbc"]) +- else: +- # vss2dbc is handled by subscription to target value, so only makes sense for actuators +- log.error("vss2dbc only allowed for actuators, VSS signal %s is not an actuator!", expanded_name) +- sys.exit(-1) ++ self._analyze_vss2dbc(expanded_name, node, node["vss2dbc"]) + + def _traverse_vss_node(self, name, node, prefix=""): + """ +@@ -474,9 +470,12 @@ class Mapper(DBCParser): + """Get all CAN signal names for which a mapping to a VSS Data Entry exists.""" + return self._dbc2vss_mapping.keys() + +- def get_vss2dbc_entries(self) -> KeysView[str]: ++ def get_vss2dbc_entries(self) -> Dict[str, str]: + """Get all VSS Data Entry paths for which a mapping to a CAN signal name exists.""" +- return self._vss2dbc_mapping.keys() ++ entries: Dict[str, str] = {} ++ for name, mappings in self._vss2dbc_mapping.items(): ++ entries[name] = mappings[0].signal_type ++ return entries + + def get_vss_names(self) -> Set[str]: + """Get all VSS names used in mappings, both vss2dbc and dbc2vss""" +diff --git a/dbcfeederlib/serverclientwrapper.py b/dbcfeederlib/serverclientwrapper.py +index fa43d28..86b2ceb 100644 +--- a/dbcfeederlib/serverclientwrapper.py ++++ b/dbcfeederlib/serverclientwrapper.py +@@ -122,6 +122,6 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): + log.info("Feature not implemented") + return False + +- async def subscribe(self, vss_names: List[str], callback): ++ async def subscribe(self, vss_entries: dict[str, str], callback): + log.error("Feature not implemented") + return +diff --git a/mapping/README.md b/mapping/README.md +index 2155f28..ea6de07 100644 +--- a/mapping/README.md ++++ b/mapping/README.md +@@ -44,8 +44,6 @@ This is built on the assumption that the DBC provider always send target values + Having separate configurations (`dbc2vss` and `vss2dbc`) is needed as wanted value and actual value never are sent + by the same DBC signal, they are not even part of the same CAN-frame. + +-*This means that `vss2dbc` only can be used for actuators, as only actuators have target values!* +- + ## Example mapping files + + Example mapping files for various VSS versions can be found in this folder. +-- +2.44.0 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc b/recipes-connectivity/kuksa-val/kuksa-can-provider/agl-vcar.dbc index e638d128..e638d128 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/agl-vcar.dbc diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_feeder.json.token b/recipes-connectivity/kuksa-val/kuksa-can-provider/can-provider.json.token index b8df6666..b8df6666 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_feeder.json.token +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/can-provider.json.token diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_feeder.token b/recipes-connectivity/kuksa-val/kuksa-can-provider/can-provider.token index 8ce854f3..8ce854f3 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_feeder.token +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/can-provider.token diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini b/recipes-connectivity/kuksa-val/kuksa-can-provider/config.ini index 378a3437..f41fb87a 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/config.ini +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/config.ini @@ -19,7 +19,7 @@ tls = True root_ca_path=/etc/kuksa-val/CA.pem # Token file for authorization. -token = /etc/kuksa-dbc-feeder/dbc_feeder.token +token = /etc/kuksa-can-provider/can-provider.token [can] # CAN port @@ -27,4 +27,4 @@ port = can0 # Enable SAE-J1939 Mode. False: ignore j1939 = False # DBC file used to parse CAN messages -dbcfile = /etc/kuksa-dbc-feeder/agl-vcar.dbc +dbcfile = /etc/kuksa-can-provider/agl-vcar.dbc diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_default_values.json b/recipes-connectivity/kuksa-val/kuksa-can-provider/dbc_default_values.json index 0562569d..0562569d 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_default_values.json +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/dbc_default_values.json diff --git a/recipes-connectivity/kuksa-val/kuksa-can-provider/kuksa-can-provider.default b/recipes-connectivity/kuksa-val/kuksa-can-provider/kuksa-can-provider.default new file mode 100644 index 00000000..aad0bc41 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/kuksa-can-provider.default @@ -0,0 +1,3 @@ +# For output only mode: +#EXTRA_ARGS="--val2dbc --no-dbc2val --dbc-default /etc/kuksa-can-provider/dbc_default_values.json" +#LOG_LEVEL=debug diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service b/recipes-connectivity/kuksa-val/kuksa-can-provider/kuksa-can-provider.service index 857f5c7d..41258d27 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/kuksa-can-provider.service @@ -4,7 +4,7 @@ Requires=kuksa-databroker.service can-dev-helper.service After=kuksa-databroker.service can-dev-helper.service [Service] -EnvironmentFile=-/etc/default/kuksa-dbc-feeder +EnvironmentFile=-/etc/default/kuksa-can-provider ExecStart=/usr/bin/dbcfeeder.py $EXTRA_ARGS Restart=on-failure diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml b/recipes-connectivity/kuksa-val/kuksa-can-provider/mapping.yml index b1c1fece..b1c1fece 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider/mapping.yml diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb b/recipes-connectivity/kuksa-val/kuksa-can-provider_git.bb index 281f10ac..16861fcf 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-can-provider_git.bb @@ -1,56 +1,56 @@ -SUMMARY = "DBC feeder for KUKSA.val, the KUKSA Vehicle Abstraction Layer" -HOMEPAGE = "https://github.com/eclipse/kuksa.val" -BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" +SUMMARY = "CAN provider for KUKSA.val, the KUKSA Vehicle Abstraction Layer" +HOMEPAGE = "https://github.com/eclipse-kuksa" +BUGTRACKER = "https://github.com/eclips-kuksa/kuksa-can-provider/issues" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=175792518e4ac015ab6696d16c4f607e" +LIC_FILES_CHKSUM = "file://LICENSE;md5=175792518e4ac015ab6696d16c4f607e" DEPENDS = "python3-setuptools-git-versioning-native" -PV = "0.4.0+git${SRCPV}" +PV = "0.4.3+git${SRCPV}" -SRC_URI = "git://github.com/eclipse/kuksa.val.feeders.git;protocol=https;branch=main \ +SRC_URI = "git://github.com/eclipse-kuksa/kuksa-can-provider.git;protocol=https;branch=main \ file://0001-dbc2val-add-installation-mechanism.patch \ file://0002-dbc2val-usability-improvements.patch \ file://0003-dbc2val-fix-token-file-configuration-option.patch \ file://0004-Enable-val2dbc-for-sensor-values.patch \ file://config.ini \ - file://dbc_feeder.token \ + file://can-provider.token \ file://agl-vcar.dbc \ file://dbc_default_values.json \ - file://kuksa-dbc-feeder.service \ - file://kuksa-dbc-feeder.default \ + file://kuksa-can-provider.service \ + file://kuksa-can-provider.default \ " -SRCREV = "5bb52eca8d79f7c05a024f69b1faab81dabacdcd" +SRCREV = "d5fdcfa7574ce69059b6f449629571db0982c1cf" S = "${WORKDIR}/git" inherit setuptools3 systemd update-alternatives -SETUPTOOLS_SETUP_PATH = "${S}/dbc2val" +#SETUPTOOLS_SETUP_PATH = "${S}/dbc2val" SYSTEMD_SERVICE:${PN} = "${BPN}.service" do_install:append() { - install -d ${D}${sysconfdir}/kuksa-dbc-feeder - install -m 0644 ${WORKDIR}/config.ini ${D}${sysconfdir}/kuksa-dbc-feeder/ + install -d ${D}${sysconfdir}/kuksa-can-provider + install -m 0644 ${WORKDIR}/config.ini ${D}${sysconfdir}/kuksa-can-provider/ # Token should ideally not be readable by other users. # The potential for running the feeder as non-root will take some # investigation. - install -m 0600 ${WORKDIR}/dbc_feeder.token ${D}${sysconfdir}/kuksa-dbc-feeder/ - install -m 0644 ${WORKDIR}/agl-vcar.dbc ${D}${sysconfdir}/kuksa-dbc-feeder/ - install -m 0644 ${WORKDIR}/dbc_default_values.json ${D}${sysconfdir}/kuksa-dbc-feeder/ + install -m 0600 ${WORKDIR}/can-provider.token ${D}${sysconfdir}/kuksa-can-provider/ + install -m 0644 ${WORKDIR}/agl-vcar.dbc ${D}${sysconfdir}/kuksa-can-provider/ + install -m 0644 ${WORKDIR}/dbc_default_values.json ${D}${sysconfdir}/kuksa-can-provider/ install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.default ${D}${sysconfdir}/default/ + install -m 0644 ${WORKDIR}/kuksa-can-provider.default ${D}${sysconfdir}/default/ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.service ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/kuksa-can-provider.service ${D}${systemd_system_unitdir} fi } -ALTERNATIVE_LINK_NAME[kuksa-dbc-feeder.env] = "${sysconfdir}/default/kuksa-dbc-feeder" +ALTERNATIVE_LINK_NAME[kuksa-can-provider.env] = "${sysconfdir}/default/kuksa-can-provider" -ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-dbc-feeder.default" +ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-can-provider.default" FILES:${PN} += "${systemd_system_unitdir}" RDEPENDS:${PN} += " \ diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-control-panel.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-control-panel.bb deleted file mode 100644 index 3148721e..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-control-panel.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "KUKSA.val DBC feeder configuration for gateway demo control panel" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "file://kuksa-dbc-feeder.control-panel" - -S = "${WORKDIR}" - -inherit update-alternatives - -do_compile[noexec] = "1" - -do_install() { - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.control-panel ${D}${sysconfdir}/default/ -} - -ALTERNATIVE_LINK_NAME[kuksa-dbc-feeder.env] = "${sysconfdir}/default/kuksa-dbc-feeder" - -RPROVIDES:${PN} = "kuksa-dbc-feeder.env" -ALTERNATIVE:${PN} = "kuksa-dbc-feeder.env" -ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-dbc-feeder.control-panel" - -RDEPENDS:${PN} += "kuksa-dbc-feeder" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-control-panel.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-control-panel.bb deleted file mode 100644 index 4afcfaf1..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-control-panel.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "KUKSA.val DBC feeder configuration for gateway demo" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "file://kuksa-dbc-feeder.gw-control-panel" - -S = "${WORKDIR}" - -inherit update-alternatives - -do_compile[noexec] = "1" - -do_install() { - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.gw-control-panel ${D}${sysconfdir}/default/ -} - -ALTERNATIVE_LINK_NAME[kuksa-dbc-feeder.env] = "${sysconfdir}/default/kuksa-dbc-feeder" - -RPROVIDES:${PN} = "kuksa-dbc-feeder.env" -ALTERNATIVE:${PN} = "kuksa-dbc-feeder.env" -ALTERNATIVE_TARGET_${PN} = "${sysconfdir}/default/kuksa-dbc-feeder.gw-control-panel" - -RDEPENDS:${PN} += "kuksa-dbc-feeder" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware.bb deleted file mode 100644 index 513a3f6e..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "KUKSA.val DBC feeder configuration for gateway demo (secondary CAN interface)" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "file://kuksa-dbc-feeder.gw-hardware \ - file://config.ini.gw-hardware \ - file://kuksa-dbc-feeder-can1.service \ -" - -S = "${WORKDIR}" - -inherit systemd update-alternatives - -SYSTEMD_SERVICE:${PN} = "kuksa-dbc-feeder-can1.service" - -do_compile[noexec] = "1" - -do_install() { - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.gw-hardware ${D}${sysconfdir}/default/ - install -d ${D}${sysconfdir}/kuksa-dbc-feeder - install -m 0644 ${WORKDIR}/config.ini.gw-hardware ${D}${sysconfdir}/kuksa-dbc-feeder/ - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/kuksa-dbc-feeder-can1.service ${D}${systemd_system_unitdir} - fi -} - -FILES:${PN} += "${systemd_system_unitdir}" - -RDEPENDS:${PN} += "kuksa-dbc-feeder vss-agl-gw-hardware" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/kuksa-dbc-feeder.gw-hardware b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/kuksa-dbc-feeder.gw-hardware deleted file mode 100644 index 562a56b8..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-conf-gw-hardware/kuksa-dbc-feeder.gw-hardware +++ /dev/null @@ -1,3 +0,0 @@ -# DBC input for steering wheel, output for HVAC -EXTRA_ARGS="--val2dbc --dbc2val --dbc-default /etc/kuksa-dbc-feeder/dbc_default_values.json --config /etc/kuksa-dbc-feeder/config.ini.gw-hardware" -#LOG_LEVEL=debug 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 deleted file mode 100644 index 31051b18..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0002-dbc2val-usability-improvements.patch +++ /dev/null @@ -1,76 +0,0 @@ -From b217a746ef7b92291320e4c1a66b52df0318495f Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Sat, 5 Aug 2023 13:58:16 -0400 -Subject: [PATCH 2/3] 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. -- 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. -- Fixed shutdown behavior with some tweaks to actually stop the - reader and KUKSA.val client library threads. This makes the - script actually exit on SIGTERM as opposed to hanging. - -Upstream-Status: pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - dbc2val/dbcfeeder.py | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py -index 966dba7..e7fd319 100755 ---- a/dbc2val/dbcfeeder.py -+++ b/dbc2val/dbcfeeder.py -@@ -188,7 +188,11 @@ class Feeder: - - # use socketCAN - log.info("Using socket CAN device '%s'", canport) -+ try: - self._reader.start_listening(bustype="socketcan", channel=canport) -+ except: -+ log.error("Could not open {}, exiting".format(canport)) -+ sys.exit(-1) - - receiver = threading.Thread(target=self._run_receiver) - receiver.start() -@@ -212,6 +216,11 @@ class Feeder: - threads.append(transmitter) - else: - log.info("No val2dbc mappings found or val2dbc disabled!!") -+ -+ # Spin so signal handlers will work -+ while not self._shutdown: -+ time.sleep(0.1) -+ - # Wait for all of them to finish - for thread in threads: - thread.join() -@@ -363,8 +372,10 @@ def parse_config(filename): - configfile = filename - else: - config_candidates = [ -- "/config/dbc_feeder.ini", -+ "/etc/kuksa-dbc-feeder/config.ini", -+ "/etc/kuksa-dbc-feeder/dbc_feeder.ini", - "/etc/dbc_feeder.ini", -+ "/config/dbc_feeder.ini", - "config/dbc_feeder.ini", - ] - for candidate in config_candidates: -@@ -577,7 +588,7 @@ def main(argv): - elif "can" in config and "dbc_default_file" in config["can"]: - dbc_default = config["can"]["dbc_default_file"] - else: -- dbc_default = "dbc_default_values.json" -+ dbc_default = "" - - if args.dbc2val: - use_dbc2val = True --- -2.41.0 - diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch deleted file mode 100644 index 7f22a90a..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch +++ /dev/null @@ -1,142 +0,0 @@ -From d6f1aaa7f26aa52f4b219f60e704d5ab2954f082 Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Wed, 3 Apr 2024 02:09:11 +0900 -Subject: [PATCH] Enable val2dbc for sensor values - -Rework to allow val2dbc mode to write out sensor values in -addition to actuator target values. - -Upstream-Status: pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - dbc2val/dbcfeeder.py | 8 ++++++-- - .../dbcfeederlib/databrokerclientwrapper.py | 18 ++++++++++++------ - dbc2val/dbcfeederlib/dbc2vssmapper.py | 14 +++++++++----- - dbc2val/dbcfeederlib/serverclientwrapper.py | 2 +- - 4 files changed, 28 insertions(+), 14 deletions(-) - -diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py -index e7fd319..5e0df2f 100755 ---- a/dbc2val/dbcfeeder.py -+++ b/dbc2val/dbcfeeder.py -@@ -322,15 +322,19 @@ class Feeder: - log.debug("vss-Update callback!") - dbc_ids = set() - for update in updates: -+ value = None - if update.entry.value is not None: -- # This shall currently never happen as we do not subscribe to this - log.warning(f"Current value for {update.entry.path} is now: " - f"{update.entry.value.value} of type {type(update.entry.value.value)}") -+ value = update.entry.value.value - - if update.entry.actuator_target is not None: - log.debug(f"Target value for {update.entry.path} is now: {update.entry.actuator_target} " - f"of type {type(update.entry.actuator_target.value)}") -- new_dbc_ids = self._mapper.handle_update(update.entry.path, update.entry.actuator_target.value) -+ value = update.entry.actuator_target.value -+ -+ if value != None: -+ new_dbc_ids = self._mapper.handle_update(update.entry.path, value) - dbc_ids.update(new_dbc_ids) - - can_ids = set() -diff --git a/dbc2val/dbcfeederlib/databrokerclientwrapper.py b/dbc2val/dbcfeederlib/databrokerclientwrapper.py -index 35836e9..46ae330 100644 ---- a/dbc2val/dbcfeederlib/databrokerclientwrapper.py -+++ b/dbc2val/dbcfeederlib/databrokerclientwrapper.py -@@ -200,14 +200,20 @@ class DatabrokerClientWrapper(clientwrapper.ClientWrapper): - def supports_subscription(self) -> bool: - return True - -- async def subscribe(self, vss_names: List[str], callback): -+ async def subscribe(self, vss_entries: dict[str, str], callback): - """Creates a subscription and calls the callback when data received""" - entries = [] -- for name in vss_names: -- # Always subscribe to target -- subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) -- log.info(f"Subscribe entry: {subscribe_entry}") -- entries.append(subscribe_entry) -+ for name, signal_type in vss_entries.items(): -+ if signal_type == "actuator": -+ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) -+ log.info(f"Subscribe entry: {subscribe_entry}") -+ entries.append(subscribe_entry) -+ if signal_type == "sensor": -+ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.VALUE]) -+ log.info(f"Subscribe entry: {subscribe_entry}") -+ entries.append(subscribe_entry) -+ if not entries: -+ return - - # If there is a path VSSClient will request a secure connection - if self._tls and self._root_ca_path: -diff --git a/dbc2val/dbcfeederlib/dbc2vssmapper.py b/dbc2val/dbcfeederlib/dbc2vssmapper.py -index 5142a5e..8f04cdd 100644 ---- a/dbc2val/dbcfeederlib/dbc2vssmapper.py -+++ b/dbc2val/dbcfeederlib/dbc2vssmapper.py -@@ -61,12 +61,13 @@ class VSSMapping: - parser: Parser = Parser() - - def __init__(self, vss_name: str, dbc_name: str, transform: dict, interval_ms: int, -- on_change: bool, datatype: str, description: str): -+ on_change: bool, signal_type: str, datatype: str, description: str): - self.vss_name = vss_name - self.dbc_name = dbc_name - self.transform = transform - self.interval_ms = interval_ms - self.on_change = on_change -+ self.signal_type = signal_type - self.datatype = datatype - self.description = description - # For time comparison (interval_ms) we store last value used for comparison. Unit seconds. -@@ -282,7 +283,7 @@ class Mapper: - log.info(f"Using default interval 1000 ms for {expanded_name}") - interval = 1000 - mapping_entry = VSSMapping(expanded_name, dbc_name, transform, interval, on_change, -- node["datatype"], node["description"]) -+ node["type"], node["datatype"], node["description"]) - if dbc_name not in self.dbc2val_mapping: - self.dbc2val_mapping[dbc_name] = [] - self.dbc2val_mapping[dbc_name].append(mapping_entry) -@@ -306,7 +307,7 @@ class Mapper: - log.warning(f"interval_ms attribute ignored for {expanded_name}") - - mapping_entry = VSSMapping(expanded_name, dbc_name, transform, interval, on_change, -- node["datatype"], node["description"]) -+ node["type"], node["datatype"], node["description"]) - if dbc_name not in self.val2dbc_mapping: - self.val2dbc_mapping[expanded_name] = [] - self.val2dbc_mapping[expanded_name].append(mapping_entry) -@@ -380,9 +381,12 @@ class Mapper: - """Return a set of all dbc names used for reception""" - return self.dbc2val_mapping.keys() - -- def get_val2dbc_entries(self) -> KeysView: -+ def get_val2dbc_entries(self) -> Dict[str, str]: - """Return a set of all vss names used for reception""" -- return self.val2dbc_mapping.keys() -+ entries: Dict[str, str] = {} -+ for name, mappings in self.val2dbc_mapping.items(): -+ entries[name] = mappings[0].signal_type -+ return entries - - def get_vss_names(self) -> Set[str]: - """Get all VSS names used in mappings, both vss2dbc and dbc2vss""" -diff --git a/dbc2val/dbcfeederlib/serverclientwrapper.py b/dbc2val/dbcfeederlib/serverclientwrapper.py -index 63bc12e..ca11daf 100644 ---- a/dbc2val/dbcfeederlib/serverclientwrapper.py -+++ b/dbc2val/dbcfeederlib/serverclientwrapper.py -@@ -125,6 +125,6 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): - log.info("Feature not implemented") - return False - -- async def subscribe(self, vss_names: List[str], callback): -+ async def subscribe(self, vss_entries: dict[str, str], callback): - log.error("Feature not implemented") - return --- -2.34.1 - diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.default b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.default deleted file mode 100644 index 5d787158..00000000 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.default +++ /dev/null @@ -1,3 +0,0 @@ -# For output only mode: -#EXTRA_ARGS="--val2dbc --no-dbc2val --dbc-default /etc/kuksa-dbc-feeder/dbc_default_values.json" -#LOG_LEVEL=debug |