Giter Club home page Giter Club logo

edl's Introduction

Qualcomm Sahara / Firehose Attack Client / Diag Tools

(c) B. Kerler 2018-2024 Licensed under GPLv3 license.

Be aware that if you use anything from this repository in any (including) compiled form, you need to opensource your code as well !

Violating against the GPLv3 license will enforce me to stop developing these opensource tools.

Why

  • Because we'd like to flexible dump smartphones
  • Because attacking firehose is kewl
  • Because memory dumping helps to find issues :)

QC Sahara V3 additional information for newer QC devices

  • For newer qc phones, loader autodetection doesn't work anymore as the sahara loader doesn't offer a way to read the pkhash anymore
  • Thus, for Sahara V3, you need to give a valid loader via --loader option !

Use LiveDVD (everything ready to go, based on Ubuntu):

User: user, Password:user (based on Ubuntu 22.04 LTS)

Live DVD V4

Live DVD V4 Mirror

Installation

Grab files and install

git clone https://github.com/bkerler/edl
cd edl
git submodule update --init --recursive
pip3 install -r requirements.txt

Linux (Debian/Ubuntu/Mint/etc):

# Debian/Ubuntu/Mint/etc
sudo apt install adb fastboot python3-dev python3-pip liblzma-dev git
sudo apt purge modemmanager
# Fedora/CentOS/etc
sudo dnf install adb fastboot python3-devel python3-pip xz-devel git
# Arch/Manjaro/etc
sudo pacman -S android-tools python python-pip git xz
sudo pacman -R modemmanager

sudo systemctl stop ModemManager
sudo systemctl disable ModemManager
sudo apt purge ModemManager


git clone https://github.com/bkerler/edl.git
cd edl
git submodule update --init --recursive
sudo cp Drivers/51-edl.rules /etc/udev/rules.d
sudo cp Drivers/50-android.rules /etc/udev/rules.d
python3 setup.py build
sudo python3 setup.py install

If you have SELinux enabled, you may need to set it to permissive mode temporarily to prevent permission issues. SELinux is commonly used by RedHat-like distros (for example, RHEL, Fedora, and CentOS). You can set it to permissive run-time until next boot with sudo setenforce 0.

macOS:

brew install libusb git

git clone https://github.com/bkerler/edl.git
cd edl
git submodule update --init --recursive
python3 setup.py build
sudo python3 setup.py install

Windows:

Install python + git

  • Install python 3.9 and git
  • If you install python from microsoft store, "python setup.py install" will fail, but that step isn't required.
  • WIN+R cmd

Get latest UsbDk 64-Bit

  • Install normal QC 9008 Serial Port driver (or use default Windows COM Port one, make sure no exclamation is seen)
  • Get usbdk installer (.msi) from here and install it
  • Test on device connect using "UsbDkController -n" if you see a device with pid 0x9008
  • Works fine under Windows 10 and 11 :D

Using serial port instead of usb

With Port autodetection

edl --serial

or Port name

edl --portname \\.\COM1

Get Loaders

You should get these automatically if you do a git submodule update --init --recursive or from here

Convert own EDL loaders for automatic usage

  • Make a subdirectory "newstuff", copy your edl loaders to this subdirectory

  • fhloaderparse newstuff Loaders

  • or sniff existing edl tools using Totalphase Beagle 480, set filter to filter({'inputs': False, 'usb3': False, 'chirps': False, 'dev': 26, 'usb2resets': False, 'sofs': False, 'ep': 1}), export to binary file as "sniffeddata.bin" and then use beagle_to_loader sniffeddata.bin

Install EDL loaders

  • mkdir examples
  • Copy all your loaders into the examples directory
  • fhloaderparse examples Loaders -> will autodetect and rename loader structure and copy them to the "Loaders" directory
  • Or rename Loaders manually as "msmid_pkhash[8 bytes].bin" and put them into the Loaders directory

Run EDL (examples)

