Permalink
Browse files

Renamed partitionType to chipIdentifier as partition type was incorrect.

  • Loading branch information...
Benjamin-Dobell committed Mar 29, 2012
1 parent 713af23 commit 907c942fd12ff204a387f5cc0a7f3de079186100
@@ -921,7 +921,7 @@ int BridgeManager::ReceivePitFile(unsigned char **pitBuffer) const
return (fileSize);
}
-bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int partitionType, unsigned int fileIdentifier) const
+bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int chipIdentifier, unsigned int fileIdentifier) const
{
if (destination != EndFileTransferPacket::kDestinationModem && destination != EndFileTransferPacket::kDestinationPhone)
{
@@ -1123,7 +1123,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
if (destination == EndFileTransferPacket::kDestinationPhone)
{
- EndPhoneFileTransferPacket *endPhoneFileTransferPacket = new EndPhoneFileTransferPacket(sequenceByteCount, 0, partitionType,
+ EndPhoneFileTransferPacket *endPhoneFileTransferPacket = new EndPhoneFileTransferPacket(sequenceByteCount, 0, chipIdentifier,
fileIdentifier, isLastSequence);
success = SendPacket(endPhoneFileTransferPacket, 3000);
@@ -1138,7 +1138,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
}
else // destination == EndFileTransferPacket::kDestinationModem
{
- EndModemFileTransferPacket *endModemFileTransferPacket = new EndModemFileTransferPacket(sequenceByteCount, 0, partitionType, isLastSequence);
+ EndModemFileTransferPacket *endModemFileTransferPacket = new EndModemFileTransferPacket(sequenceByteCount, 0, chipIdentifier, isLastSequence);
success = SendPacket(endModemFileTransferPacket, 3000);
delete endModemFileTransferPacket;
@@ -121,7 +121,7 @@ namespace Heimdall
bool SendPitFile(FILE *file) const;
int ReceivePitFile(unsigned char **pitBuffer) const;
- bool SendFile(FILE *file, unsigned int destination, unsigned int partitionType, unsigned int fileIdentifier = 0xFFFFFFFF) const;
+ bool SendFile(FILE *file, unsigned int destination, unsigned int chipIdentifier, unsigned int fileIdentifier = 0xFFFFFFFF) const;
bool ReceiveDump(unsigned int chipType, unsigned int chipId, FILE *file) const;
bool IsVerbose(void) const
@@ -45,20 +45,20 @@ namespace Heimdall
private:
- unsigned int destination; // Chip identifier perhaps
+ unsigned int destination; // PDA / Modem
unsigned int sequenceByteCount;
unsigned int unknown1;
- unsigned int partitionType;
+ unsigned int chipIdentifier;
protected:
- EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType)
+ EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier)
: FileTransferPacket(FileTransferPacket::kRequestEnd)
{
this->destination = destination;
this->sequenceByteCount = sequenceByteCount;
this->unknown1 = unknown1;
- this->partitionType = partitionType;
+ this->chipIdentifier = chipIdentifier;
}
public:
@@ -78,9 +78,9 @@ namespace Heimdall
return (unknown1);
}
- unsigned int GetPartitionType(void) const
+ unsigned int GetChipIdentifier(void) const
{
- return (partitionType);
+ return (chipIdentifier);
}
virtual void Pack(void)
@@ -90,7 +90,7 @@ namespace Heimdall
PackInteger(FileTransferPacket::kDataSize, destination);
PackInteger(FileTransferPacket::kDataSize + 4, sequenceByteCount);
PackInteger(FileTransferPacket::kDataSize + 8, unknown1);
- PackInteger(FileTransferPacket::kDataSize + 12, partitionType);
+ PackInteger(FileTransferPacket::kDataSize + 12, chipIdentifier);
}
};
}
@@ -34,8 +34,8 @@ namespace Heimdall
public:
- EndModemFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType, bool endOfFile)
- : EndFileTransferPacket(EndFileTransferPacket::kDestinationModem, sequenceByteCount, unknown1, partitionType)
+ EndModemFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier, bool endOfFile)
+ : EndFileTransferPacket(EndFileTransferPacket::kDestinationModem, sequenceByteCount, unknown1, chipIdentifier)
{
this->endOfFile = (endOfFile) ? 1 : 0;
}
@@ -57,9 +57,9 @@ namespace Heimdall
public:
- EndPhoneFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType,
+ EndPhoneFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier,
unsigned int fileIdentifier, bool endOfFile)
- : EndFileTransferPacket(EndFileTransferPacket::kDestinationPhone, sequenceByteCount, unknown1, partitionType)
+ : EndFileTransferPacket(EndFileTransferPacket::kDestinationPhone, sequenceByteCount, unknown1, chipIdentifier)
{
this->fileIdentifier = fileIdentifier;
this->endOfFile = (endOfFile) ? 1 : 0;
@@ -444,14 +444,9 @@ void Interface::PrintPit(const PitData *pitData)
Interface::Print("\n\n--- Entry #%d ---\n", i);
Interface::Print("Unused: %s\n", (entry->GetUnused()) ? "Yes" : "No");
- const char *partitionTypeText = "Unknown";
+ const char *chipIdentifierText = "Unknown";
- if (entry->GetPartitionType() == PitEntry::kPartitionTypeRfs)
- partitionTypeText = "RFS";
- else if (entry->GetPartitionType() == PitEntry::kPartitionTypeExt4)
- partitionTypeText = "EXT4";
-
- Interface::Print("Partition Type: %d (%s)\n", entry->GetPartitionType(), partitionTypeText);
+ Interface::Print("Chip Identifier: %d (%s)\n", entry->GetChipIdentifier());
Interface::Print("Partition Identifier: %d\n", entry->GetPartitionIdentifier());
View
@@ -71,13 +71,13 @@ vector<const char *> knownPartitionNames[kKnownPartitionCount];
struct PartitionInfo
{
- unsigned int partitionType;
+ unsigned int chipIdentifier;
string partitionName;
FILE *file;
- PartitionInfo(unsigned int partitionType, const char *partitionName, FILE *file)
+ PartitionInfo(unsigned int chipIdentifier, const char *partitionName, FILE *file)
{
- this->partitionType = partitionType;
+ this->chipIdentifier = chipIdentifier;
this->partitionName = partitionName;
this->file = file;
}
@@ -218,7 +218,7 @@ bool mapFilesToPartitions(const map<string, FILE *>& argumentFileMap, const PitD
if (!pitEntry && knownPartition == kKnownPartitionPit)
{
- // NOTE: We're assuming a PIT file always has partitionType zero.
+ // NOTE: We're assuming a PIT file always has chipIdentifier zero.
PartitionInfo partitionInfo(0, knownPartitionNames[kKnownPartitionPit][0], it->second);
partitionInfoMap.insert(pair<unsigned int, PartitionInfo>(0xFFFFFFFF, partitionInfo));
@@ -232,7 +232,7 @@ bool mapFilesToPartitions(const map<string, FILE *>& argumentFileMap, const PitD
return (false);
}
- PartitionInfo partitionInfo(pitEntry->GetPartitionType(), pitEntry->GetPartitionName(), it->second);
+ PartitionInfo partitionInfo(pitEntry->GetChipIdentifier(), pitEntry->GetPartitionName(), it->second);
partitionInfoMap.insert(pair<unsigned int, PartitionInfo>(pitEntry->GetPartitionIdentifier(), partitionInfo));
}
@@ -264,7 +264,7 @@ int downloadPitFile(BridgeManager *bridgeManager, unsigned char **pitBuffer)
return (devicePitFileSize);
}
-bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigned int partitionIndex, const char *partitionName, FILE *file)
+bool flashFile(BridgeManager *bridgeManager, unsigned int chipIdentifier, unsigned int partitionIndex, const char *partitionName, FILE *file)
{
// PIT files need to be handled differently, try determine if the partition we're flashing to is a PIT partition.
bool isPit = false;
@@ -313,7 +313,7 @@ bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigne
//if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, // <-- Kies method. WARNING: Doesn't work on Galaxy Tab!
// EndPhoneFileTransferPacket::kFileModem))
- if (bridgeManager->SendFile(file, EndModemFileTransferPacket::kDestinationModem, partitionType)) // <-- Odin method
+ if (bridgeManager->SendFile(file, EndModemFileTransferPacket::kDestinationModem, chipIdentifier)) // <-- Odin method
{
Interface::Print("%s upload successful\n", partitionName);
return (true);
@@ -329,7 +329,7 @@ bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigne
// We're uploading to a phone partition
Interface::Print("Uploading %s\n", partitionName);
- if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, partitionType, partitionIndex))
+ if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, chipIdentifier, partitionIndex))
{
Interface::Print("%s upload successful\n", partitionName);
return (true);
@@ -474,7 +474,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile
{
PartitionInfo *partitionInfo = &(it->second);
- if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
+ if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
return (false);
break;
@@ -489,7 +489,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile
{
PartitionInfo *partitionInfo = &(it->second);
- if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
+ if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
return (false);
}
}
@@ -501,7 +501,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile
{
PartitionInfo *partitionInfo = &(it->second);
- if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
+ if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file))
return (false);
}
}
View
@@ -26,7 +26,7 @@ using namespace libpit;
PitEntry::PitEntry()
{
unused = false;
- partitionType = 0;
+ chipIdentifier = 0;
partitionIdentifier = 0;
partitionFlags = 0;
unknown1 = 0;
@@ -45,7 +45,7 @@ PitEntry::~PitEntry()
bool PitEntry::Matches(const PitEntry *otherPitEntry) const
{
- if (unused == otherPitEntry->unused && partitionType == otherPitEntry->partitionType && partitionIdentifier == otherPitEntry->partitionIdentifier
+ if (unused == otherPitEntry->unused && chipIdentifier == otherPitEntry->chipIdentifier && partitionIdentifier == otherPitEntry->partitionIdentifier
&& partitionFlags == otherPitEntry->partitionFlags && unknown1 == otherPitEntry->unknown1 && partitionBlockSize == otherPitEntry->partitionBlockSize
&& partitionBlockCount == otherPitEntry->partitionBlockCount && unknown2 == otherPitEntry->unknown2 && unknown3 == otherPitEntry->unknown3
&& strcmp(partitionName, otherPitEntry->partitionName) == 0 && strcmp(filename, otherPitEntry->filename) == 0)
@@ -121,7 +121,7 @@ bool PitData::Unpack(const unsigned char *data)
entries[i]->SetUnused((integerValue != 0) ? true : false);
integerValue = PitData::UnpackInteger(data, entryOffset + 4);
- entries[i]->SetPartitionType(integerValue);
+ entries[i]->SetChipIdentifier(integerValue);
integerValue = PitData::UnpackInteger(data, entryOffset + 8);
entries[i]->SetPartitionIdentifier(integerValue);
@@ -177,7 +177,7 @@ void PitData::Pack(unsigned char *data) const
PitData::PackInteger(data, entryOffset, (entries[i]->GetUnused()) ? 1 : 0);
- PitData::PackInteger(data, entryOffset + 4, entries[i]->GetPartitionType());
+ PitData::PackInteger(data, entryOffset + 4, entries[i]->GetChipIdentifier());
PitData::PackInteger(data, entryOffset + 8, entries[i]->GetPartitionIdentifier());
PitData::PackInteger(data, entryOffset + 12, entries[i]->GetPartitionFlags());
View
@@ -46,13 +46,6 @@ namespace libpit
kFilenameMaxLength = 64
};
- enum
- {
- kPartitionTypeRfs = 0,
- kPartitionTypeBlank = 1, // ?
- kPartitionTypeExt4 = 2
- };
-
enum
{
kPartitionFlagWrite = 1 << 1
@@ -62,7 +55,7 @@ namespace libpit
bool unused;
- unsigned int partitionType;
+ unsigned int chipIdentifier;
unsigned int partitionIdentifier;
unsigned int partitionFlags;
@@ -94,14 +87,14 @@ namespace libpit
this->unused = unused;
}
- unsigned int GetPartitionType(void) const
+ unsigned int GetChipIdentifier(void) const
{
- return partitionType;
+ return chipIdentifier;
}
- void SetPartitionType(unsigned int partitionType)
+ void SetChipIdentifier(unsigned int chipIdentifier)
{
- this->partitionType = partitionType;
+ this->chipIdentifier = chipIdentifier;
}
unsigned int GetPartitionIdentifier(void) const

0 comments on commit 907c942

Please sign in to comment.