edl icon indicating copy to clipboard operation
edl copied to clipboard

Error command response reading (Timeout)

Open chakaponden opened this issue 1 year ago • 4 comments

main - Mode detected: sahara HWID: 0x0006b0e100420041 (MSM_ID:0x0006b0e1,OEM_ID:0x0042,MODEL_ID:0x0041) CPU detected: "MSM8940" PK_HASH: 0x073e81231dae45ba5575083feeccbaf85323b393e43e029e8ea5a683ecc3b6c6

Script is stuck at:

firehose - TargetName=MSM8937
firehose - MemoryName=eMMC
firehose - Version=1
firehose - Trying to read first storage sector...

With --debugmode argument I see device response with valid GPT data (4546492050415254... means EFI PART header) in binary format:


firehose - Trying to read first storage sector...
DeviceClass
DeviceClass - [LIB]: ['  File "/2500-sata/device/palm/PVG100/edl/./edl", line 402, in <module>\n    base.run()\n', '  File "/2500-sata/device/palm/PVG100/edl/./edl", line 396, in run\n    if fh.connect(sahara):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose_client.py", line 113, in connect\n    if self.firehose.configure(0):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 1006, in configure\n    rsp = self.cmd_read_buffer(0, 1, 1, False)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 702, in cmd_read_buffer\n    rsp = self.xmlsend(data, self.skipresponse)\n']
DeviceClass
DeviceClass - [LIB]: TX:<?xml version="1.0" ?><data><read SECTOR_SIZE_IN_BYTES="512" num_partition_sectors="1" physical_partition_number="0" start_sector="1"/>
DeviceClass
DeviceClass - [LIB]: TX:</data>
DeviceClass
DeviceClass - [LIB]: read:0x200
DeviceClass
DeviceClass - [LIB]: ['  File "/2500-sata/device/palm/PVG100/edl/./edl", line 402, in <module>\n    base.run()\n', '  File "/2500-sata/device/palm/PVG100/edl/./edl", line 396, in run\n    if fh.connect(sahara):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose_client.py", line 113, in connect\n    if self.firehose.configure(0):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 1006, in configure\n    rsp = self.cmd_read_buffer(0, 1, 1, False)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 702, in cmd_read_buffer\n    rsp = self.xmlsend(data, self.skipresponse)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 268, in xmlsend\n    tmp = self.cdc.read(timeout=None)\n']
DeviceClass
DeviceClass - [LIB]: RX:4546492050415254000001005c000000254081cd000000000100000000000000ffdfa303000000002200000000000000dedfa30300000000321b1098e2bbf24ba06e2bb33d000c20020000000000000038000000800000005108ba5c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
DeviceClass
DeviceClass - [LIB]: read:0x0
DeviceClass
DeviceClass - [LIB]: ['  File "/2500-sata/device/palm/PVG100/edl/./edl", line 402, in <module>\n    base.run()\n', '  File "/2500-sata/device/palm/PVG100/edl/./edl", line 396, in run\n    if fh.connect(sahara):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose_client.py", line 113, in connect\n    if self.firehose.configure(0):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 1006, in configure\n    rsp = self.cmd_read_buffer(0, 1, 1, False)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 702, in cmd_read_buffer\n    rsp = self.xmlsend(data, self.skipresponse)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 268, in xmlsend\n    tmp = self.cdc.read(timeout=None)\n']
DeviceClass
DeviceClass - [LIB]: RX:
DeviceClass
DeviceClass - [LIB]: read:0x5d
DeviceClass
DeviceClass - [LIB]: ['  File "/2500-sata/device/palm/PVG100/edl/./edl", line 402, in <module>\n    base.run()\n', '  File "/2500-sata/device/palm/PVG100/edl/./edl", line 396, in run\n    if fh.connect(sahara):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose_client.py", line 113, in connect\n    if self.firehose.configure(0):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 1006, in configure\n    rsp = self.cmd_read_buffer(0, 1, 1, False)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 702, in cmd_read_buffer\n    rsp = self.xmlsend(data, self.skipresponse)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 268, in xmlsend\n    tmp = self.cdc.read(timeout=None)\n']
DeviceClass
DeviceClass - [LIB]: RX:<?xml version="1.0" encoding="UTF-8" ?><data><log value="Finished sector address 0" /></data>
DeviceClass
DeviceClass - [LIB]: read:0x5c
DeviceClass
DeviceClass - [LIB]: ['  File "/2500-sata/device/palm/PVG100/edl/./edl", line 402, in <module>\n    base.run()\n', '  File "/2500-sata/device/palm/PVG100/edl/./edl", line 396, in run\n    if fh.connect(sahara):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose_client.py", line 113, in connect\n    if self.firehose.configure(0):\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 1006, in configure\n    rsp = self.cmd_read_buffer(0, 1, 1, False)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 702, in cmd_read_buffer\n    rsp = self.xmlsend(data, self.skipresponse)\n', '  File "/2500-sata/device/palm/PVG100/edl/edlclient/Library/firehose.py", line 268, in xmlsend\n    tmp = self.cdc.read(timeout=None)\n']
DeviceClass
DeviceClass - [LIB]: RX:<?xml version="1.0" encoding="UTF-8" ?><data><response value="ACK" rawmode="false" /></data>
DeviceClass
DeviceClass - [LIB]: Timed out
DeviceClass
DeviceClass - [LIB]: Timed out
DeviceClass
DeviceClass - [LIB]: Timed out
DeviceClass
DeviceClass - [LIB]: Timed out