Your device needs to have a usb pid of 0x9008 in order to make the edl tool work. If your device is semi bricked and entered the usb pid 0x900E, there are several options to get back the 0x9008 mode :

  1. Use a edl cable (Short D+ with GND) and force reboot the phone (either vol up + power pressing for more than 20 seconds or disconnect battery), works with emmc + ufs flash (this will only work if XBL/SBL isn't broken)

  2. If emmc flash is used, remove battery, short DAT0 with gnd, connect battery, then remove short.

  3. If a ufs flash is used, things are very much more complicated. You will need to open the ufs die and short the clk line on boot, some boards have special test points for that.

  4. Some devices have boot config resistors, if you find the right ones you may enforce booting to sdcard instead of flash.

Generic

  • edl -h -> to see help with all options
  • edl server --memory=ufs --tcpport=1340 -> Run TCP/IP server on port 1340, see tcpclient.py for an example client
  • edl xml run.xml -> To send a xml file run.xml via firehose
  • edl reset -> To reboot the phone
  • edl rawxml <xmlstring> -> To send own xml string, example : edl rawxml "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><data><response value=\"ACK\" /></data>
  • edl [anycommand] --debugmode -> enables Verbose. Do that only when REALLY needed as it will print out everything happening!

For EMMC Flash

  • edl printgpt -> to print gpt on device with emmc
  • edl rf flash.bin -> to dump whole flash for device with emmc
  • edl rl dumps --skip=userdata --genxml -> to dump all partitions to directory dumps for device with emmc and skipping userdata partition, write rawprogram0.xml
  • edl rs 0 15 data.bin -> to dump 15 sectors from starting sector 0 to file data.bin for device with emmc
  • edl rs 0 15 data.bin --skipresponse -> to dump 15 sectors from starting sector 0 to file data.bin for device with emmc, ignores missing ACK from phones
  • edl r boot_a boot.img -> to dump the partition "boot_a" to the filename boot.img for device with emmc
  • edl r boot_a,boot_b boot_a.img,boot_b.img -> to dump multiple partitions to multiple filenames
  • edl footer footer.bin -> to dump the crypto footer for Androids with emmc flash
  • edl w boot_a boot.img -> to write boot.img to the "boot" partition on lun 0 on the device with emmc flash
  • edl w gpt gpt.img -> to write gpt partition table from gpt.img to the first sector on the device with emmc flash
  • edl wl dumps -> to write all files from "dumps" folder to according partitions to flash
  • edl wf dump.bin -> to write the rawimage dump.bin to flash
  • edl e misc -> to erase the partition misc on emmc flash
  • edl gpt . --genxml -> dump gpt_main0.bin/gpt_backup0.bin and write rawprogram0.xml to current directory (".")

For UFS Flash

  • edl printgpt --memory=ufs --lun=0 -> to print gpt on lun 0
  • edl printgpt --memory=ufs -> to print gpt of all lun
  • edl rf lun0.bin --memory=ufs --lun=0 -> to dump whole lun 0
  • edl rf flash.bin --memory=ufs -> to dump all luns as lun0_flash.bin, lun1_flash.bin, ...
  • edl rl dumps --memory=ufs --lun=0 --skip=userdata,vendor_a -> to dump all partitions from lun0 to directory dumps for device with ufs and skip userdata and vendor_a partition
  • edl rl dumps --memory=ufs --genxml -> to dump all partitions from all lun to directory dumps and write rawprogram[lun].xml
  • edl rs 0 15 data.bin --memory=ufs --lun=0 -> to dump 15 sectors from starting sector 0 from lun 0 to file data.bin
  • edl r boot_a boot.img --memory=ufs --lun=4 -> to dump the partition "boot_a" from lun 4 to the filename boot.img
  • edl r boot_a boot.img --memory=ufs -> to dump the partition "boot_a" to the filename boot.img using lun autodetection
  • edl r boot_a,boot_b boot_a.img,boot_b.img --memory=ufs -> to dump multiple partitions to multiple filenames
  • edl footer footer.bin --memory=ufs -> to dump the crypto footer
  • edl w boot boot.img --memory=ufs --lun=4 -> to write boot.img to the "boot" partition on lun 4 on the device with ufs flash
  • edl w gpt gpt.img --memory=ufs --lun=4 -> to write gpt partition table from gpt.img to the lun 4 on the device with ufs flash
  • edl wl dumps --memory=ufs --lun=0 -> to write all files from "dumps" folder to according partitions to flash lun 0
  • edl wl dumps --memory=ufs -> to write all files from "dumps" folder to according partitions to flash and try to autodetect lun
  • edl wf dump.bin --memory=ufs --lun=0 -> to write the rawimage dump.bin to flash lun 0
  • edl e misc --memory=ufs --lun=0 -> to erase the partition misc on lun 0
  • edl gpt . --genxml --memory=ufs -> dump gpt_main[lun].bin/gpt_backup[lun].bin and write rawprogram[lun].xml to current directory (".")

QFIL emulation (credits to LyuOnLine):

  • For flashing full image:
    edl qfil rawprogram0.xml patch0.xml image_dir
    

For devices with peek/poke command

  • edl peek 0x200000 0x10 mem.bin -> To dump 0x10 bytes from offset 0x200000 to file mem.bin from memory
  • edl peekhex 0x200000 0x10 -> To dump 0x10 bytes from offset 0x200000 as hex string from memory
  • edl peekqword 0x200000 -> To display a qword (8-bytes) at offset 0x200000 from memory
  • edl pokeqword 0x200000 0x400000 -> To write the q-word value 0x400000 to offset 0x200000 in memory
  • edl poke 0x200000 mem.bin -> To write the binary file mem.bin to offset 0x200000 in memory
  • edl secureboot -> To display secureboot fuses (only on EL3 loaders)
  • edl pbl pbl.bin -> To dump pbl (only on EL3 loaders)
  • edl qfp qfp.bin -> To dump qfprom fuses (only on EL3 loaders)

For generic unlocking

  • edl modules oemunlock enable -> Unlocks OEM if partition "config" exists, fastboot oem unlock is still needed afterwards

Dump memory (0x900E mode)

  • edl memorydump

Streaming mode (credits to forth32)

Enter streaming mode

Sierra Wireless Modem
  • Send AT!BOOTHOLD and AT!QPSTDLOAD to modem port or use modem/boottodwnload.py script
  • Send AT!ENTERCND="A710" and then AT!EROPTION=0 for memory dump
  • edl --vid 1199 --pid 9070 --loader=loaders/NPRG9x35p.bin printgpt -> To show the partition table
Netgear MR1100
  • run boottodownload, device will enter download mode (0x900E pid)
  • edl printgpt --loader=Loaders/qualcomm/patched/mdm9x5x/NPRG9x55p.bin, device will reboot to 0x9008
  • now use edl regulary such as edl printgpt (do not use loader option)
ZTE MF920V, Quectel, Telit, etc.. Modem
  • run enableadb, or send to at port "AT+ZCDRUN=E", or send via qc_diag -sahara
  • adb reboot edl
  • edl printgpt -> To show the partition table

Run Diag port tools (examples)

For Oneplus 6T, enter #801# on dialpad, set Engineer Mode and Serial to on and try :

  • qc_diag -vid 0x05c6 -pid 0x676c -interface 0 -info

Usage

  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -info -> Send cmd "00" and return info
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -spc 303030303030 -> Send spc "303030303030"
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -cmd 00 -> Send cmd "00" (hexstring)
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -nvread 0x55 -> Display nvitem 0x55
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -nvbackup backup.json -> Backup all nvitems to a json structured file
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -efsread efs.bin -> Dump the EFS Modem partition to file efs.bin
  • qc_diag -vid 0x1234 -pid 0x5678 -interface 0 -efslistdir / -> Display / directory listing of EFS

Issues

  • Secure loader with SDM660 on Xiaomi not yet supported (EDL authentification)
  • VIP Programming not supported (Contributions are welcome !)
  • EFS directory write and file read has to be added (Contributions are welcome !)

Tested with

  • Oneplus 3T/5/6T/7T/8/8t/9/Nord CE/N10/N100 (Read-Only), BQ X, BQ X5, BQ X2, Gigaset ME Pure, ZTE MF210, ZTE MF920V, Sierra Wireless EM7455, Netgear MR1100-10EUS, Netgear MR5100
  • SIMCOM SIM8905E

Published under GPLv3 license Additional license limitations: No use in commercial products without prior permit.

Enjoy !

edl's People

Contributors

185264646 avatar bkerler avatar bongbui321 avatar ce1cecl avatar coldwindscholar avatar cyberman571 avatar danielkutik avatar dudeitssm avatar ek9852 avatar fox8091 avatar humdogm avatar icomrockefeller avatar informatic avatar jla3378 avatar kercre123 avatar koyuyesil avatar leo-pl avatar ligteltelecom avatar luk1337 avatar mateohhh avatar nextalone avatar onenormalusername avatar postrediori avatar prosch88 avatar r0rt1z2 avatar samueldr avatar stefanzierpersonal avatar stephan-gh avatar threader avatar weirded avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edl's Issues

struct.error: unpack requires a buffer of 8 bytes

Hello,

Thanks for this awesome tool :)
I'm trying to use it on LYF F300B, I can shorten a pin on the board to boot in edl. And I've a loader.
But I've an issue on the read_object function:

python3.7 edl.py -printgpt -memory ufs -lun 0

Qualcomm Sahara / Firehose Client (c) B.Kerler 2018.


Trying with loaders in Loader directory ...
Waiting for the device
Device detected :)
Mode detected: Firehose
TargetName=MSM8909
MemoryName=eMMC
Version=1

Reading from physical partition 0, sector 0, sectors 32
Progress: |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 100.0% Complete
Traceback (most recent call last):
  File "edl.py", line 370, in <module>
    main()
  File "edl.py", line 193, in main
    guid_gpt.parse(data,cfg.SECTOR_SIZE_IN_BYTES)
  File "/Users/sylvainblot/Repositories/nokia/edl/Library/gpt.py", line 118, in parse
    self.header = read_object(gptdata[sectorsize:sectorsize+0x5C], self.gpt_header)
  File "/Users/sylvainblot/Repositories/nokia/edl/Library/utils.py", line 242, in read_object
    obj[name] = struct.unpack(stype, data[pos:pos+struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 8 bytes

From what I've understood, when the exception occurred data[pos:pos+struct.calcsize(stype)] is b''.

If you need any debugging informations, let me know.

Regards

Unexpected error on uploading, maybe signature of loader wasn't accepted ?

zyl@MBP edl % ./edl.py --loader="/Volumes/SN750/padsj/image/prog_emmc_firehose_8917_ddr.mbn" printgpt
Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Using loader /Volumes/SN750/padsj/image/prog_emmc_firehose_8917_ddr.mbn ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Device is in EDL mode .. continuing.
sahara
sahara - [LIB]: Unexpected error on uploading, maybe signature of loader wasn't accepted ?
'int' object is not subscriptable
No suitable loader found :(
<Library.usblib.usb_class object at 0x10b21f110>
zyl@MBP edl % ./edl.py --loader="/Volumes/SN750/padsj/image/prog_emmc_firehose_8917_ddr.mbn" printgpt
Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Using loader /Volumes/SN750/padsj/image/prog_emmc_firehose_8917_ddr.mbn ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Sahara in error state, resetting ...
Traceback (most recent call last):
File "./edl.py", line 398, in
base.run()
File "./edl.py", line 308, in run
saharahdl.cmd_reset()
File "/Users/zyl/Downloads/edl/Library/sahara.py", line 558, in cmd_reset
if cmd["cmd"] == self.cmd.SAHARA_RESET_RSP:
TypeError: 'int' object is not subscriptable

Creating new files on EFS

Sorry, I understand it is not yet supported, but you obviously have more understanding on the protocol used here than I do, so maybe you have some tips.

The (not exposed to the command line) qcdiag::efswritefile function seems to look for an existing file and overwrite it with new data. Is there a way to create a totally new file? I tried to change the mode from O_RDONLY to O_RDWR and O_WRONLY, how it would work in Posix systems, but efs_open still returns -1.

Windows 10 compatibility issues

Current build environment: Python 3.7.5, Visual C++ Studio 2019 Community Edition with Microsoft Visual C++ 14.2. Was necessary to install python -m pip install --upgrade setuptools before doing python -m pip install -r requirements.txt

Currently not working, neither with Qualcomm HS-USB QDLoader 9008 + libusb-win32 (nor with Zadig 2.4).

Traceback:

PS E:\personal\tools\edl\edl-master\edl-master> python edl.py printgpt --memory=UFS --debugmode

Library.usblib - connect:0x80000
Library.firehose - Chip serial num: ********** (0x********)
Library.usblib - connect:0x80000
Traceback (most recent call last):
File "E:\personal\tools\edl\edl-master\edl-master\Library\usblib.py", line 172, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "C:\Users\csorgi\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\core.py", line 988, in read
self.__get_timeout(timeout))
File "C:\Users\csorgi\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 542, in bulk_read
timeout)
File "C:\Users\csorgi\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 627, in __read
timeout
File "C:\Users\csorgi\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 431, in _check
raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] timeout error\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl.py", line 1712, in
main()
File "edl.py", line 411, in main
handle_firehose(args, cdc, sahara, verbose)
File "edl.py", line 1145, in handle_firehose
supported_functions = fh.connect(0)
File "E:\personal\tools\edl\edl-master\edl-master\Library\firehose.py", line 513, in connect
data=self.cdc.read() #logbuf
File "E:\personal\tools\edl\edl-master\edl-master\Library\usblib.py", line 174, in read
if "timed out" in e.strerror:
TypeError: a bytes-like object is required, not 'str'

