Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAN fingerprint script improvements #27355

Merged
merged 3 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion selfdrive/debug/fingerprint_from_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_fingerprint(lr):
for c in msg.can:
# read also msgs sent by EON on CAN bus 0x80 and filter out the
# addr with more than 11 bits
if c.src % 0x80 == 0 and c.address < 0x800:
if c.src % 0x80 == 0 and c.address < 0x800 and c.address not in (0x7df, 0x7e0, 0x7e8):
msgs[c.address] = len(c.dat)

# show CAN fingerprint
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/debug/get_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
for c in lc.can:
# read also msgs sent by EON on CAN bus 0x80 and filter out the
# addr with more than 11 bits
if c.src in [0, 2] and c.address < 0x800:
if c.src % 0x80 == 0 and c.address < 0x800 and c.address not in (0x7df, 0x7e0, 0x7e8):
Copy link
Contributor Author

@sshane sshane Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 can be an entirely different bus on some cars (ASCM GM) with different lengths for the same addrs. Instead of checking 0 and 2, check 0 and 128 which includes:

relay open:

  • messages originating from PT side or cam side (except ASCM GM where 2 isn't the same bus)

relay closed:

  • messages originating from PT side
  • messages forwarded to PT side from cam side
  • messages sent to PT side from OP

msgs[c.address] = len(c.dat)

fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items()))
Expand Down