Could you help me to find what can I do to manage my device correctly with edl tool?

chakaponden avatar Oct 01 '23 02:10 chakaponden

Well, it read the first sector ok and acked. Then it "Timed out". Was that on read or write or what? Who knows.

RenateUSB avatar Oct 01 '23 15:10 RenateUSB

Well, it read the first sector ok and acked. Then it "Timed out". Was that on read or write or what? Who knows.

It was read. For unknown reason it expects more data from the device when device already sent all GPT data

I patched quickly the cmd_read_buffer function in firehouse.py and now it reads GPT and data if I use --memory=UFS argument:

diff --git a/edlclient/Library/firehose.py b/edlclient/Library/firehose.py
index 7e2d197..beac632 100755
--- a/edlclient/Library/firehose.py
+++ b/edlclient/Library/firehose.py
@@ -266,11 +266,6 @@ class firehose(metaclass=LogBase):
             while b"<response value" not in rdata:
                 try:
                     tmp = self.cdc.read(timeout=None)
-                    if tmp == b"" in rdata:
-                        counter += 1
-                        time.sleep(0.05)
-                        if counter > timeout:
-                            break
                     rdata += tmp
                 except Exception as err:
                     self.error(err)
@@ -707,7 +702,7 @@ class firehose(metaclass=LogBase):
                 self.error(rsp.error)
             return rsp
         else:
-            bytestoread = self.cfg.SECTOR_SIZE_IN_BYTES * num_partition_sectors
+            bytestoread = 0
             total = bytestoread
             if display:
                 progbar.show_progress(prefix="Read", pos=total - bytestoread, total=total, display=display)
@@ -729,7 +724,7 @@ class firehose(metaclass=LogBase):
                     return response(resp=False, data=resData, error=info)
                 elif "rawmode" in rsp:
                     if rsp["rawmode"] == "false":
-                        return response(resp=True, data=resData)
+                        return response(resp=True, data=wd)
             else:
                 if len(rsp) > 1:
                     if b"Failed to open the UFS Device" in rsp[2]:

I believe it can break compatibility, but at least it fixed issue for my device, so the issue is on the edl script side. Let me know if I can help with more info

chakaponden avatar Oct 01 '23 15:10 chakaponden

For some reason it missed the ACK and kept on looking for it. Was this on Linux or Windows with WinUsb or the Com port driver?

RenateUSB avatar Oct 01 '23 16:10 RenateUSB

Was this on Linux or Windows with WinUsb or the Com port driver?

on Linux. Ubuntu 22.04

chakaponden avatar Oct 01 '23 16:10 chakaponden