Command path proven end to end on the bus (node F8 interior lights, on/off/on), each answering a distinct fresh challenge; bare opcodes without the exchange are ignored. ids_can_auth.h verified bit-exact against ids_can_auth.py and the captured/live pairs. - idscan_cmd.py: stdlib socketcan tool running the full page-42/43 exchange - esphome/onecontrol-canbus.yaml: correct IDS-CAN read dispatch (was stale RV-C DGN code) + command path wired to the auth header - README/memory: document the read map + command authentication; rename sniff/ -> captures/; neutral device-integration framing throughout Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.5 KiB
Bash
Executable File
41 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Bring up the CANable at IDS-CAN speed and log timestamped raw frames.
|
|
#
|
|
# Usage:
|
|
# ./log-can.sh # bring up can0 @ 250k, live candump
|
|
# ./log-can.sh rec NAME # also tee a timestamped log to NAME-<date>.log
|
|
# ./log-can.sh watch # cansniffer color-diff view (operate a load, watch bytes)
|
|
# ./log-can.sh down # take the interface down
|
|
#
|
|
# Requires: can-utils (paru -S can-utils on Arch). This CANable shipped with
|
|
# slcan firmware (a /dev/ttyACM* serial device) — bridge it to can0 first with
|
|
# sudo slcand -o -s5 /dev/ttyACMx can0
|
|
# A candleLight/gs_usb reflash would instead give a native socketcan can0 and let
|
|
# the up() path below set the bitrate directly.
|
|
|
|
set -euo pipefail
|
|
IFACE="${IFACE:-can0}"
|
|
BITRATE=250000 # IDS-CAN is 250k
|
|
CMD="${1:-up}"
|
|
|
|
up() {
|
|
if ! ip link show "$IFACE" &>/dev/null; then
|
|
echo "No $IFACE — is the CANable plugged in? (dmesg | grep -i gs_usb)" >&2
|
|
exit 1
|
|
fi
|
|
sudo ip link set "$IFACE" down 2>/dev/null || true
|
|
sudo ip link set "$IFACE" up type can bitrate "$BITRATE"
|
|
echo "$IFACE up @ ${BITRATE} bps"
|
|
}
|
|
|
|
case "$CMD" in
|
|
up) up; exec candump -ta -x "$IFACE" ;;
|
|
rec) up
|
|
name="${2:-onecontrol}"; out="$(dirname "$0")/${name}-$(date +%F_%H%M%S).log"
|
|
echo "logging -> $out (Ctrl-C to stop)"
|
|
exec candump -ta -x "$IFACE" | tee "$out" ;;
|
|
watch) up; exec cansniffer -c "$IFACE" ;;
|
|
down) sudo ip link set "$IFACE" down; echo "$IFACE down" ;;
|
|
*) echo "usage: $0 {up|rec NAME|watch|down}" >&2; exit 2 ;;
|
|
esac
|