Skip to content

Commit

Permalink
Remove hexdump package (commaai#33155)
Browse files Browse the repository at this point in the history
* remove hexdump

* uv lock

* cleanup
old-commit-hash: 1dd8bdc
  • Loading branch information
maxime-desroches authored Jul 31, 2024
1 parent 3e12f38 commit 80e23d1
Show file tree
Hide file tree
Showing 3 changed files with 652 additions and 637 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ dev = [
"tabulate",
"types-requests",
"types-tabulate",
"hexdump",

# this is only pinned since 5.15.11 is broken
"pyqt5 ==5.15.2; platform_machine == 'x86_64'", # no aarch64 wheels for macOS/linux
Expand Down
13 changes: 12 additions & 1 deletion selfdrive/debug/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@
import json
import codecs

from hexdump import hexdump
from cereal import log
from cereal.services import SERVICE_LIST
from openpilot.tools.lib.live_logreader import raw_live_logreader


codecs.register_error("strict", codecs.backslashreplace_errors)

def hexdump(msg):
m = str.upper(msg.hex())
m = [m[i:i+2] for i in range(0,len(m),2)]
m = [m[i:i+16] for i in range(0,len(m),16)]
for row,dump in enumerate(m):
addr = '%08X:' % (row*16)
raw = ' '.join(dump[:8]) + ' ' + ' '.join(dump[8:])
space = ' ' * (48 - len(raw))
asci = ''.join(chr(int(x,16)) if 0x20 <= int(x,16) <= 0x7E else '.' for x in dump)
print(f'{addr} {raw} {space} {asci}')


if __name__ == "__main__":

parser = argparse.ArgumentParser(description='Dump communication sockets. See cereal/services.py for a complete list of available sockets.')
Expand Down
Loading

0 comments on commit 80e23d1

Please sign in to comment.