Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gs5 fixes for Pit + flash #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sshimko
Copy link

@sshimko sshimko commented Sep 3, 2014

There are problems on the GS5 when sending empty bulk transfers during Pit file packet requests.This put the entire session into a wonky state. Request none be sent for these packets.

@sshimko
Copy link
Author

sshimko commented Sep 3, 2014

BTW a quick look at the Issues list and this might fix #203 #209 etc.

@sshimko sshimko changed the title Gs5 Gs5 fixes for Pit + flash Sep 3, 2014
@jehoffmann
Copy link

Quick tested on the SM-G900F (S5 klte) the print-pit and flash commands. Both are working now using your patchset.

@Benjamin-Dobell
Copy link
Owner

@sshimko Thanks for the patch! I've been meaning to look into this and was hoping to do so this week-end. So it looks like you've saved me some of the work.

However, I can't go ahead and merge this patch in its current state as you've commented out some code and also made some superfluous (and slightly incorrect) changes to the error messages. The patch is still very helpful though.

Which of the following would you prefer:

  1. After I've performed the necessary testing, me let you know what changes are necessary so you can modify your patch and then I'll merge it.
  2. Me simply do whatever needs to be done myself.

No. 2 is more straight-forward for me, but it means you wouldn't get your name in the commit history - your call.

Default parameter values in SendPacket and ReceivePacket
were leading to confusion in the ReceivePit function.
Empty transfer flags were passed in as timeouts.

Additionally, on the GS5, empty transfers
aren't required around the send ack packets
during Pit retrieval, and actually screw up
the state breaking the remainder of
the session.
@sshimko
Copy link
Author

sshimko commented Sep 5, 2014

@Benjamin-Dobell I pushed an update that drops two of the commits and contains just the functional fixes. I should have split out the comment and err message changes etc after I referenced specific issue numbers. I do think some are useful but I'll do a another pull request so those can be discussed there. I'd prefer option 1 BTW :)

@Benjamin-Dobell
Copy link
Owner

@sshimko Thanks for that. I'll have to do some testing on some of the older devices I have access to; but otherwise I'm happy with how the patch looks and I'll gladly merge it.

@utkanos
Copy link

utkanos commented Sep 6, 2014

thank you for submitting this patch @sshimko, will merge and test

@Benjamin-Dobell
Copy link
Owner

@sshimko I've tested this across all the devices I have access to. It does not cause problems for older devices but breaks support for the SM-N900 (International Note 3).

Unfortunately I don't have an S5 at this point, which will make further investigation difficult. However, I'll see what I can come up with.

@sshimko
Copy link
Author

sshimko commented Sep 7, 2014

@Benjamin-Dobell I should have access to that Note 3 tomorrow and can also regression test against an S5. What firmware version? What operation were you performing? Anything interesting in the logs?

@utkanos
Copy link

utkanos commented Sep 8, 2014

@sshimko the hlte needs to have taken a 4.4 OTA from Samsung to be impacted best I can tell, firmware level depends on which hlte you have but any 4.4 firmware level should work to test with.

@sshimko
Copy link
Author

sshimko commented Sep 8, 2014

@utkanos @Benjamin-Dobell I just tested it on a N900V w/ 4.4.2 hlte firmware and it is working for me. Any other info llike logs would be greatly appreciated.

@phillipberndt
Copy link

FYI, I can flash firmware to my G900F with this patch, but still get lots of

 WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

warnings.

(Thanks a lot for this - I've had my smartphone softbricked and had no Windows PC around..)

@promovicz
Copy link

This patch worked for me on an SM-G900F with no apparent problems.

@ejegg
Copy link

ejegg commented Sep 25, 2014

Another vote for merging this patch - couldn't flash my G900A without it, worked like a charm after pulling this and recompiling.

@promovicz
Copy link

While this patch works for me on a SM-G900F it seems to break PIT download
on the SM-G900H (which is the 3G version with an Exynos5, so pretty different).

Note that heimdall from master works for me on this device.

Here is the log:

prom@horsey:~$ sudo heimdall print-pit
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
ERROR: Failed to receive PIT file part #0!
ERROR: Failed to download PIT file!
Ending session...
ERROR: Failed to receive session end confirmation!
Releasing device interface...
Re-attaching kernel driver...

@AbandonedCart
Copy link

This fixes functionality on the trltetmo (T-Mobile Note 4) without the need for the CM instructions to disable a bunch of USB interfaces (which is a terrible idea)

@sshimko
Copy link
Author

sshimko commented Oct 20, 2014

Off topic:

Cool my VZW Note 4 should be here in the next few days :)

