Troubleshooting: Heimdall Fails at Initialising Protocol

This is about flashing a custom operating system ROM in a Samsung Android device using the tool named Heimdall.

We may encounter a failure mode in which heimdall detect succeeds but heimdall flash and heimdall print-pit both fail, printing this:

Initialising connection...
Detecting device...
Claiming interface...
Setting up interface...

Initialising protocol...
ERROR: Failed to send handshake!ERROR: Protocol initialisation failed!

Releasing device interface...

Additional diagnostics if we give the --verbose option:

"ERROR: libusb error -7 whilst sending bulk transfer"

(This message is repeated several times, before the final failure.)

Errors like this have been reported many times: e.g. here and duplicates, here, here

Here are two scenarios in which this error can occur.

Scenario 1: Only The First Heimdall (Flash, Print-Pit) Command Works

Some people report that some Samsung devices only accept one Heimdall command in the bootloader mode. Further attempts fail. Rebooting is required before another command can succeed.

This may be a bootloader limitation in certain devices. (I have not yet seen a report with enough detail to satisfy me it is definitely the case.) In other cases, using Heimdall's options “—no-reboot” (on each command) and “—resume” (on subsequent commands, since v1.4.0) may overcome this.

(In this description, “heimdall flash” and “heimdall print-pit” count towards the limit of one command, while “heimdall detect” doesn't count towards the limit and can be used freely.)

Scenario 2: Every Heimdall (Flash, Print-Pit) Command Fails

This happens only when running Heimdall on certain linux distributions, notably Ubuntu.

Some people fixed this in their forks of Heimdall, e.g. Jesse Chan's fix is in Grimler's version of Heimdall and in several other forks. (This fix works by resetting the USB device on the Linux end. The main work in developing the fix seems to be recorded in PR #478 .)

My suggestion: build and use Grimler's Heimdall. I explain a bit about Heimdall and how to build and use it in my article Odin and Heimdall: Free Your Samsung Android .

Scenario 3: Heimdall With Resume Option Fails First Time

If the first Heimdall command after booting into download mode is given the '—resume' option, Heimdall fails for me (on Ubuntu 22.04) like this, even when using a version with the Scenario 2 bug fixed:

$ heimdall print-pit --resume --no-reboot --verbose
...
Beginning session...
ERROR: libusb error -7 whilst sending bulk transfer. Retrying...
...
ERROR: Failed to begin session!
Releasing device interface...

From what I can tell, this seems to be expected, and so a usage error. The '—resume' option should not be used on the first command.


#fossGadgets #android #degoogled #lineageOS #eOS


Follow/Feedback/Contact: RSS feed · Fedi follow this blog: @julian​@wrily.foad.me.uk · use the Cactus Comments box above · matrix me · Fedi follow me · email me · julian.foad.me.uk Donate: via Liberapay All posts © Julian Foad and licensed CC-BY-ND except quotes, translations, or where stated otherwise