luc4t / openpilot-can-shell

command processor for automotive ECUs with a built-in text-based CAN bus terminal (using a panda)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CAN shell

command processor for automotive ECUs with a built-in text-based CAN bus terminal (using a panda)

CAN terminal

Usage

note that most vehicles with a gateway block the required addresses, so you need a direct communication line for any of this to work

hardware

Currently supported:

Honda Accord 2018+ EPS connector:

Tesla AP1 EPAS connector:

setup

pip install -r requirements.txt
sudo ln -s $(pwd)/cansh /usr/local/bin/

scan for TX/RX addresses (if you don't already know them)

cansh --scan

setup address environment variables

Honda Accord 2018+ EPS

export CANTERM_ENABLE_TX_ADDR=1882
export CANTERM_ENABLE_RX_ADDR=1883
export CANTERM_COMMAND_TX_ADDR=1834
export CANTERM_COMMAND_RX_ADDR=1835

Tesla Pre-AP/AP1 EPAS

export CANTERM_ENABLE_TX_ADDR=1634
export CANTERM_ENABLE_RX_ADDR=1635
export CANTERM_COMMAND_TX_ADDR=1636
export CANTERM_COMMAND_RX_ADDR=1637
export CANTERM_FACTORY_MODE_BYPASS=1

interactive shell

# assumes environment variables are set up
cansh
# type 'help' to see available commands and 'exit' to quit

or (without environment variables)

# insert appropriate address (decimal) before running below commands
cansh --enable-tx-addr <enable-tx-addr> --enable-rx-addr <enable-rx-addr> --command-tx-addr <command-tx-addr> --command-rx-addr <command-rx-addr>
# type 'help' to see available commands and 'exit' to quit

single command

# assumes environment variables are set up
cansh -c 'rd 0x00000000 1'

non-interactive (pipe)

# assumes environment variables are set up
echo 'rd 0x00000000 1' | cansh

execute script example.sh (multi-command)

# assumes environment variables are set up
./example.sh

or

# assumes environment variables are set up
cansh ./example.sh

Enhancements

  • additional ECUs with a CAN terminal most likely exist, write support and submit a PR!
  • a good shell supports variables, conditional branch logic and looping constructs
  • additional hardware support

About

command processor for automotive ECUs with a built-in text-based CAN bus terminal (using a panda)

License:GNU General Public License v3.0


Languages

Language:Python 99.6%Language:Shell 0.4%