Support for MBN programmer

It seems that fhloaderparse.py now only recognize ELF programmers, however some of the devices (Nexus 5/6p, OnePlusX, etc.) use the old MBN loader, should we add it for backward compability?

struct.error: unpack requires a buffer of 4 bytes

python3 edl.py --loader=prog_firehose_ddr.elf w boot boot.img
Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.
main - Using loader prog_firehose_ddr.elf ...
main - Waiting for the device
..main - Device detected :)
Traceback (most recent call last):
File "edl.py", line 435, in doconnect
mode, resp = sahara.connect()
File "/home/boostupstation/Downloads/edl-master/Library/sahara.py", line 332, in connect
cmd, pkt = self.get_rsp()
File "/home/boostupstation/Downloads/edl-master/Library/sahara.py", line 260, in get_rsp
pkt = read_object(v[0:0x2*0x4], self.pkt_cmd_hdr)
File "/home/boostupstation/Downloads/edl-master/Library/utils.py", line 264, in read_object
obj[name] = struct.unpack(stype, data[pos:pos+struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl.py", line 1644, in
main()
File "edl.py", line 375, in main
mode, resp = doconnect(cdc, loop, mode, resp, sahara)
File "edl.py", line 440, in doconnect
mode, resp = sahara.connect()
File "/home/boostupstation/Downloads/edl-master/Library/sahara.py", line 332, in connect
cmd, pkt = self.get_rsp()
File "/home/boostupstation/Downloads/edl-master/Library/sahara.py", line 260, in get_rsp
pkt = read_object(v[0:0x2*0x4], self.pkt_cmd_hdr)
File "/home/boostupstation/Downloads/edl-master/Library/utils.py", line 264, in read_object
obj[name] = struct.unpack(stype, data[pos:pos+struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes

how to find correct programmer (write error)

Hello, trying to unbrick. Have firmware.bin which came from successful read of entire firmware. When try write firmware back in using wf firmware.bin, generates this error.
UsbClass - [LIB]: wait_for_data:0x1000
UsbClass
UsbClass - [LIB]: Timed out
UsbClass
UsbClass - [LIB]: b''
firehose
firehose - [LIB]: Error:{}
Error writing ____ to sector _____

By the way, chip shows up as Qualcomm, Inc. Gobi Wireless Modem (QDL mode) and shows:

HWID: 0x009600e100000000 (MSM_ID:0x009600e1,OEM_ID:0x0000,MODEL_ID:0x0000)
CPU detected: "MSM8909"
PK_HASH: 0xcc3153a80293939b90d02d3bf8b23e0292e452fef662c74998421adad42a380f
Serial: 0x1c5f7aa2

How I can unbrick: is programmer in firmware? a few mbn files in there...
https://cellphonetrackers.org/wp-content/uploads/8x60_msimage.mbn_.txt

Missleading supported functions.

Device: Xiaomi Redmi 5+ (tiffany)
Loader: 000460E100000000_57158eaf1814d78f_FHPRG (97ef3f33ce7c28225dee6950243dd6f31c0c90757e6f5bd4a8cba04dc1479b3a)

edl.py reports:

main - Supported functions:

program,write,read,patch

But i can see "peek" and "poke" inside loader. So i tried patch 'check_cmd' to always True. And now 'unsupported' commands seems like working:

Library.usblib - TX:
Library.usblib - cmd_peek:0x1000
Library.usblib - RX: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e3c646174613e3c6c6f672076616c75653d22496e76616c696420706172616d657465727322202f3e3c2f646174613e
Library.usblib - cmd_peek:0x1000
Library.usblib - RX: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e3c646174613e3c726573706f6e73652076616c75653d224e414b22202f3e3c2f646174613e
Library.usblib - TX:
Library.usblib - cmd_peek:0x1000
Library.usblib - RX: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e3c646174613e3c6c6f672076616c75653d225573696e67206164647265737320303030613031643022202f3e3c2f646174613e
Library.usblib - cmd_peek:0x1000
Library.usblib - RX: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e3c646174613e3c6c6f672076616c75653d22307833302030783330203078333020307830302022202f3e3c2f646174613e
Library.usblib - cmd_peek:0x1000
Library.usblib - RX: 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e3c646174613e3c726573706f6e73652076616c75653d2241434b22202f3e3c2f646174613e
Sec_Boot0 PKHash-Index:0 OEM_PKHash: True Auth_Enabled: True Use_Serial: False
Sec_Boot1 PKHash-Index:0 OEM_PKHash: True Auth_Enabled: True Use_Serial: False
Sec_Boot2 PKHash-Index:0 OEM_PKHash: True Auth_Enabled: True Use_Serial: False
Sec_Boot3 PKHash-Index:0 OEM_PKHash: False Auth_Enabled: False Use_Serial: False
Secure boot enabled.

randomly gets stuck on windows?

Hi,

When I try dumping any partition, sometimes it succeeds, but most of the time it gets stuck at a random percent. Usually it stops at 99% but I have seen it get stuck at 55% or something. I am running windows 10.

UFS Flash to boot_a long time, is this normal?

i Flash boot_a in oneplus n10 is slow

C:\Users\kitti\Desktop\edl-master>py edl.py w boot_a boot.img --memory=ufs --lun=4
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: firehose
firehose - Nop succeeded.
firehose - Chip serial num: 575202359 (0x2248e437)
firehose - Supported Functions: program,read,nop,patch,configure,setbootablestoragedrive,erase,power,firmwarewrite,getstorageinfo,benchmark,emmc,ufs,fixgpt,getsha256digest,eraseuserdata,setprocstart,setswprojmodel
firehose -
firehose - TargetName=
firehose - MemoryName=UFS
firehose - Version=
firehose_client - Supported functions:

program,read,nop,patch,configure,setbootablestoragedrive,erase,power,firmwarewrite,getstorageinfo,benchmark,emmc,ufs,fixgpt,getsha256digest,eraseuserdata,setprocstart,setswprojmodel
firehose -
Writing to physical partition 4, sector 160390, sectors 24576
Progress: |โ–ˆโ–ˆโ–ˆโ–ˆ----------------------------------------------| 8.1% Complete (Sector 1980)0)

./edl.py modules oemunlock not working

When I enter ./edl.py modules oemunlock it shows the usage options.

[manjaro@manjaro edl]$ ./edl.py modules oemunlock
Usage:
    edl.py -h | --help
    edl.py [--vid=vid] [--pid=pid]
    edl.py [--loader=filename] [--memory=memtype]
    edl.py [--debugmode]
    edl.py [--gpt-num-part-entries=number] [--gpt-part-entry-size=number] [--gpt-part-entry-start-lba=number]
    edl.py [--memory=memtype] [--skipstorageinit] [--maxpayload=bytes] [--sectorsize==bytes]
    edl.py server [--tcpport=portnumber] [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py printgpt [--memory=memtype] [--lun=lun] [--loader=filename] [--debugmode]  [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py gpt <directory> [--memory=memtype] [--lun=lun] [--genxml] [--loader=filename]  [--skipresponse] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py r <partitionname> <filename> [--memory=memtype] [--lun=lun] [--loader=filename]  [--skipresponse] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py rl <directory> [--memory=memtype] [--lun=lun] [--skip=partnames] [--genxml]  [--skipresponse] [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py rf <filename> [--memory=memtype] [--lun=lun] [--loader=filename] [--debugmode]  [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py rs <start_sector> <sectors> <filename> [--lun=lun] [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py w <partitionname> <filename> [--memory=memtype] [--lun=lun] [--skipwrite] [--skipresponse] [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py wl <directory> [--memory=memtype] [--lun=lun] [--skip=partnames] [--skipresponse] [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py wf <filename> [--memory=memtype] [--lun=lun] [--loader=filename] [--skipresponse] [--debugmode] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py ws <start_sector> <filename> [--memory=memtype] [--lun=lun] [--skipwrite] [--skipresponse] [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py e <partitionname> [--memory=memtype] [--skipwrite] [--lun=lun] [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py es <start_sector> <sectors> [--memory=memtype] [--lun=lun] [--skipwrite] [--loader=filename] [--skipresponse] [--debugmode] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py footer <filename> [--memory=memtype] [--lun=lun] [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py peek <offset> <length> <filename> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py peekhex <offset> <length> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py peekdword <offset> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py peekqword <offset> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py memtbl <filename> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py poke <offset> <filename> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py pokehex <offset> <data> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py pokedword <offset> <data> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py pokeqword <offset> <data> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py memcpy <srcoffset> <dstoffset> <size> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py secureboot [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py pbl <filename> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py qfp <filename> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py getstorageinfo [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py setbootablestoragedrive <lun> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py send <command> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid]
    edl.py xml <xmlfile> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py rawxml <xmlstring> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--devicemodel=value]
    edl.py reset [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py nop [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid]
    edl.py modules <command> <options> [--memory=memtype] [--lun=lun] [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--devicemodel=value]

xml.etree.ElementTree.ParseError

Hi

I can connect to Nokia 8110 4G, but I could not run -printgpt or -w command, it popped up following errors:

scottzhao@scottzhao-ubuntu:~/edl$ python3 edl.py -loader 8110.mbn -printgpt

Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.
Using loader 8110.mbn ...
Waiting for the device
..........Device detected :)
Mode detected: Sahara

HWID: 0x000940e100420050 (MSM_ID:0x000940e1,OEM_ID:0x0042,MODEL_ID:0x0050)
PK_HASH: 0x1357fdaeabb7becbe49095f000d9d3dadf198885106d98598cac6d1b9b2edb3a
Serial: 0x14d04a0f
SBL Version: 0x00000000

Successfully uploaded programmer :)
TargetName=MSM8909
MemoryName=eMMC
Version=1

Reading from physical partition 0, sector 0, sectors 32

Traceback (most recent call last):
File "edl.py", line 419, in
main()
File "edl.py", line 197, in main
data = fh.cmd_read_buffer(args.lun, 0, 0x4000 // cfg.SECTOR_SIZE_IN_BYTES)
File "/home/scottzhao/edl/Library/firehose.py", line 241, in cmd_read_buffer
rsp=self.xmlsend(data)
File "/home/scottzhao/edl/Library/firehose.py", line 73, in xmlsend
resp = self.xml.getresponse(data)
File "/home/scottzhao/edl/Library/firehose.py", line 16, in getresponse
tree = ET.fromstring(line, parser=parser)
File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 5

Firstly I thought my python 3.6.10 is too old, then I switched to python 3.7.8. but errors are same.

Any suggestions?

My PC is Ubuntu 18.04LTS, Python 3.7.8

Thanks

Hang in firehose section

Hi, I'm trying your tool on a msm8974 device where I should have a working loader for
Unfortunately it hangs somewhere in the firehose section during a usb read, here's the log:

main - Device detected :)
main - Mode detected: sahara
Device is in EDL mode .. continuing.
sahara - 
------------------------
HWID:              0x007bc0e100000000 (MSM_ID:0x007bc0e1,OEM_ID:0x0000,MODEL_ID:0x0000)
CPU detected:      "MSM8974ABv3"
PK_HASH:           0xcc3153a80293939b90d02d3bf8b23e0292e452fef662c74998421adad42a380f
Serial:            0x108211e7

sahara - Uploading loader /tmp/MPRG8974.mbn ...
sahara - Loader uploaded.
Successfully uploaded programmer :)
firehose
firehose - [LIB]: Nop failed.
firehose - No supported functions detected, configuring qc generic commands
firehose - 
firehose_client - Target detected: MSM8974ABv3
firehose_client - Based on the chipset, we assume eMMC as default memory type...
firehose - TargetName=
firehose - MemoryName=eMMC
firehose - Version=


^CTraceback (most recent call last):
  File "/tmp/edl/./edl.py", line 360, in <module>
    base.run()
  File "/tmp/edl/./edl.py", line 338, in run
    fh = firehose_client(args, self.cdc, self.sahara, self.__logger.level, print)
  File "/tmp/edl/Library/firehose_client.py", line 89, in __init__
    if self.firehose.configure(0):
  File "/tmp/edl/Library/firehose.py", line 891, in configure
    rsp = self.cmd_read_buffer(0, 1, 1, False)
  File "/tmp/edl/Library/firehose.py", line 674, in cmd_read_buffer
    tmp = self.cdc.read(self.cfg.MaxPayloadSizeToTargetInBytes)
  File "/tmp/edl/Library/usblib.py", line 331, in read
    tmp = self.device.read(self.EP_IN, length, timeout)
  File "/usr/lib/python3.9/site-packages/usb/core.py", line 1019, in read
    ret = fn(
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 846, in bulk_read
    return self.__read(self.lib.libusb_bulk_transfer,
  File "/usr/lib/python3.9/site-packages/usb/backend/libusb1.py", line 946, in __read
    retval = fn(dev_handle.handle,
KeyboardInterrupt

I've Ctrl-C'ed the program after waiting for multiple minutes. I've tried with multiple functions like printgpt, getstorageinfo or qfil, all show the same behavior.

usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] timeout error

Heya! Been trying to use this tool on a OnePlus 7 Pro to little success. I've gotten the libusb filter driver installed over the QC 9008 port and everything however I'm unable to read out anything from the device, as I get this error every attempt.

>python3 edl.py -memory ufs -r devinfo devinfo.bin

Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.


Trying with loaders in Loader directory ...
Waiting for the device
Device detected :)
Mode detected: Sahara

------------------------
HWID:              0x000a50e100514985 (MSM_ID:0x000a50e1,OEM_ID:0x0051,MODEL_ID:0x4985)
PK_HASH:           0x2acf3a85fde334e2e28d64cbc416b2474e0e95cad4698f143e27479d67e92d99
Serial:            0x14eedb3c
SBL Version:       0x00000000

Detected loader: Loaders\000a50e100514985_2acf3a85fde334e2_FHPRG.bin
Successfully uploaded programmer :)
Binary build date: Aug 20 2019 @ 10:45:48
Binary build date: Aug 20 2019 @ 10:45:48
Chip serial num: 351198012 (0x14eedb3c)
Supported Functions (21):
program
read
nop
patch
configure
setbootablestoragedrive
erase
power
firmwarewrite
getstorageinfo
benchmark
emmc
ufs
fixgpt
getsha256digest
gethwversion
getrfversion
getprjversion
setprojmodel
sha256init
sha256final
End of supported functions 21
TargetName=Unknown
MemoryName=UFS
Version=1
Traceback (most recent call last):
  File "edl.py", line 419, in <module>
    main()
  File "edl.py", line 215, in main
    data = fh.cmd_read_buffer(args.lun, 0, 0x4000 // cfg.SECTOR_SIZE_IN_BYTES,False)
  File "C:\Users\y2k\Desktop\edl\Library\firehose.py", line 265, in cmd_read_buffer
    rsp=self.xml.getresponse(self.cdc.read(self.cfg.MaxXMLSizeInBytes))
  File "C:\Users\y2k\Desktop\edl\Library\usb.py", line 67, in read
    tmp=self.device.read(self.EP_IN, length,timeout)
  File "C:\Users\y2k\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\core.py", line 988, in read
    self.__get_timeout(timeout))
  File "C:\Users\y2k\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 542, in bulk_read
    timeout)
  File "C:\Users\y2k\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 627, in __read
    timeout
  File "C:\Users\y2k\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb0.py", line 431, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] timeout error\n'

Any assistance would be appreciated. Thanks!

Error checking in 'cmd_peek'

Device: OnePlus6
Loader: 6000000000010000_dd7c5f2e53176bee_FHPRG.bin (2c67b51e1d24b57fb9f93a90f5da209f14732d70dfbed19e8a076f41ecc04550)

Note: failed to detect target name, so i patch it in firehose.connect, at the place "Unknown".

Issue: poke & peek also exists in programmer, but there is funny limitation:

Peek is disabled on secure boot devices

Limitation is very funny because "poke" has no any similar and executed well. (But poke in your tool want to check written data and broke on verifying peek)

So, peek return error at first response packet:

<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: Failed to run the last command -1" /></data>

but code does not handle it (error handling take place on next packets only):

Library.firehose - Peek: Address(0x300000),Size(0x3c000)
Library.usblib - TX:

Library.usblib - cmd_peek:0x1000
Library.usblib - RX: > 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e0a3c646174613e0a3c6c6f672076616c75653d224552524f523a204661696c656420746f2072756e20746865206c61737420636f6d6d616e64202d3122202f3e3c2f646174613e
Library.usblib - cmd_peek:0x1000
Library.usblib - RX:
Traceback (most recent call last):
File "edl.py", line 1645, in
main()
File "edl.py", line 412, in main
handle_firehose(args, cdc, sahara, verbose)
File "edl.py", line 1255, in handle_firehose
if fh.cmd_peek(v[0][0], v[0][1], filename, True):
File "E:.edl\tools\edl\Library\firehose.py", line 837, in cmd_peek
rdata = self.xml.getlog(tmp)[0].replace("0x", "").replace(" ", "")
IndexError: list index out of range

Question about capstone and keystone engine

Hi,

First of all thanks for this tool it helps me to flash my phones. The next thing i want to do is to implement this in C# so i can understand this, python and c# better. My question is what is the purpose of capstone and keystone engine for this program?

Thanks

cannot execute commands

Brand: Nubia , Model: z18 (NX606J) , CPU: SDM845
LOG:
Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.
main - Using loader D:\Downloads\edl-master\edl-master\Loaders\0008b0e100040000_6c1ed0375298d9a4fcd5c3bdd10776acdc6a927a3600b1d5dcfd57b9bacfe7c4_FHPRG.bin ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Device is in EDL mode .. continuing.
Library.sahara -

HWID: 0x0008b0e100040000 (MSM_ID:0x0008b0e1,OEM_ID:0x0004,MODEL_ID:0x0000)
PK_HASH: 0x6c1ed0375298d9a4fcd5c3b****0b1d5dcfd57b9bacfe7c4
Serial: 0x3d
8
SBL Version: 0x00000000

Successfully uploaded programmer :)
Library.firehose - INFO: Chip serial num: 1039624 (0x88)
Traceback (most recent call last):
File "D:\Downloads\edl-master\edl-master\Library\usblib.py", line 169, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "C:\Users\ice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\usb\core.py", line 988, in read
self.__get_timeout(timeout))
File "C:\Users\ice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\usb\backend\libusb0.py", line 542, in bulk_read
timeout)
File "C:\Users\ice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\usb\backend\libusb0.py", line 627, in __read
timeout
File "C:\Users\ice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\usb\backend\libusb0.py", line 431, in _check
raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] timeout error\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl.py", line 1592, in
main()
File "edl.py", line 411, in main
handle_firehose(args, cdc, sahara, verbose)
File "edl.py", line 1084, in handle_firehose
supported_functions = fh.connect(0)
File "D:\Downloads\edl-master\edl-master\Library\firehose.py", line 528, in connect
self.cdc.read()
File "D:\Downloads\edl-master\edl-master\Library\usblib.py", line 171, in read
if "timed out" in e.strerror:
TypeError: a bytes-like object is required, not 'str'

also trying to reset phone with debug command output:
.......



Traceback (most recent call last):
File "edl.py", line 1592, in
main()
File "edl.py", line 411, in main
handle_firehose(args, cdc, sahara, verbose)
File "edl.py", line 1084, in handle_firehose
supported_functions = fh.connect(0)
File "D:\Downloads\edl-master\edl-master\Library\firehose.py", line 556, in connect
self.cfg.MaxPayloadSizeFromTargetInBytes = int(rsp[1]["MaxPayloadSizeFromTargetInBytes"])

im getting this eeeor

configure,program,firmwarewrite,patch,setbootablestoragedrive,ufs,emmc,power,benchmark,read,getstorageinfo,getcrc16digest,getsha256digest,erase,peek,poke,nop,xml
Traceback (most recent call last):
File "edl.py", line 1581, in
main()
File "edl.py", line 197, in main
handle_firehose(args, cdc, sahara, verbose)
File "edl.py", line 989, in handle_firehose
int(arguments["--gpt-part-entry-start-lba"]))
File "E:\nokia 8110\zzzznokia\edl-master\Library\firehose.py", line 542, in get_gpt
data = self.cmd_read_buffer(lun, 0, 2, False)
File "E:\nokia 8110\zzzznokia\edl-master\Library\firehose.py", line 499, in cmd_read_buffer
if "value" in rsp[1]:
TypeError: a bytes-like object is required, not 'str'

Timeout on unresponsive phone

Hello!

Recently my phone became unresponsive after attempting a firmware upgrade. I am able to detect it, still

> dmesg
[ 8333.706835] qcserial 1-7:1.0: Qualcomm USB modem converter detected
[ 8333.706997] usb 1-7: Qualcomm USB modem converter now attached to ttyUSB0
> lsusb
Bus 001 Device 043: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)

My first attempt went like this:

> ./edl.py
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
Device is in Sahara error state, please reboot the device.
main - Mode detected: sahara
Sahara in error state, resetting ...

On further attempts, I can see it's timing out, always, for all commands I've tried

> sudo python3 ./edl.py --debugmode
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Trying with no loader given ...
main - Waiting for the device
UsbClass
UsbClass - [LIB]:   CONFIGURATION 1: 2 mA ====================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x20 (32 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0 
   bmAttributes         :   0x80 Bus Powered
   bMaxPower            :    0x1 (2 mA)
    INTERFACE 0: Vendor Specific ===========================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x2
     bInterfaceClass    :   0xff Vendor Specific
     bInterfaceSubClass :   0xff
     bInterfaceProtocol :   0xff
     iInterface         :    0x0 
      ENDPOINT 0x81: Bulk IN ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x81 IN
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x200 (512 bytes)
       bInterval        :    0x0
      ENDPOINT 0x1: Bulk OUT ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :    0x1 OUT
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x200 (512 bytes)
       bInterval        :    0x0
UsbClass
UsbClass - [LIB]: Detaching kernel driver
main - Device detected :)
UsbClass
UsbClass - [LIB]: connect:0x80
UsbClass
UsbClass - [LIB]: Timed out
UsbClass
UsbClass - [LIB]: b''
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: connect:0x80
UsbClass
UsbClass - [LIB]: Timed out
UsbClass
UsbClass - [LIB]: b''
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: [Errno 110] Operation timed out
UsbClass
UsbClass - [LIB]: connect:0x80
UsbClass
UsbClass - [LIB]: Timed out
UsbClass
UsbClass - [LIB]: b''
main - Unknown mode. Aborting.

Do I have hopes for recovering from this state using this tool? I'd be great to know

Feel free to close this issue if it's out of scope for this project. I'm mostly trying to understand what is going on with the device at the moment.

Read failed at sector 0, Invalid or unknown GPT magic.

I used this tool with my Windows machine, and it worked very well. I have a little APQ8009 robot which I unbricked with it.

However, when I tried to use it on my Linux (Ubuntu 20.04) machine, this is the output I get.

wire@wirebook:~/Desktop/edl$ sudo python3 edl.py rf starbutt.bin --loader=8909.mbn
Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Using loader 8909.mbn ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: firehose
firehose - Nop succeeded.
firehose - No supported functions detected, configuring qc generic commands
firehose -
firehose
firehose - [LIB]: GetStorageInfo command isn't supported.
firehose_client - No --memory option set, we assume "eMMC" as default ..., if it fails, try using "--memory" with "UFS","NAND" or "spinor" instead !
firehose - TargetName=MSM8909
firehose - MemoryName=eMMC
firehose - Version=1
firehose_client - Supported functions:

configure,program,firmwarewrite,patch,setbootablestoragedrive,ufs,emmc,power,benchmark,read,getstorageinfo,getcrc16digest,getsha256digest,erase,peek,poke,nop,xml
firehose
firehose - [LIB]: Error:
firehose
firehose - [LIB]: Read failed at sector 0
firehose
firehose - [LIB]: Finished sector address 0
firehose
firehose - [LIB]: Error:
firehose
firehose - [LIB]: Read failed at sector 0
firehose
firehose - [LIB]: Finished sector address 0
gpt
gpt - [LIB]: Invalid or unknown GPT magic.
Traceback (most recent call last):
File "edl.py", line 422, in
base.run()
File "edl.py", line 404, in run
fh.handle_firehose(cmd,options)
File "/home/wire/Desktop/edl/Library/firehose_client.py", line 280, in handle_firehose
self.printer(f"Dumping sector 0 with sector count {str(guid_gpt.totalsectors)} as {filename}.")
AttributeError: 'gpt' object has no attribute 'totalsectors'

Trying to use 'oemunlock' on TMO OP8T

I am trying to use the 'oemunlock' command on a t-mobile oneplus 8t (+ 5g). I get the same error with all 3 firehose.elf files from the .ops file (from msmdownloadtool). Also tried to use the fhloaderparse.py but get the same error. See the output below.

edl.py modules oemunlock enable --loader=prog_firehose_lite.elf

Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client V3 (c) B.Kerler 2018-2020.
Library.utils - Using loader prog_firehose_lite.elf ...
Library.utils - Waiting for the device
.....Library.utils - Device detected :)
Library.utils - Mode detected: sahara
Device is in EDL mode .. continuing.
Library.sahara -

HWID: 0x000c30e100514d6d (MSM_ID:0x000c30e1,OEM_ID:0x0051,MODEL_ID:0x4d6d)
PK_HASH: 0x????????
Serial: 0x????????
SBL Version: 0x00000000

Library.sahara - Using loader prog_firehose_lite.elf ...
Library.sahara - Unexpected error on uploading, maybe signature of loader wasn't accepted ?
unpack requires a buffer of 4 bytes
Traceback (most recent call last):
File "C:\Users????\Downloads\phonestuff\edl-master\edl.py", line 363, in
main()
File "C:\Users????\Downloads\phonestuff\edl-master\edl.py", line 319, in main
if streaming.connect(1):
File "C:\Users????\Downloads\phonestuff\edl-master\Library\streaming.py", line 624, in connect
if resp[1] != 2:
IndexError: bytearray index out of range

Oppo prjid 19672

Could you add Realme X2 support? Now I try to erase userdata, but nothing happen. When manually added 19672 in list of support, it stucks here:
`HWID: 0x000e60e100510000 (MSM_ID:0x000e60e1,OEM_ID:0x0051,MODEL_ID:0x0000)
PK_HASH: 0x32942e378adbc21376abb8b83a681e579bfebf5926c5bdc53b08f35738147041
Serial: 0x706d7079
SBL Version: 0x00000000

Library.sahara - Detected loader: Loaders/000E60E100510000_32942e378adbc213_FHPRG.bin
Successfully uploaded programmer :)
Library.firehose - INFO: Chip serial num: 1886220409 (0x706d7079)
Library.firehose -
Library.firehose - TargetName=
Library.firehose - MemoryName=eMMC
Library.firehose - Version=
main - Supported functions:

`
Dnt know why autodetect use eMMC, as I know there UFS used< but with manually chosed ufs still dnt work:

`
HWID: 0x000e60e100510000 (MSM_ID:0x000e60e1,OEM_ID:0x0051,MODEL_ID:0x0000)
PK_HASH: 0x32942e378adbc21376abb8b83a681e579bfebf5926c5bdc53b08f35738147041
Serial: 0x706d7079
SBL Version: 0x00000000

Library.sahara - Detected loader: Loaders/000E60E100510000_32942e378adbc213_FHPRG.bin
Successfully uploaded programmer :)
Library.firehose - INFO: Chip serial num: 1886220409 (0x706d7079)
Library.firehose -
Library.firehose - TargetName=
Library.firehose - MemoryName=ufs
Library.firehose - Version=
main - Supported functions:

`

Device is in unknown state

# python3.8 edl.py --loader="../extracted/prog_firehose_ddr_ufs.elf" printgpt
Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2020.
Library.utils - Using loader ../extracted/prog_firehose_ddr_ufs.elf ...
Library.utils - Waiting for the device
.....Library.utils - Device detected :)
Library.utils - Mode detected: sahara
Device is in an unknown state

Adding Netgear EDL

fdt.txt

I see the script attempts to send an XML string as a test command but the Netgear MR1100 does not respond to them. Can you please add these? I've attached a log of FDT but in short, noop command is sent as the following hex string:
7E 06 4E 95 7E

Other commands include

GetSwVersionInfo
7E 0C 14 3A 7E

SwitchToStreamingDownload
7E 70 00 00 14 46 7E

HelloRequest
7E 01 51 43 4F 4D 20 68 69 67 68 20 73 70 65 65 64 20 70 72 6F 74 6F 63 6F 6C 20 68 73 74 00 00 00 00 06 06 30 0B 8D 7E

UnframedWritePacket
27 00 00 00 00 00 00 50 71 70 06 58 D7

firehose - Nop succeeded. Traceback (most recent call last):

Hi can anyone help me I stopped at this step

Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Device is in EDL mode .. continuing.
sahara -

HWID: 0x0005e0e100010004 (MSM_ID:0x0005e0e1,OEM_ID:0x0001,MODEL_ID:0x0004)
CPU detected: "MSM8998_SDM835"
PK_HASH: 0xc30dec2471cea311e6918657367b51068a39583bbf89fd68b379bcd5a709ab1b
Serial: 0x1b0262c4

sahara - Detected loader: Loaders/Loaders/0005e0e100010004_c30dec2471cea311_fhprg.bin
sahara - Uploading loader Loaders/Loaders/0005e0e100010004_c30dec2471cea311_fhprg.bin ...
Successfully uploaded programmer :)
firehose - Nop succeeded.
Traceback (most recent call last):
File "edl.py", line 360, in
base.run()
File "edl.py", line 338, in run
fh = firehose_client(args, self.cdc, self.sahara, self.__logger.level, print)
File "/root/Python-3.7.9/Library/firehose_client.py", line 58, in init
self.firehose.connect()
File "/root/Python-3.7.9/Library/firehose.py", line 941, in connect
info = self.cmd_nop()
File "/root/Python-3.7.9/Library/firehose.py", line 283, in cmd_nop
return self.xml.getlog(val[2])
File "/root/Python-3.7.9/Library/xmlparser.py", line 28, in getlog
tree = ET.fromstring(line, parser=parser)
File "/root/Python-3.7.9/Lib/xml/etree/ElementTree.py", line 1315, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 5

