1 From b217a746ef7b92291320e4c1a66b52df0318495f Mon Sep 17 00:00:00 2001
2 From: Scott Murray <scott.murray@konsulko.com>
3 Date: Sat, 5 Aug 2023 13:58:16 -0400
4 Subject: [PATCH 2/3] dbc2val: usability improvements
7 - Tweaked default configuration file search path to better match
8 Linux FHS and kuksa-val-server. First look for a config.ini in
9 /etc/kuksa-dbc-feeder, then /etc/dbc_feeder.ini.
10 - Add catching of exceptions around CAN device opening so that the
11 script can exit cleanly with an error message if the device is
13 - Fixed shutdown behavior with some tweaks to actually stop the
14 reader and KUKSA.val client library threads. This makes the
15 script actually exit on SIGTERM as opposed to hanging.
17 Upstream-Status: pending
19 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
22 dbc2val/dbcfeeder.py | 15 +++++++++++++--
23 1 file changed, 13 insertions(+), 2 deletions(-)
25 diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py
26 index 966dba7..e7fd319 100755
27 --- a/dbc2val/dbcfeeder.py
28 +++ b/dbc2val/dbcfeeder.py
29 @@ -188,7 +188,11 @@ class Feeder:
32 log.info("Using socket CAN device '%s'", canport)
34 self._reader.start_listening(bustype="socketcan", channel=canport)
36 + log.error("Could not open {}, exiting".format(canport))
39 receiver = threading.Thread(target=self._run_receiver)
41 @@ -212,6 +216,11 @@ class Feeder:
42 threads.append(transmitter)
44 log.info("No val2dbc mappings found or val2dbc disabled!!")
46 + # Spin so signal handlers will work
47 + while not self._shutdown:
50 # Wait for all of them to finish
51 for thread in threads:
53 @@ -363,8 +372,10 @@ def parse_config(filename):
57 - "/config/dbc_feeder.ini",
58 + "/etc/kuksa-dbc-feeder/config.ini",
59 + "/etc/kuksa-dbc-feeder/dbc_feeder.ini",
60 "/etc/dbc_feeder.ini",
61 + "/config/dbc_feeder.ini",
62 "config/dbc_feeder.ini",
64 for candidate in config_candidates:
65 @@ -577,7 +588,7 @@ def main(argv):
66 elif "can" in config and "dbc_default_file" in config["can"]:
67 dbc_default = config["can"]["dbc_default_file"]
69 - dbc_default = "dbc_default_values.json"