Compare commits

..

1 Commits

Author SHA1 Message Date
Henrik Grimler 714b75f1f6
BridgeManager: implement packet response hack by iamantony 2022-02-20 19:23:47 +01:00
6 changed files with 32 additions and 29 deletions

View File

@ -114,7 +114,7 @@
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:400; font-style:normal;"> </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Heimdall Frontend</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Heimdall Frontend</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 2.0.2</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 2.0.1</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright © 2010-2017 Benjamin Dobell, Glass Echidna</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright © 2010-2017 Benjamin Dobell, Glass Echidna</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Heimdall (command line)</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Heimdall (command line)</span></p>

View File

@ -1088,12 +1088,15 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
delete sendFilePartResponse; delete sendFilePartResponse;
if (!success) if (filePartIndex == 0)
{ {
Interface::PrintErrorSameLine("\n"); // Hack
Interface::PrintError("Failed to receive file part response!\n"); success = true;
receivedPartIndex = filePartIndex;
for (int retry = 0; retry < 4; retry++) }
else
{
for (int retry = 0; retry < 4; ++retry)
{ {
Interface::PrintErrorSameLine("\n"); Interface::PrintErrorSameLine("\n");
Interface::PrintError("Retrying..."); Interface::PrintError("Retrying...");
@ -1106,7 +1109,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
if (!success) if (!success)
{ {
Interface::PrintErrorSameLine("\n"); Interface::PrintErrorSameLine("\n");
Interface::PrintError("Failed to send file part packet!\n"); Interface::PrintError("Failed to send file part packet 2!\n");
return (false); return (false);
} }

View File

@ -116,16 +116,16 @@ static bool openFiles(Arguments& arguments, vector<PartitionFile>& partitionFile
{ {
const StringArgument *stringArgument = static_cast<const StringArgument *>(*it); const StringArgument *stringArgument = static_cast<const StringArgument *>(*it);
FILE *file = FileOpen(stringArgument->GetValue().c_str(), "rb"); FILE *file = FileOpen(stringArgument->GetValue().c_str(), "rb");
FileSeek(file, 0, SEEK_END);
unsigned long fileSize = (unsigned long)FileTell(file);
FileRewind(file);
if (!file) if (!file)
{ {
Interface::PrintError("Failed to open file \"%s\"\n", stringArgument->GetValue().c_str()); Interface::PrintError("Failed to open file \"%s\"\n", stringArgument->GetValue().c_str());
return (false); return (false);
} }
FileSeek(file, 0, SEEK_END);
unsigned long fileSize = (unsigned long)FileTell(file);
FileRewind(file);
partitionFiles.push_back(PartitionFile(argumentName.c_str(), file, fileSize)); partitionFiles.push_back(PartitionFile(argumentName.c_str(), file, fileSize));
} }
} }
@ -303,11 +303,11 @@ static bool flashPartitions(BridgeManager *bridgeManager, const vector<Partition
{ {
const PitEntry *part = pitData->FindEntry(it->argumentName); const PitEntry *part = pitData->FindEntry(it->argumentName);
if (part->GetDeviceType() != PitEntry::kDeviceTypeMMC && if (part->GetDeviceType() != PitEntry::kDeviceTypeMMC &&
part->GetDeviceType() != PitEntry::kDeviceTypeUFS) part->GetDeviceType() != PitEntry::kDeviceTypeMMC4096)
continue; continue;
unsigned long partitionSize = part->GetBlockCount(); unsigned long partitionSize = part->GetBlockCount();
unsigned int blockSize = 512; unsigned int blockSize = 512;
if (part->GetDeviceType() == PitEntry::kDeviceTypeUFS) if (part->GetDeviceType() == PitEntry::kDeviceTypeMMC4096)
blockSize = 4096; blockSize = 4096;
if (partitionSize > 0 && it->fileSize > partitionSize*blockSize) if (partitionSize > 0 && it->fileSize > partitionSize*blockSize)
{ {

View File

@ -42,7 +42,7 @@ using namespace Heimdall;
map<string, Interface::ActionInfo> actionMap; map<string, Interface::ActionInfo> actionMap;
bool stdoutErrors = false; bool stdoutErrors = false;
const char *version = "v2.0.2"; const char *version = "v2.0.1";
const char *actionUsage = "Usage: heimdall <action> <action arguments>\n"; const char *actionUsage = "Usage: heimdall <action> <action arguments>\n";
const char *releaseInfo = "Heimdall %s\n\n\ const char *releaseInfo = "Heimdall %s\n\n\
@ -211,7 +211,7 @@ void Interface::PrintPit(const PitData *pitData)
Interface::Print("Entry Count: %d\n", pitData->GetEntryCount()); Interface::Print("Entry Count: %d\n", pitData->GetEntryCount());
Interface::Print("Unknown string: %s\n", pitData->GetComTar2()); Interface::Print("Unknown string: %s\n", pitData->GetComTar2());
Interface::Print("CPU/bootloader tag: %s\n", pitData->GetCpuBlId()); Interface::Print("CPU/bootloader tag: %s\n", pitData->GetCpuBlId());
Interface::Print("Logic unit count: %d\n", pitData->GetLUCount()); Interface::Print("Protocol version: 0x%04x\n", pitData->GetProtocolVersion());
for (unsigned int i = 0; i < pitData->GetEntryCount(); i++) for (unsigned int i = 0; i < pitData->GetEntryCount(); i++)
{ {
@ -257,8 +257,8 @@ void Interface::PrintPit(const PitData *pitData)
Interface::Print("All (?)"); Interface::Print("All (?)");
break; break;
case PitEntry::kDeviceTypeUFS: case PitEntry::kDeviceTypeMMC4096:
Interface::Print("UFS"); Interface::Print("MMC 4096");
break; break;
default: default:

View File

@ -69,7 +69,7 @@ PitData::PitData()
com_tar2[0] = '\0'; com_tar2[0] = '\0';
cpu_bl_id[0] = '\0'; cpu_bl_id[0] = '\0';
luCount = 0; protocol_version = 0;
} }
PitData::~PitData() PitData::~PitData()
@ -98,7 +98,7 @@ bool PitData::Unpack(const unsigned char *data)
return (false); return (false);
cpu_bl_id[8]='\0'; cpu_bl_id[8]='\0';
luCount = PitData::UnpackShort(data, 24); protocol_version = PitData::UnpackShort(data, 24);
unsigned int integerValue; unsigned int integerValue;
unsigned int entryOffset; unsigned int entryOffset;
@ -153,7 +153,7 @@ void PitData::Pack(unsigned char *data) const
memcpy(&data[8], com_tar2, 8); memcpy(&data[8], com_tar2, 8);
memcpy(&data[16], cpu_bl_id, 8); memcpy(&data[16], cpu_bl_id, 8);
PitData::PackShort(data, 24, luCount); PitData::PackShort(data, 24, protocol_version);
int entryOffset; int entryOffset;
@ -187,7 +187,7 @@ bool PitData::Matches(const PitData *otherPitData) const
if (entryCount == otherPitData->entryCount && if (entryCount == otherPitData->entryCount &&
(strncmp(com_tar2, otherPitData->com_tar2, 8) == 0) && (strncmp(com_tar2, otherPitData->com_tar2, 8) == 0) &&
(strncmp(cpu_bl_id, otherPitData->cpu_bl_id, 8) == 0) && (strncmp(cpu_bl_id, otherPitData->cpu_bl_id, 8) == 0) &&
luCount == otherPitData->luCount) protocol_version == otherPitData->protocol_version)
{ {
for (unsigned int i = 0; i < entryCount; i++) for (unsigned int i = 0; i < entryCount; i++)
{ {
@ -211,7 +211,7 @@ void PitData::Clear(void)
cpu_bl_id[0] = '\0'; cpu_bl_id[0] = '\0';
luCount = 0; protocol_version = 0;
for (unsigned int i = 0; i < entries.size(); i++) for (unsigned int i = 0; i < entries.size(); i++)
delete entries[i]; delete entries[i];

View File

@ -62,7 +62,7 @@ namespace libpit
kDeviceTypeFile, // FAT kDeviceTypeFile, // FAT
kDeviceTypeMMC, kDeviceTypeMMC,
kDeviceTypeAll, // ? kDeviceTypeAll, // ?
kDeviceTypeUFS = 8 kDeviceTypeMMC4096 = 8 // block size 4096
}; };
enum enum
@ -266,7 +266,7 @@ namespace libpit
char cpu_bl_id[8+1]; // 0x10 char cpu_bl_id[8+1]; // 0x10
unsigned short luCount; // 0x18 unsigned short protocol_version; // 0x18
// Entries start at 0x1C // Entries start at 0x1C
std::vector<PitEntry *> entries; std::vector<PitEntry *> entries;
@ -375,9 +375,9 @@ namespace libpit
return cpu_bl_id; return cpu_bl_id;
} }
unsigned int GetLUCount(void) const unsigned int GetProtocolVersion(void) const
{ {
return luCount; return protocol_version;
} }
}; };
} }