firehose - Nop succeeded. Traceback (most recent call last):

Hi can anyone help me I stopped at this step

Qualcomm Sahara / Firehose Client V3.2 (c) B.Kerler 2018-2021.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: sahara
Device is in EDL mode .. continuing.
sahara -

HWID: 0x0005e0e100010004 (MSM_ID:0x0005e0e1,OEM_ID:0x0001,MODEL_ID:0x0004)
CPU detected: "MSM8998_SDM835"
PK_HASH: 0xc30dec2471cea311e6918657367b51068a39583bbf89fd68b379bcd5a709ab1b
Serial: 0x1b0262c4

sahara - Detected loader: Loaders/Loaders/0005e0e100010004_c30dec2471cea311_fhprg.bin
sahara - Uploading loader Loaders/Loaders/0005e0e100010004_c30dec2471cea311_fhprg.bin ...
Successfully uploaded programmer :)
firehose - Nop succeeded.
Traceback (most recent call last):
File "edl.py", line 360, in
base.run()
File "edl.py", line 338, in run
fh = firehose_client(args, self.cdc, self.sahara, self.__logger.level, print)
File "/root/Python-3.7.9/Library/firehose_client.py", line 58, in init
self.firehose.connect()
File "/root/Python-3.7.9/Library/firehose.py", line 941, in connect
info = self.cmd_nop()
File "/root/Python-3.7.9/Library/firehose.py", line 283, in cmd_nop
return self.xml.getlog(val[2])
File "/root/Python-3.7.9/Library/xmlparser.py", line 28, in getlog
tree = ET.fromstring(line, parser=parser)
File "/root/Python-3.7.9/Lib/xml/etree/ElementTree.py", line 1315, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 5