@jaymzh
Copy link

jaymzh commented Nov 22, 2014

I tried this patch after seeing it referenced in #241 and this is what I get with this patch:

[phil@rider ~]$ sudo /usr/local/bin/heimdall print-pit --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
      Manufacturer: "Sasmsung"
           Product: "MSM8960"

            length: 18
      device class: 2
               S/N: 0
           VID:PID: 04E8:685D
         bcdDevice: 0100
   iMan:iProd:iSer: 1:2:0
          nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 02.02.01
       endpoint[0].address: 82
           max packet size: 0010
          polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
   Class.SubClass.Protocol: 0A.00.00
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 00
       endpoint[1].address: 01
           max packet size: 0200
          polling interval: 00
Claiming interface...
ERROR: Claiming interface failed!

Same for a flash attempt.

@AbandonedCart
Copy link

The first error you posted in #241 appears to be before this patch, and this one that is posted both here and in #241 appears to be the phone not being detected as connected in bootloader mode. Did you make sure to put the phone into bootloader mode THEN connect it to USB and attempt to flash? A common issue is having the phone connected before entering bootloader and the system considers the USB port occupied and doesn't flush the current driver to load the new one.

@jaymzh
Copy link

jaymzh commented Nov 22, 2014

Yup, lsusb showed:

Bus 005 Device 020: ID 04e8:685d Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II] (Download mode)

You can see it's in download mode there. And yes, it's an S5, not an S2. :) Verizon, if it matters.

FWIW, I merged this and #240 onto master since both seem to have fixes for this (the one line that conflicted I took from the other PR), and it still didn't work.

Also, in download mode it says that the produce name is SM-G900V, as expected.

@jaymzh
Copy link

jaymzh commented Nov 23, 2014

Also, I printed out the actual result from libusb_set_interface_alt_setting(), it's -5, which according to http://libusb.sourceforge.net/api-1.0/group__misc.html is LIBUSB_ERROR_NOT_FOUND = -5

But, interestingly if we don't setup the interface alt setting (I comment out that call), it gets much further:

[phil@rider ~]$ sudo /usr/local/bin/heimdall print-pit --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
      Manufacturer: "Sasmsung"
           Product: "MSM8960"

            length: 18
      device class: 2
               S/N: 0
           VID:PID: 04E8:685D
         bcdDevice: 0100
   iMan:iProd:iSer: 1:2:0
          nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 02.02.01
       endpoint[0].address: 82
           max packet size: 0010
          polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
   Class.SubClass.Protocol: 0A.00.00
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 00
       endpoint[1].address: 01
           max packet size: 0200
          polling interval: 00
Claiming interface...
Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
PIT file data received, read 'empty' packet...
PIT file data receive completed, send kRequestEndTransfer...
PIT file download successful.

Entry Count: 30
Unknown 1: 1598902083
Unknown 2: 844251476
Unknown 3: 21325
Unknown 4: 14413
Unknown 5: 14137
Unknown 6: 52
Unknown 7: 0
Unknown 8: 0


--- Entry #0 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 1
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 8192
Partition Block Count: 30720
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: APNHLOS
Flash Filename: NON-HLOS.bin
FOTA Filename: 


--- Entry #1 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 2
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 38912
Partition Block Count: 117632
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEM
Flash Filename: modem.bin
FOTA Filename: 


--- Entry #2 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 3
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 156544
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SBL1
Flash Filename: sbl1.mbn
FOTA Filename: 


--- Entry #3 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 4
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157568
Partition Block Count: 128
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: DBI
Flash Filename: sdi.mbn
FOTA Filename: 


--- Entry #4 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 5
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157696
Partition Block Count: 64
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: DDR
Flash Filename: 
FOTA Filename: 


--- Entry #5 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 6
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157760
Partition Block Count: 4096
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: ABOOT
Flash Filename: aboot.mbn
FOTA Filename: 


