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

ERROR: Failed to receive file part response! #347

Open
danielebonadeo opened this issue Jun 19, 2016 · 17 comments
Open

ERROR: Failed to receive file part response! #347

danielebonadeo opened this issue Jun 19, 2016 · 17 comments

Comments

@danielebonadeo
Copy link

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...

`

@michaelcadilhac
Copy link

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

@iamantony
Copy link

iamantony commented Oct 31, 2016

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

@iamantony
Copy link

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);
}

@erikman
Copy link

erikman commented Dec 12, 2016

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

@eddydonk
Copy link

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)"

@vvvverre
Copy link

vvvverre commented Jul 5, 2017

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

changlinli added a commit to changlinli/Heimdall that referenced this issue Jul 19, 2017
@brauliobo
Copy link

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

@vitalif
Copy link

vitalif commented Aug 27, 2017

same with A510F, the hack also worked

@sleeplessCortes
Copy link

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?

@iamantony
Copy link

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

alexax66 added a commit to alexax66/Heimdall that referenced this issue Mar 31, 2021
It's more like a hack, but worked for SM-A310F
@iMonZ
Copy link

iMonZ commented Jul 20, 2021

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 :(

@LittleZombie1
Copy link

Hack worked with my A510F too

@sletuffe
Copy link

sletuffe commented Oct 14, 2021

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.

@smartass101
Copy link

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!

@nerdoc
Copy link

nerdoc commented Jun 4, 2022

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

@djelouze
Copy link

djelouze commented May 4, 2023

Didn't try the hack, but the solution from #347 (comment) worked for me, with a Samsun A510F

@Adelineenileda
Copy link

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

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

No branches or pull requests