Segmentation fault (core dumped)

Hi
Im using Unbunto app from microsoft app store to install all packages and got seccesfulli installed :

b3hr4d@b3hr4d-pc:/mnt/c/Users/b3hr4d/Desktop/edl-master$ python3 -m pip install -r requirements.txt
Requirement already satisfied: pyusb in /home/b3hr4d/.local/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (1.0.2)
Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (3.4)
Requirement already satisfied: docopt in /home/b3hr4d/.local/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (0.6.2)
Requirement already satisfied: pylzma in /home/b3hr4d/.local/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (0.5.0)
Requirement already satisfied: pycryptodome in /home/b3hr4d/.local/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (3.9.7)

and already install all usb driver and trick for changing it to libusb 1.2.6
when i want access my phone using python3 edl.py --loader=prog_ufs_firehose_8998_ddr.elf printgpt --memory=ufs
got this error :

Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2019.
__main__ - Using loader prog_ufs_firehose_8998_ddr.elf ...
__main__ - Waiting for the device
Segmentation fault (core dumped)

whats problem ?

thanks

Need your help to recover realme xt

Hi
By mistake, I have locked boot loader of my RMX1921 with the custom ROM. So now I am not able to boot into fastboot nor it. Also because of the custom ROM and TWRP device doesn't boot into normal/recovery mode.