--- Entry #6 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 7
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 161856
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: RPM
Flash Filename: rpm.mbn
FOTA Filename: 


--- Entry #7 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 8
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 162880
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: TZ
Flash Filename: tz.mbn
FOTA Filename: 


--- Entry #8 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 9
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 163904
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FSG
Flash Filename: 
FOTA Filename: 


--- Entry #9 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 10
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 170048
Partition Block Count: 14272
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PAD
Flash Filename: 
FOTA Filename: 


--- Entry #10 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 11
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 184320
Partition Block Count: 20480
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PARAM
Flash Filename: param.bin
FOTA Filename: 


--- Entry #11 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 12
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 204800
Partition Block Count: 28672
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: EFS
Flash Filename: efs.img.ext4
FOTA Filename: 


--- Entry #12 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 13
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 233472
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEMST1
Flash Filename: nvrebuild1.bin
FOTA Filename: 


--- Entry #13 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 14
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 239616
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEMST2
Flash Filename: nvrebuild2.bin
FOTA Filename: 


--- Entry #14 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 15
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 245760
Partition Block Count: 26624
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: BOOT
Flash Filename: boot.img
FOTA Filename: 


--- Entry #15 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 16
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 272384
Partition Block Count: 30720
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: RECOVERY
Flash Filename: recovery.img
FOTA Filename: 


--- Entry #16 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 17
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 303104
Partition Block Count: 26624
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FOTA
Flash Filename: 
FOTA Filename: 


--- Entry #17 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 18
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 329728
Partition Block Count: 14318
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: BACKUP
Flash Filename: 
FOTA Filename: 


--- Entry #18 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 19
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 344046
Partition Block Count: 2
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FSC
Flash Filename: 
FOTA Filename: 


--- Entry #19 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 20
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 344048
Partition Block Count: 16
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SSD
Flash Filename: 
FOTA Filename: 


--- Entry #20 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 21
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 344064
Partition Block Count: 16384
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PERSIST
Flash Filename: persist.img.ext4
FOTA Filename: 


--- Entry #21 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 22
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 360448
Partition Block Count: 18432
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PERSDATA
Flash Filename: persdata.img.ext4
FOTA Filename: 


--- Entry #22 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 23
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 378880
Partition Block Count: 6144000
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SYSTEM
Flash Filename: system.img.ext4
FOTA Filename: 


--- Entry #23 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 24
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 6522880
Partition Block Count: 2097152
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: CACHE
Flash Filename: cache.img.ext4
FOTA Filename: 


--- Entry #24 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 25
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 8620032
Partition Block Count: 20480
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: CARRIER
Flash Filename: carrier.img.ext4
FOTA Filename: 


--- Entry #25 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 26
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 8640512
Partition Block Count: 0
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: USERDATA
Flash Filename: userdata.img.ext4
FOTA Filename: remained


--- Entry #26 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 70
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 0
Partition Block Count: 34
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PGPT
Flash Filename: pgpt.img
FOTA Filename: 


--- Entry #27 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 71
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 34
Partition Block Count: 16
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PIT
Flash Filename: MSM8974.pit
FOTA Filename: 


--- Entry #28 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 72
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 50
Partition Block Count: 32
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MD5
Flash Filename: md5.img
FOTA Filename: 


--- Entry #29 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 73
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 30777311
Partition Block Count: 33
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SGPT
Flash Filename: sgpt.img
FOTA Filename: 

Ending session...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...

Releasing device interface...

@jaymzh
Copy link

jaymzh commented Nov 23, 2014

But I can't flash using that, I get:

Claiming interface...
Initialising protocol...
ERROR: Failed to receive handshake response. Result: -7
ERROR: Protocol initialisation failed!

Releasing device interface...

@AbandonedCart
Copy link

Even with this patch, I could not flash twice back to back. I did not use the other patch you referenced, though. I'm not sure if my setup will help since it is a Mac and a Note 4, neither of which match up to yours.

@jaymzh
Copy link

jaymzh commented Nov 27, 2014

I seem to have having slightly different problems. I'll open up a separate issue.

@jaymzh
Copy link

jaymzh commented Nov 27, 2014

