bkerler / edl

Inofficial Qualcomm Firehose / Sahara / Streaming / Diag Tools :)
GNU General Public License v3.0
1.59k stars 372 forks source link

AttributeError: type object 'req' has no attribute 'version' . Error in the first step itself #508

Open gstjee opened 7 months ago

gstjee commented 7 months ago

It seems there is some issue in python code itself(exception handling or anything else) of edl file.

Error: ....... main - Mode detected: sahara Traceback (most recent call last): File "C:\Users\GuruHP\edl\edl", line 386, in base.run() File "C:\Users\GuruHP\edl\edl", line 294, in run version = conninfo["data"].version AttributeError: type object 'req' has no attribute 'version'

Tried with and without loader & also with serial port or zadig driver , but still same error coming.

Device is Motorola Edge 30 (Dubai)

Llixuma commented 7 months ago

same here, if i restart EDL mode it gets stuck on "Trying to read first storage sector"

LukeShortCloud commented 6 months ago

I'm getting the same errors on Fedora (SELinux is set to permissive) when using any edl command. For example, trying to backup the boot image:

$ edl --loader=xbl_s_devprg_ns.melf --memory=ufs r init_boot_a ~/init_boot_a.img
Keystone library is missing (optional).
Qualcomm Sahara / Firehose Client V3.62 (c) B.Kerler 2018-2023.
main - Using loader xbl_s_devprg_ns.melf ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Traceback (most recent call last):
  File "/usr/bin/edl", line 386, in <module>
    base.run()
  File "/usr/bin/edl", line 294, in run
    version = conninfo["data"].version
              ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'req' has no attribute 'version'

I tried this hack to get around the error but the edl command seems to hang (which could be another issue).

$ sudo vim /usr/bin/edl
        if not "data" in conninfo:
            version = 2
        else:
            #version = conninfo["data"].version
            version = 2

@bkerler do you have any suggestions on how we can work around this?

dzid26 commented 6 months ago

I was getting that after loading the wrong loader. It would only clear after reconnecting USB and choosing correct loader.

LukeShortCloud commented 6 months ago

Unplugging and plugging in the USB cable did the trick for me, too!

On a related note, it sounds like there should be some error reporting added. For example:

        if not "data" in conninfo:
            version = 2
        else:
            try:
                version = conninfo["data"].version
            except:
                print("ERROR: Unable to find a suitable EDL connection. Try switching the device to EDL mode with 'adb reboot edl' and replugging in the USB cable.")
bernardovalente commented 6 months ago

I'm getting the same error as discribed but unplugging/plugging did not solve the issue. @dzid26 how do you choose from different loaders?

dzid26 commented 6 months ago

I'm getting the same error as discribed but unplugging/plugging did not solve the issue. @dzid26 how do you choose from different loaders?

Normally I use default loader which shows up when you start edl:

 .\edl getstorageinfo
Qualcomm Sahara / Firehose Client V3.62 (c) B.Kerler 2018-2023.
main - Trying with no loader given ...
main - Waiting for the device
.main - Device detected :)
sahara - Protocol version: 2, Version supported: 1
main - Mode detected: sahara
sahara - 
Version 0x2
------------------------
HWID:              0x0002123100000000 (MSM_ID:0x0008e0e1,OEM_ID:0x0000,MODEL_ID:0x0000)
CPU detected:      "SDA845"
PK_HASH:           0xafca69d4235117e5bfc21467068b20df85e0115d7413d5821883a6d244961581
Serial:            0x75f3acff

sahara - Possibly unfused device detected, so any loader should be fine...
sahara - Trying loader: C:\Apps\edl\edlclient\..\Loaders\qualcomm\factory\sdm845_sdm850_sda845\0008e0e100000000_afca69d4235117e5_fhprg.bin
sahara - Protocol version: 2, Version supported: 1
sahara - Uploading loader C:\Apps\edl\edlclient\..\Loaders\qualcomm\factory\sdm845_sdm850_sda845\0008e0e100000000_afca69d4235117e5_fhprg.bin ...
sahara - 64-Bit mode detected.
sahara - Firehose mode detected, uploading...
sahara - Loader successfully uploaded.
main - Trying to connect to firehose loader ...

If you want to change the loader use --loader="path_to_laoder". It has to be right type of loader for your device. Sometimes there are few options. After each unsuccessful try reconnect usb.

bernardovalente commented 6 months ago

Issue resolved, had to reinstall the drivers and used the latest edl version. Thank you

filipe-maia commented 6 months ago

I have a Xiaomi Redmi Note 6 Pro and I was also having this problem on Linux.

I tried editing the edl file with @LukeShortCloud's suggestions to see if I could reach further, but no. Anyway, I do think that the last suggestion by @LukeShortCloud should be added to master.

I then decided to try on Windows 10, and still I was getting this error.

I then tried on Windows 10 to install Zadig's libusb-win32 drivers and everything started to work.

filipe-maia commented 6 months ago

I also tried Zadig's libusbK, this driver seems to work as well as libusb-win32.

ElectroBoy404NotFound commented 5 months ago

I have a Xiaomi Redmi Note 6 Pro and I was also having this problem on Linux.

I tried editing the edl file with @LukeShortCloud's suggestions to see if I could reach further, but no. Anyway, I do think that the last suggestion by @LukeShortCloud should be added to master.

I then decided to try on Windows 10, and still I was getting this error.

I then tried on Windows 10 to install Zadig's libusb-win32 drivers and everything started to work.

Hmm maybe some permission problem in linux?

cuynu commented 4 months ago

still no solution?? this does work on my lg sdm845/sm8150 but doesn't work on redmagic 9 pro or other devices with the same chip, it throw the same error as above

ElectroBoy404NotFound commented 4 months ago

still no solution?? this does work on my lg sdm845/sm8150 but doesn't work on redmagic 9 pro or other devices with the same chip, it throw the same error as above

I think you need a firehose file made specifically for your device.

cuynu commented 4 months ago

still no solution?? this does work on my lg sdm845/sm8150 but doesn't work on redmagic 9 pro or other devices with the same chip, it throw the same error as above

I think you need a firehose file made specifically for your device.

yes, i used specific firehose which is works with QFIL on windows but not on bkerler/edl, it just throw error like this issue and doesnt even detect device info

Liogl commented 3 weeks ago

I thought some might find it helpful: I washing flashing the Lenovo ThinkSmart View and ran into the "AttributeError: type object 'req' has no attribute 'version'". Solution: I disconnected the usb wire to the Lenovo device, restarted edl, then reconnected and it worked. I really don't know why. I am running Ubuntu 22.04 LTS 64bit Server on RPi 4b.