I was trying to perform OEM unlock using this tool.

I have download .ofp fle ref page

trying to perform some unlock but Sahara is not able to connect to the device

python3 edl/edl.py oemunlock --memory=ufs --loader=firehosefiles/prog_firehose_ddr.elf --debugmode

the device is detected as us 001 Device 090: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)

`Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2020.
main - Using loader firehosefiles/prog_firehose_ddr.elf ...
main - Waiting for the device
main - Ohuh
Library.usblib - Couldn't detect the device. Is it connected ?
.Library.usblib - Couldn't detect the device. Is it connected ?
.Library.usblib - CONFIGURATION 1: 160 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x20 (32 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0x80 Bus Powered
bMaxPower : 0x50 (160 mA)
INTERFACE 0: Vendor Specific ===========================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0xff Vendor Specific
bInterfaceSubClass : 0x42
bInterfaceProtocol : 0x3
iInterface : 0x4 9008
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
ENDPOINT 0x1: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x1 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x1
main - Device detected :)
Library.usblib - connect:0x80000
Library.usblib - Timed out
Library.usblib - b''
Library.usblib - TX:
Library.usblib - connect:0x80000
Library.usblib - Timed out
Library.usblib - b''
Library.usblib - TX:

Library.usblib - get_rsp:0x80000
Library.usblib - Timed out
Library.usblib - b''
Library.usblib - connect:0x80000
Library.usblib - Timed out
Library.usblib - b''
Library.usblib - TX:
Library.usblib - connect:0x80000
Library.usblib - Timed out
Library.usblib - b''
Library.usblib - TX:

Library.usblib - get_rsp:0x80000
Library.usblib - Timed out
Library.usblib - b''
Traceback (most recent call last):
File "edl/edl.py", line 437, in doconnect
mode, resp = sahara.connect()
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/sahara.py", line 332, in connect
cmd, pkt = self.get_rsp()
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/sahara.py", line 260, in get_rsp
pkt = read_object(v[0:0x2*0x4], self.pkt_cmd_hdr)
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/utils.py", line 264, in read_object
obj[name] = struct.unpack(stype, data[pos:pos+struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl/edl.py", line 1744, in
main()
File "edl/edl.py", line 377, in main
mode, resp = doconnect(cdc, loop, mode, resp, sahara)
File "edl/edl.py", line 442, in doconnect
mode, resp = sahara.connect()
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/sahara.py", line 332, in connect
cmd, pkt = self.get_rsp()
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/sahara.py", line 260, in get_rsp
pkt = read_object(v[0:0x2*0x4], self.pkt_cmd_hdr)
File "/home/rohit/Android/Sdk/platform-tools/realme/edl/Library/utils.py", line 264, in read_object
obj[name] = struct.unpack(stype, data[pos:pos+struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes
`

Vodafone Smart Ultra 6 please add it to supported devices or how it will?

Hello Good Friends!
if I give a sensitive info that without knowing, and this is no important!

image

I have falsely delete all emmc partitions. for VSU6, original brand is zte.
FTM mode has not actived but edm or edl has been active!

the phone the phone has been flashed with unauthorized software and is locked has been flashed with unauthorized software and is locked
this warning was given the phone during power on

image

I have mbn files, how can I also use the files as loader? How to converted mbn files to bin loader file

Thanks to reading Thanks to your helping

oem unlock command how to use?

Unfortunately there is no "config" partition on my device as it is an lg g7, I was wondering how can i
g7.txt
unlock it? if i change the config to something else in the py?
This is the G7 Parition Table

"wheel" is missing from requirements.txt

Fresh Debian 10 minimal. Installed sudo, gcc, python3, python3-venv, adb, fastboot, liblzma-dev, python3-dev. But then pip install -r requirements.txt failed making bdist_wheel. https://stackoverflow.com/a/44862371 revealed why, and pip install wheel fixed things.

So I suggest you add wheel to requirements.txt.

And possibly python3-dev to your apt package list in the readme.

Thanks!

Can I extract "Loader" from device ??

Hi.
I'm challenging hacking for "CLOVA Desk",
https://clova.line.me/desk/

HWID: 0x000660e101420700 (MSM_ID:0x000660e1,OEM_ID:0x0142,MODEL_ID:0x0700)
CPU detected: "APQ8053"
PK_HASH: 0x7be49b72f9e4337223ccb84d6eccca4e61ce16e3602ac2008cb18b75babe6d09
Serial: 0x00d91829

but I could not found suitable the Loader.
How I get the loader ? Is it enable to dump from eMMC with wire? or anything to do.

Samsung s9 G960U flash

I whant to know if there is any solution for flash G960U via edl because I keep stuck when need to send system.img
26B83986-F7D8-4CDB-96CE-B316CF049F50

ModuleNotFoundError: No module named 'docopt'

how to fix pls help me

C:\Users\Admin\Desktop\edl-master\edl-master>@python\python.exe edl.py rl dumps --memory=ufs --genxml
Traceback (most recent call last):
File "edl.py", line 105, in
from docopt import docopt
ModuleNotFoundError: No module named 'docopt'

About reading RPMB data

First of all , thanks for this tool as it is the only one I have seen to have the possibility to read bootrom and qfuses. I have a question, since many loaders run in EL3 and support peeking qfuses, while the RPMB provision keys were blown into these regions, is it possible to read out the key and gain access to data stored on EMMC/UFS rpmb storage?

usb.core.USBError: [Errno 5] Input/Output Error

Hello, I am trying to unbrick a cell phone and when I try this command it throws me the following:

OS: Kali Linux 32 bits (I'm thinking this is the problem or the phone memory is dead, idk)
(All the libraries and required python install it correctly)

`
root@bangho-atom:/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master# sudo python3 edl.py wl unbrick --loader=unbrick/prog_emmc_firehose_zte_8909.mbn && sudo python3 edl.py reset >> error.txt
Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2020.
main - Using loader unbrick/prog_emmc_firehose_zte_8909.mbn ...
main - Waiting for the device
main - Device detected :)
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
USBError(5, 'Input/Output Error') <class 'usb.core.USBError'> 5
Traceback (most recent call last):
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 322, in connect
v = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 338, in connect
res = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl.py", line 223, in doconnect
mode, resp = sahara.connect()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 345, in connect
res = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 322, in connect
v = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 338, in connect
res = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "edl.py", line 1589, in
main()
File "edl.py", line 162, in main
mode, resp = doconnect(cdc, loop, mode, resp, sahara)
File "edl.py", line 228, in doconnect
mode, resp = sahara.connect()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/sahara.py", line 345, in connect
res = self.cdc.read()
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 259, in read
raise(e)
File "/media/bangho/DATOS/PROYECTOS/unbrick_something/edl-master/Library/usblib.py", line 243, in read
tmp=self.device.read(self.EP_IN, length,timeout)
File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 1017, in read
ret = fn(
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 846, in bulk_read
return self.__read(self.lib.libusb_bulk_transfer,
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 954, in __read
_check(retval)
File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error
`

Timeout with Streaming mode

Streaming mode is now supported with commit 036bc63

Originally posted by @bkerler in #33 (comment)

Still have issues with it sending commands

default@deb:~/edl$ python3 ./edl.py printgpt --loader=Loaders/0000000000000000_b53fb23d1953decb_FHPRG.bin --vid 0846 --pid 68e0 --debugmode
Capstone and Keystone libraries missing.
Qualcomm Sahara / Firehose Client V3 (c) B.Kerler 2018-2020.
Library.utils - Using loader Loaders/0000000000000000_b53fb23d1953decb_FHPRG.bin ...
Library.utils - Waiting for the device
Library.utils - Ohuh
Library.utils -   CONFIGURATION 1: 2 mA ====================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x2c (44 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0
   bmAttributes         :   0xa0 Bus Powered, Remote Wakeup
   bMaxPower            :    0x1 (2 mA)
    INTERFACE 0: Vendor Specific ===========================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x2
     bInterfaceClass    :   0xff Vendor Specific
     bInterfaceSubClass :   0xff
     bInterfaceProtocol :   0xff
     iInterface         :    0x0
      ENDPOINT 0x81: Bulk IN ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x81 IN
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x400 (1024 bytes)
       bInterval        :    0x0
      ENDPOINT 0x1: Bulk OUT ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :    0x1 OUT
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x400 (1024 bytes)
       bInterval        :    0x0
Library.utils - Device detected :)
Library.utils - connect:0x80
Library.utils - Timed out
Library.utils - b''
Library.utils - TX:7e11001200a0e30000c1e50140a0e31eff2fe14bd97e
Library.utils - connect:0x80
Library.utils - RX:7e0d1600000000884d7e
Library.utils - TX:0c0000000c00000003000000
Library.utils - TX:<?xml version="1.0" ?><data><nop /></data>
Library.utils - connect:0x80
Library.utils - Timed out
Library.utils - b''
Library.utils - TX:0c0000000c00000002000000
Library.utils - get_rsp:0x80
Library.utils - Timed out
Library.utils - b''
Library.utils - connect:0x80
Library.utils - Timed out
Library.utils - b''
Library.utils - TX:7e11001200a0e30000c1e50140a0e31eff2fe14bd97e
Library.utils - connect:0x80
Library.utils - RX:7e0d1600000000884d7e
Library.utils - TX:0c0000000c00000003000000
Library.utils - TX:<?xml version="1.0" ?><data><nop /></data>
Library.utils - connect:0x80
Library.utils - Timed out
Library.utils - b''
Library.utils - TX:0c0000000c00000002000000
Library.utils - get_rsp:0x80
Library.utils - Timed out
Library.utils - b''
Traceback (most recent call last):
  File "./edl.py", line 140, in doconnect
    mode, resp = sahara.connect()
  File "/home/default/edl/Library/sahara.py", line 379, in connect
    cmd, pkt = self.get_rsp()
  File "/home/default/edl/Library/sahara.py", line 294, in get_rsp
    pkt = read_object(v[0:0x2 * 0x4], self.pkt_cmd_hdr)
  File "/home/default/edl/Library/utils.py", line 464, in read_object
    obj[name] = struct.unpack(stype, data[pos:pos + struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./edl.py", line 363, in <module>
    main()
  File "./edl.py", line 268, in main
    mode, resp = doconnect(cdc, loop, mode, resp, sahara)
  File "./edl.py", line 145, in doconnect
    mode, resp = sahara.connect()
  File "/home/default/edl/Library/sahara.py", line 379, in connect
    cmd, pkt = self.get_rsp()
  File "/home/default/edl/Library/sahara.py", line 294, in get_rsp
    pkt = read_object(v[0:0x2 * 0x4], self.pkt_cmd_hdr)
  File "/home/default/edl/Library/utils.py", line 464, in read_object
    obj[name] = struct.unpack(stype, data[pos:pos + struct.calcsize(stype)])[0]
struct.error: unpack requires a buffer of 4 bytes

Loader

"Put your loaders into the Loader directory for autodetection. See PutYourLoadersInHere.txt on how to store the loaders correctly to make the autodetection work :)"
"009900E100000000_3be970a8579cac80_FHPRG.bin"
How can i get this "loader" file? Can't find anything about this file on the internet :(

SDM665 SUPPORT?

Hi
Thanks for great work.
I own xiaomi sdm665 device which is dead
There is no msmid for sdm665 in edl.py
and no chance of dumping pbl with your tool.
Is this about secure loading on xiaomi devices or something wrong about qcom
And two thing else
Do you tried to fetch signature out of pbl and patch and resign loader to bypass secure load?
Is it possible to load sbl or aboot or boot image through firehose to complete boot from usb ?

Time Out Read to File

Get time outs consistently when reading partition to file, full speed to a certain point then timeouts. Tried multiple USB ports.

Command used:
./edl.py r boot boot.img

Log for reference:
debug.log

QFIL

<maik@maik-ThinkPad-X250:~/Downloads/edl$ ./qfil.py --log_level info --firehose ../qcom8937_spf1.0_1605052340_qpst/prog_emmc_firehose_8937_ddr.mbn --rawprogram ../qcom8937_spf1.0_1605052340_qpst/rawprogram0.xml --patch ../qcom8937_spf1.0_1605052340_qpst/patch0.xml --imagedir ../qcom8937_spf1.0_1605052340_qpst
[INFO] firehose image: ../qcom8937_spf1.0_1605052340_qpst/prog_emmc_firehose_8937_ddr.mbn
[INFO] rawprogram files: ['../qcom8937_spf1.0_1605052340_qpst/rawprogram0.xml']
[INFO] patch files: ['../qcom8937_spf1.0_1605052340_qpst/patch0.xml']
[INFO] USB device 0x05c6:0x9008
[USB] waiting for device connecting...
Traceback (most recent call last):
File "./qfil.py", line 120, in
if cdc.connect():
File "/home/maik/Downloads/edl/Library/usblib.py", line 155, in connect
self.log.debug(self.configuration)
AttributeError: 'NoneType' object has no attribute 'debug'

error in "Library/firehose.py", line 497, in connect

try to change active bootable storage and get this error :
Traceback (most recent call last): File "./edl.py", line 1592, in <module> main() File "./edl.py", line 411, in main handle_firehose(args, cdc, sahara, verbose) File "./edl.py", line 1084, in handle_firehose supported_functions = fh.connect(0) File "/home/abdorahmanamani/workspace/Linux/Qcom/edl/edl-master/Library/firehose.py", line 497, in connect self.serial=int(serial.split(" ")[0]) ValueError: invalid literal for int() with base 10: 'Chip'
this is caused by firehose.py line 496 , which is this: serial=line.split(": ")[1]
and changing to this will solve the problem: serial=line.split(": ")[2]
pointing to 3th array cell which is decimal chip info

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.