Actually, trying a different machine let me get past the other issues I was seeing and now I got the issue described by here and I get the WARNING: Empty bulk transfer after sending packet failed. Continuing anyway... - so thanks :)

@benwaffle
Copy link

I've resorted to adb push and adb shell + dd in recovery

@locomanolo
Copy link

I tried the patch and it worked with download-pit and print-pit, BUT i have to disconnect the USB-cable afterwards and reconnect.

Device:
Note 10.1 LTE, SM-P605, P605XXUCNJ1
lsusb:
Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II] (Download mode)
On:
x86_64 GNU/Linux

@sshimko
Copy link
Author

sshimko commented Jan 7, 2015

@locomanolo disconnect and reconnect at which point in the process?

@locomanolo
Copy link

@sshimko Every time i did a download-pit or print-pit. But now i guess, it's because i didn't set the --resume flag. So i tested with --resume flag and replugging didn't help. Just look at the log for more details.

And again, just to clarify. My guessing about the --resume flag was wrong, but lead me to another error. I can download-pit or print-pit with the command 'sudo heimdall download-pit --output pit --no-reboot --verbose', if i disconnect and then connect the USB-cable after each command. But replugging the cable doesn't work with the command ''sudo heimdall download-pit --output pit --no-reboot --verbose --resume'. Therefore, i think it has to do with the initialisation of the USB-connection.

Log:

heimdall detect
Device detected

sudo heimdall download-pit --output p605.pit --no-reboot
[sudo] password for xxx:
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
PIT file download successful.

Ending session...
Releasing device interface...
Re-attaching kernel driver...

sudo heimdall print-pit --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Setting up interface...

Initialising protocol...
ERROR: Failed to receive handshake response. Result: -7
ERROR: Protocol initialisation failed!

Releasing device interface...

########################
NOW REPLUGGING OF USB
########################

sudo heimdall print-pit --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

Some devices may take up to 2 minutes to respond.
Please be patient!

WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Session begun.

Downloading device's PIT file...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
PIT file download successful.

Entry Count: 30
Unknown 1: 1598902083
Unknown 2: 844251476
Unknown 3: 21325
Unknown 4: 14413
Unknown 5: 14137
Unknown 6: 52
Unknown 7: 0
Unknown 8: 0

--- Entry #0 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 1
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 8192
Partition Block Count: 30720
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: APNHLOS
Flash Filename: NON-HLOS.bin
FOTA Filename:

--- Entry #1 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 2
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 38912
Partition Block Count: 117632
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEM
Flash Filename: modem.bin
FOTA Filename:

--- Entry #2 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 3
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 156544
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SBL1
Flash Filename: sbl1.mbn
FOTA Filename:

--- Entry #3 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 4
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157568
Partition Block Count: 64
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: DBI
Flash Filename: sdi.mbn
FOTA Filename:

--- Entry #4 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 5
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157632
Partition Block Count: 64
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: DDR
Flash Filename:
FOTA Filename:

--- Entry #5 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 6
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 157696
Partition Block Count: 4096
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: ABOOT
Flash Filename: aboot.mbn
FOTA Filename:

--- Entry #6 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 7
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 161792
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: RPM
Flash Filename: rpm.mbn
FOTA Filename:

--- Entry #7 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 8
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 162816
Partition Block Count: 1024
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: TZ
Flash Filename: tz.mbn
FOTA Filename:

--- Entry #8 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 9
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 163840
Partition Block Count: 20480
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PAD
Flash Filename:
FOTA Filename:

--- Entry #9 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 10
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 184320
Partition Block Count: 20480
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PARAM
Flash Filename: param.bin
FOTA Filename:

--- Entry #10 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 11
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 204800
Partition Block Count: 28672
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: EFS
Flash Filename: efs.img.ext4
FOTA Filename:

--- Entry #11 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 12
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 233472
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEMST1
Flash Filename: nvrebuild1.bin
FOTA Filename:

--- Entry #12 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 13
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 239616
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MODEMST2
Flash Filename: nvrebuild2.bin
FOTA Filename:

--- Entry #13 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 14
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 245760
Partition Block Count: 22528
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: BOOT
Flash Filename: boot.img
FOTA Filename:

