From 880f88f2c9d99922ca13a4a0a98a027a0796a96e Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Sun, 19 Dec 2021 00:28:54 +0100 Subject: [PATCH] Fix cmd issues with newer sm83xx --- edlclient/Library/firehose.py | 11 ++++++----- edlclient/Library/usblib.py | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/edlclient/Library/firehose.py b/edlclient/Library/firehose.py index 0880a5a..92d5b9c 100755 --- a/edlclient/Library/firehose.py +++ b/edlclient/Library/firehose.py @@ -216,7 +216,7 @@ class firehose(metaclass=LogBase): resp = {"value": "NAK"} status = False if not skipresponse: - while b" 0: - data = usb_read(min(wMaxPacketSize, bytestoread)) + size=min(self.cfg.MaxPayloadSizeToTargetInBytes, bytestoread) + data = usb_read(size) wr.write(data) bytestoread -= len(data) show_progress(prefix="Read", pos=total - bytestoread, total=total, display=display) @@ -704,8 +704,8 @@ class firehose(metaclass=LogBase): sectors += 1 if sectors == 0: return None, None - if sectors > 34: - sectors = 34 + if sectors > 64: + sectors = 64 data = self.cmd_read_buffer(lun, 0, sectors, False) if data == b"": return None, None @@ -766,6 +766,7 @@ class firehose(metaclass=LogBase): f"ZLPAwareHost=\"{str(self.cfg.ZLPAwareHost)}\" " + \ f"SkipStorageInit=\"{str(int(self.cfg.SkipStorageInit))}\" " + \ f"SkipWrite=\"{str(int(self.cfg.SkipWrite))}\" " + \ + f"Verbose=\"True\" " + \ f"MaxPayloadSizeToTargetInBytes=\"{str(self.cfg.MaxPayloadSizeToTargetInBytes)}\"/>" + \ "" ''' diff --git a/edlclient/Library/usblib.py b/edlclient/Library/usblib.py index 2fb1854..0c5b6fe 100755 --- a/edlclient/Library/usblib.py +++ b/edlclient/Library/usblib.py @@ -398,14 +398,16 @@ class UsbClass(metaclass=LogBase): self.verify_data(bytearray(command), "TX:") return True - def read(self, length=0x80, timeout=None): + def read(self, length=None, timeout=None): + if length is None: + length=self.EP_IN.wMaxPacketSize if self.loglevel==logging.DEBUG: self.debug(inspect.currentframe().f_back.f_code.co_name + ":" + hex(length)) tmp = bytearray() extend = tmp.extend if timeout is None: timeout = self.timeout - buffer = self.buffer + buffer = self.buffer[:length] ep_read = self.EP_IN.read while len(tmp) == 0: try: