diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-06-07 16:25:40 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-06-07 16:25:40 -0400 |
commit | d9cc99764c61e7343c130c4e4da77a24da8515a4 (patch) | |
tree | d26106abcefe7f7d98af293f86e660704003911d /recipes-demo/simple-can-simulator/files | |
parent | 0536b1b7eaadc6a20540757c9b19350f83820279 (diff) |
simple_can_simulator: support different interface for LIN messages
Add a "--lin-interface" option to simple_can_simulator.py to allow
specifying a different CAN interface for the cruise control LIN
messages from the steering wheel in the demo setup. This allows
pointing at the sllin0 interface in the full demo setup that is
configured with the agl-demo-preload feature. Previously the
CAN messages for the LIN events were bridged to the primary CAN
interface, but this has proven unreliable in practice.
Bug-AGL: SPEC-4431
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I18b2bb8042569e220c79445d310c620dcebac9fc
Diffstat (limited to 'recipes-demo/simple-can-simulator/files')
-rwxr-xr-x | recipes-demo/simple-can-simulator/files/simple_can_simulator.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/recipes-demo/simple-can-simulator/files/simple_can_simulator.py b/recipes-demo/simple-can-simulator/files/simple_can_simulator.py index 83f88706e..3d6c85d54 100755 --- a/recipes-demo/simple-can-simulator/files/simple_can_simulator.py +++ b/recipes-demo/simple-can-simulator/files/simple_can_simulator.py @@ -350,13 +350,18 @@ class StatusMessageSender(object): def main(): parser = argparse.ArgumentParser(description='Simple CAN vehicle simulator.') parser.add_argument('interface', type=str, help='interface name (e.g. vcan0)') + parser.add_argument('--lin-interface', help='Separate LIN interface name (e.g. sllin0)') parser.add_argument('-v', '--verbose', help='increase output verbosity', action='store_true') args = parser.parse_args() + lin_interface = args.lin_interface + if lin_interface == None: + lin_interface = args.interface + try: can_sock = CANSocket(args.interface) diag_can_sock = CANSocket(args.interface) - steeringwheel_can_sock = CANSocket(args.interface) + steeringwheel_can_sock = CANSocket(lin_interface) except OSError as e: sys.stderr.write('Could not listen on interface {0}\n'.format(args.interface)) sys.exit(e.errno) |