--- Entry #14 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 15
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 268288
Partition Block Count: 26624
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: RECOVERY
Flash Filename: recovery.img
FOTA Filename:

--- Entry #15 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 16
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 294912
Partition Block Count: 26624
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FOTA
Flash Filename:
FOTA Filename:

--- Entry #16 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 17
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 321536
Partition Block Count: 14318
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: BACKUP
Flash Filename:
FOTA Filename:

--- Entry #17 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 18
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 335854
Partition Block Count: 6144
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FSG
Flash Filename:
FOTA Filename:

--- Entry #18 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 19
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 341998
Partition Block Count: 2
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: FSC
Flash Filename:
FOTA Filename:

--- Entry #19 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 20
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 342000
Partition Block Count: 16
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SSD
Flash Filename:
FOTA Filename:

--- Entry #20 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 21
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 342016
Partition Block Count: 16384
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PERSIST
Flash Filename: persist.img.ext4
FOTA Filename:

--- Entry #21 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 22
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 358400
Partition Block Count: 18432
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PERSDATA
Flash Filename: persdata.img.ext4
FOTA Filename:

--- Entry #22 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 23
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 376832
Partition Block Count: 4894720
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SYSTEM
Flash Filename: system.img.ext4
FOTA Filename:

--- Entry #23 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 24
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 5271552
Partition Block Count: 409600
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: CACHE
Flash Filename: cache.img.ext4
FOTA Filename:

--- Entry #24 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 25
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 5681152
Partition Block Count: 40960
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: HIDDEN
Flash Filename: hidden.img.ext4
FOTA Filename:

--- Entry #25 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 26
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 5722112
Partition Block Count: 0
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: USERDATA
Flash Filename: userdata.img.ext4
FOTA Filename: remained

--- Entry #26 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 70
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 0
Partition Block Count: 34
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PGPT
Flash Filename: pgpt.img
FOTA Filename:

--- Entry #27 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 71
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 34
Partition Block Count: 16
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: PIT
Flash Filename: MSM8974.pit
FOTA Filename:

--- Entry #28 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 72
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 50
Partition Block Count: 32
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: MD5
Flash Filename: md5.img
FOTA Filename:

--- Entry #29 ---
Binary Type: 0 (AP)
Device Type: 2 (MMC)
Identifier: 73
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 30777311
Partition Block Count: 33
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: SGPT
Flash Filename: sgpt.img
FOTA Filename:

Ending session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Releasing device interface...
Re-attaching kernel driver...

############
REPLUGGING
############

sudo heimdall print-pit --no-reboot --verbose --resume
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Beginning session...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer.
Releasing device interface...
Re-attaching kernel driver...

############
REPLUGGING
############

sudo heimdall download-pit --output p605-2 --no-reboot --verbose --resume
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Beginning session...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer.
Releasing device interface...
Re-attaching kernel driver...

############
USB left inside
############

sudo heimdall download-pit --output p605-2 --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Setting up interface...

Initialising protocol...
ERROR: Failed to receive handshake response. Result: -7
ERROR: Protocol initialisation failed!

Releasing device interface...

############
REPLUGGING
############

sudo heimdall download-pit --output p605-2 --no-reboot --verbose
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Manufacturer: "Sasmsung"
Product: "MSM8960"

        length: 18
  device class: 2
           S/N: 0
       VID:PID: 04E8:685D
     bcdDevice: 0100

iMan:iProd:iSer: 1:2:0
nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
Class.SubClass.Protocol: 02.02.01
endpoint[0].address: 82
max packet size: 0010
polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
Class.SubClass.Protocol: 0A.00.00
endpoint[0].address: 81
max packet size: 0200
polling interval: 00
endpoint[1].address: 01
max packet size: 0200
polling interval: 00
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

Some devices may take up to 2 minutes to respond.
Please be patient!

WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Session begun.

Downloading device's PIT file...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
PIT file download successful.

Ending session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Releasing device interface...
Re-attaching kernel driver...

@moneill-mw
Copy link

I was also having the "Empty bulk transfer" problems with the SM-G900F using the 1.4.1. I built the master branch (at d0526a3) and was able to flash on the recovery without issues. (Running on Fedora 21)

@thomacoo
Copy link

thomacoo commented Apr 6, 2015

Is there a EASY answer to how you fix this:
Downloading device's PIT file...
ERROR: Failed to send request to end PIT file transfer!
ERROR: Failed to download PIT file!
Ending session...
ERROR: Failed to send end session packet!
Releasing device interface...

@ElBaDo
Copy link

ElBaDo commented Jun 15, 2015

Is the fix integreated in the version 1.4.0 ?

This version end with the same error (SM-G900F, Vodafone-branding):

"...
Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
ERROR: Failed to receive PIT file part #0!
ERROR: Failed to download PIT file!
Ending session...
ERROR: Failed to receive session end confirmation!

..."

Or the software must be manually edited with the fix? But how?
Please help me get out of the data-clutches of Google.

@wlritchi
Copy link

I'll just add that with a Galaxy S5 Canadian version (SM-G900W8), sshimko's patch fixed this issue for me.

@Qwertie-
Copy link

Is this ever getting pulled?

@Benjamin-Dobell
Copy link
Owner

@Qwertie- As is, no. Because I've confirmed this change breaks support for other devices - further investigation is needed. However, so that other people can benefit, I leave pull requests open until I can come up with a better solution - right now I don't have a better solution.

@Qwertie-
Copy link

Qwertie- commented Aug 2, 2015

@Benjamin-Dobell I built the latest version and it works on my SGS 5 but the binary on the website does not with the error

Downloading device's PIT file...
ERROR: Failed to send request to end PIT file transfer!
ERROR: Failed to download PIT file!
Ending session...
ERROR: Failed to send end session packet!
Releasing device interface...
Re-attaching kernel driver...

@kynan
Copy link

kynan commented Dec 22, 2015

@jaymzh @benwaffle Your ERROR: Protocol initialisation failed! might be the same issue as #228. Try my fix with the udev rule.

@shellscape
Copy link

@sshimko @Benjamin-Dobell S5 users on OSX are hosed without getting something into the latest version of heimdall from this fix fork. libusbx which is required to build the fork that contains the fix, is no longer available on homebrew, and the fork and master have diverged significantly in how they're built (as far as I can tell, I'm no pro with this stuff. a lowly S5 owner desperately trying to update his modem firmware)

@Benjamin-Dobell
Copy link
Owner

@shellscape Unfortunately I can't merge this (as is) due to it breaking support for SM-N900, and possibly other devices I don't own. However, you have two options:

  1. libusbx actually was merged back into (or rather became) the official libusb-1.0. So you can just grab that from Homebrew and should still be able to build the fork.
  2. Just checkout the latest Heimdall source and apply a single line code change:

At line 929 of BridgeManager.cpp (https://github.com/Benjamin-Dobell/Heimdall/blob/master/heimdall/source/BridgeManager.cpp#L929):

-       success = SendPacket(requestPacket);
+       success = SendPacket(requestPacket, kDefaultTimeoutSend, kEmptyTransferNone);

Ideally we could detect SGS5 and just toggle between these two behaviours at run-time. However, some SGS5 definitely do work - as I have a GM-G900I that works flawlessly. I suspect this behaviour changes between secondary bootloader versions - so knowing the device model may not be enough to differentiate.

@shellscape
Copy link

@Benjamin-Dobell awesome info, thanks much for taking the time to post that. I'll give that a shot in the next day or so. I'm running a very old KitKat bootloader, and I've suspected that my problems getting it updated are related to it's age.

@shellscape
Copy link

Doesn't look like that worked, unfortunately. I made the suggested change and built the source, and using that binary I attempted to flash - which appeared to work successfully. However, I checked after boot and despite there being no error messages, no changes were made. I attempted to download the pit file from my SM-G900T and this is what I got:

computer: ~/Heimdall/build/bin                                                                                +[git:master]
→ sudo ./heimdall download-pit --output G900T.pit --verbose --no-reboot
Heimdall v1.4.1

Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
      Manufacturer: "Sasmsung"
           Product: "MSM8960"

            length: 18
      device class: 2
               S/N: 0
           VID:PID: 04E8:685D
         bcdDevice: 0100
   iMan:iProd:iSer: 1:2:0
          nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 02.02.01
       endpoint[0].address: 82
           max packet size: 0010
          polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
   Class.SubClass.Protocol: 0A.00.00
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 00
       endpoint[1].address: 01
           max packet size: 0200
          polling interval: 00
Claiming interface...
Setting up interface...

Initialising protocol...
ERROR: Failed to receive handshake response. Result: -7
ERROR: Protocol initialisation failed!

Releasing device interface...

@Benjamin-Dobell
Copy link
Owner

Heimdall v1.4.0

It looks like you're still running the old binary. If you're running the latest code from this repo it will say v1.4.1.

@shellscape
Copy link

You're too fast :) I copied an older log I had generated by mistake. I updated the output in the previous comment that was generated from using the built binary.

@Benjamin-Dobell
Copy link
Owner

Hmm, it's failing very early on - this patch modifies functionality during PIT dumping, but you're not even able to connect. I suggest opening or commenting on another issue. However, in my experience if it fails that early on it usually means you've failed to communicate with the device once (say using the old binary), and then haven't rebooted the device (back into download mode) before trying again. Please ensure you've freshly rebooted into download mode before running Heimdall.

The same error can also occur due to a slightly dodgy USB port or cable, in download mode the devices seem to be particularly fragile and fail with ports and cables that work fine with other devices. So it's worth trying another port as well.

@shellscape
Copy link

You were indeed correct on the reboot suggestion. I hadn't realized, noob mistake there, so apologies are due. I attempted a PIT download (after rebooting into download) and this is the output:

→ ./heimdall download-pit --output G900T.pit --verbose
Heimdall v1.4.1

<snip>

Initialising connection...
Detecting device...
      Manufacturer: "Sasmsung"
           Product: "MSM8960"

            length: 18
      device class: 2
               S/N: 0
           VID:PID: 04E8:685D
         bcdDevice: 0100
   iMan:iProd:iSer: 1:2:0
          nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 02.02.01
       endpoint[0].address: 82
           max packet size: 0010
          polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
   Class.SubClass.Protocol: 0A.00.00
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 00
       endpoint[1].address: 01
           max packet size: 0200
          polling interval: 00
Claiming interface...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

Some devices may take up to 2 minutes to respond.
Please be patient!

ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer. Retrying...
ERROR: libusb error -7 whilst receiving bulk transfer.
Releasing device interface...

The resulting G900T.pit file is 0 bytes.

@Benjamin-Dobell
Copy link
Owner

Unfortunately, I'm not sure; without the device on hand it's really difficult for me to resolve these types of issues. I only have access to a G900I, and it actually works without this patch applied. If you haven't already done so, then I would suggest undoing the change you made to BridgeManager.cpp and recompiling.

@shellscape
Copy link

@Benjamin-Dobell thanks for the help none the less. I recloned the repo and rebuilt, but I'm still getting the the ERROR: libusb error -7 whilst receiving bulk transfer. Retrying... errors. The good news is that with the binary built from the source, I no longer get the initialization error. It looks like the download for OSX on http://glassechidna.com.au/heimdall/ is still pointing at 1.4.0, which probably why I ran into that problem to begin with. thanks again.

@minhng99
Copy link

@sshimko thank you, it's work for me, not galaxy s5 but sc-02f which use android 5.0 bootloader

@taggart
Copy link

taggart commented Aug 13, 2016

Current git on 2016-08-12 built on Debian jessie worked for me on a Samsung S5 SM-G900T to RECOVER twrp-3.0.2.

@durka
Copy link

durka commented Aug 23, 2016

Just another report that this patch, applied on top of the v1.4.1 tag, plus the fix from #172 (comment), was enough for me to flash TWRP on my T-Mobile Galaxy S5 using Ubuntu 12.04.

@Toxantron
Copy link

I merged this with master, resolved the conflict and can confirm it fixes the issue for Note 2014 LTE. I created #373 to merge into master.

@peterius
Copy link

I'm getting "SECURE CHECK FAIL" on flashing, probably because my image is bad... and I tried adding the two other arguments to the ReceivePitFile SendPacket and I think it may have messed things up for my Galaxy J727U

@sanimalp
Copy link

sanimalp commented Apr 11, 2018

I just tried this commit on the GS5 G900T and was able to finally get a copy of the PIT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.