Heimdall icon indicating copy to clipboard operation
Heimdall copied to clipboard

ERROR: Failed to receive file part response!

Open danielebonadeo opened this issue 8 years ago • 17 comments

I was trying to flash twrp recovery on my SM-A310F and this is what i always get `$ sudo heimdall flash --RECOVERY /Users/Daniele/Desktop/recovery.img --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... Claiming interface... 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.

Uploading RECOVERY 0% ERROR: Failed to receive file part response!

ERROR: Retrying... ERROR: Expected file part index: 0 Received: 1 ERROR: RECOVERY upload failed!

Ending session... ERROR: Failed to receive session end confirmation! Releasing device interface...

`

danielebonadeo avatar Jun 19 '16 19:06 danielebonadeo

I concur: A310F does not seem to work with Heimdall. I ended up with the very same error.

michaelcadilhac avatar Sep 01 '16 07:09 michaelcadilhac

I faced the same problem with my A310F (A310FXXU1AOL7) when tried to flash boot.img

iamantony avatar Oct 31 '16 14:10 iamantony

Finally I found solution to the problem. It's more like a hack. Be careful. You have been warned!

I noticed that we get error when trying to receive response from our device that it have received first file packet (BridgeManager.cpp, line 1115). It seems to me that device actually do not send response for the first file packet. If we skip this first response error, then file will be successfully sent to the device.

In BridgeManager.cpp replace code from line 1117 till 1153 by this code:

if (filePartIndex == 0)
{
    // Hack
    success = true;
    receivedPartIndex = filePartIndex;
}
else
{
    for (int retry = 0; retry < 4; ++retry)
    {
        Interface::PrintErrorSameLine("\n");
        Interface::PrintError("Retrying...");

        // Send
        sendFilePartPacket = new SendFilePartPacket(file, fileTransferPacketSize);
        success = SendPacket(sendFilePartPacket, kDefaultTimeoutSend, sendEmptyTransferFlags);
        delete sendFilePartPacket;

        if (!success)
        {
            Interface::PrintErrorSameLine("\n");
            Interface::PrintError("Failed to send file part packet 2!\n");
            return (false);
        }

        // Response
        sendFilePartResponse = new SendFilePartResponse();
        success = ReceivePacket(sendFilePartResponse);
        unsigned int receivedPartIndex = sendFilePartResponse->GetPartIndex();

        delete sendFilePartResponse;

        if (receivedPartIndex != filePartIndex)
        {
            Interface::PrintErrorSameLine("\n");
            Interface::PrintError("Expected file part index: %d Received: %d\n", filePartIndex, receivedPartIndex);
            return (false);
        }

        if (success)
            break;
    }

    if (!success)
        return (false);
}

iamantony avatar Nov 08 '16 12:11 iamantony

Thanks a lot! Made it possible for me to reflash a stock image on my A310F. :)

erikman avatar Dec 12 '16 21:12 erikman

Hello, i found a solution too. I had exactly the same problem, and even the code replacement didn't work. To succeed flash, i've just changed permission of the file(s) i would flash as executable for heimdall, with the command " chmod +x recovery.img (or anything else)"

eddydonk avatar Jun 19 '17 08:06 eddydonk

I came across this problem as well on my Galaxy A5 (2016), SM-A510F. @iamantony fix/hack worked for me.

vvvverre avatar Jul 05 '17 20:07 vvvverre

same error here with A520F/DS and A5Y17LTE_EUR_OPEN_HIDDEN100M.pit.zip

brauliobo avatar Aug 19 '17 19:08 brauliobo

same with A510F, the hack also worked

vitalif avatar Aug 27 '17 12:08 vitalif

where do I find the BridgeManager.cpp file on my ubuntu 16.04 system to open in editor for change??? could not find anywhere, or how do i perform this hack?

sleeplessCortes avatar Jan 24 '18 01:01 sleeplessCortes

@sleeplessCortes you should download source code from github, edit BridgeManager.cpp and compile Heimdall

iamantony avatar Jan 24 '18 07:01 iamantony

Finally I found solution to the problem. It's more like a hack. Be careful. You have been warned!

I noticed that we get error when trying to receive response from our device that it have received first file packet (BridgeManager.cpp, line 1115). It seems to me that device actually do not send response for the first file packet. If we skip this first response error, then file will be successfully sent to the device.

In BridgeManager.cpp replace code from line 1117 till 1153 by this code:

if (filePartIndex == 0)
{
    // Hack
    success = true;
    receivedPartIndex = filePartIndex;
}
else
{
    for (int retry = 0; retry < 4; ++retry)
    {
        Interface::PrintErrorSameLine("\n");
        Interface::PrintError("Retrying...");

        // Send
        sendFilePartPacket = new SendFilePartPacket(file, fileTransferPacketSize);
        success = SendPacket(sendFilePartPacket, kDefaultTimeoutSend, sendEmptyTransferFlags);
        delete sendFilePartPacket;

        if (!success)
        {
            Interface::PrintErrorSameLine("\n");
            Interface::PrintError("Failed to send file part packet 2!\n");
            return (false);
        }

        // Response
        sendFilePartResponse = new SendFilePartResponse();
        success = ReceivePacket(sendFilePartResponse);
        unsigned int receivedPartIndex = sendFilePartResponse->GetPartIndex();

        delete sendFilePartResponse;

        if (receivedPartIndex != filePartIndex)
        {
            Interface::PrintErrorSameLine("\n");
            Interface::PrintError("Expected file part index: %d Received: %d\n", filePartIndex, receivedPartIndex);
            return (false);
        }

        if (success)
            break;
    }

    if (!success)
        return (false);
}

I tried this and still the same issue :(

iMonZ avatar Jul 20 '21 10:07 iMonZ

Hack worked with my A510F too

LittleZombie1 avatar Aug 20 '21 07:08 LittleZombie1

I got a Samsung a5 (2016) A510F and heimdall was failling on all uploads with : "ERROR: Failed to receive file part response!" That hack worked for me.

sletuffe avatar Oct 14 '21 12:10 sletuffe

Just wanted to report that this hack also worked on a Samsung Galaxy S5 neo (SM-G903F). Standard Heimdall build indeed gave me the ERROR: Failed to receive file part response! message. The phone had stock firmware with Android 5.1.1 to begin with (in case it matters). The hack enabled me to upload the latest TWRP as well as the Android 6.0.1 stock ROM and afterwards a crDroid (Android 11) build flashed (via TWRP) cleanly. Due to my laziness I actually compiled the fork with the hack applied in https://github.com/alexax66/Heimdall, thanks @alexax66!

smartass101 avatar Apr 25 '22 06:04 smartass101

@Benjamin-Dobell Is it possible to include that in heimdall by default?

nerdoc avatar Jun 04 '22 09:06 nerdoc

Didn't try the hack, but the solution from https://github.com/Benjamin-Dobell/Heimdall/issues/347#issuecomment-309370130 worked for me, with a Samsun A510F

djelouze avatar May 04 '23 06:05 djelouze

I have the same error and the solution #347 don't work... I don't known how try the hack... A solution ?

Adelineenileda avatar Nov 07 '23 17:11 Adelineenileda