Skip to content

Commit

Permalink
Merge branch 'commaai:master' into PA-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Edison-CBS authored Aug 18, 2024
2 parents 96e0a7f + ba098f5 commit b3aec47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
25 changes: 16 additions & 9 deletions system/hardware/tici/agnos.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ def __init__(self, url: str) -> None:
self.sha256 = hashlib.sha256()

def read(self, length: int) -> bytes:
while len(self.buf) < length:
self.req.raise_for_status()
while len(self.buf) < length and not self.eof:
if self.decompressor.needs_input:
self.req.raise_for_status()

try:
compressed = next(self.it)
except StopIteration:
try:
compressed = next(self.it)
except StopIteration:
self.eof = True
break
else:
compressed = b''

self.buf += self.decompressor.decompress(compressed, max_length=length)

if self.decompressor.eof:
self.eof = True
break
out = self.decompressor.decompress(compressed)
self.buf += out

result = self.buf[:length]
self.buf = self.buf[length:]
Expand Down Expand Up @@ -83,8 +90,8 @@ def unsparsify(f: StreamingDecompressor) -> Generator[bytes, None, None]:

# noop wrapper with same API as unsparsify() for non sparse images
def noop(f: StreamingDecompressor) -> Generator[bytes, None, None]:
while not f.eof:
yield f.read(1024 * 1024)
while len(chunk := f.read(1024 * 1024)) > 0:
yield chunk


def get_target_slot_number() -> int:
Expand Down
1 change: 0 additions & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,5 @@ Learn about the openpilot ecosystem and tools by playing our [CTF](/tools/CTF.md
├── scripts/ # Miscellaneous scripts
├── serial/ # Tools for using the comma serial
├── sim/ # Run openpilot in a simulator
├── ssh/ # SSH into a comma device
└── webcam/ # Run openpilot on a PC with webcams
```

0 comments on commit b3aec47

Please sign in to comment.