aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-01-22 23:53:30 +1100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-01-22 23:53:30 +1100
commit31b1b0b2b0c9312e597ad35e26729474c21b20b9 (patch)
tree7cf1870cd39bc8510d7cd1db60c5bdb55bcbcdbb /heimdall/source
parente0e84b2f7a28bd188f104f51a845dc4ed8a9b7ea (diff)
downloadexternal_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.zip
external_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.tar.gz
external_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.tar.bz2
- Changed interpretation of packet size reponses of 0 from meaning "don't
care" to "unsupported". - Changed block size in libpit to mean either block size or block offset.
Diffstat (limited to 'heimdall/source')
-rw-r--r--heimdall/source/BridgeManager.cpp73
-rw-r--r--heimdall/source/Heimdall.h4
-rw-r--r--heimdall/source/Interface.cpp2
3 files changed, 36 insertions, 43 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index fa83b1c..2bc96cf 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -591,14 +591,40 @@ bool BridgeManager::BeginSession(void)
if (!ReceivePacket(&beginSessionResponse))
return (false);
- unsigned int result = beginSessionResponse.GetResult();
+ unsigned int deviceDefaultPacketSize = beginSessionResponse.GetResult();
- if (result != 0) // Assume 0 means don't care, otherwise use the response as the fileTransferPacketSize.
- fileTransferPacketSize = result;
+ if (deviceDefaultPacketSize != 0) // 0 means changing the packet size is not supported.
+ {
+ Interface::Print("\nThis device may take up to 2 minutes to respond.\nPlease be patient!\n\n");
+ Sleep(2000); // Give the user time to read the message.
+
+ fileTransferSequenceTimeout = 120000; // 2 minutes!
+ fileTransferPacketSize = 1048576; // 1 MiB
+ fileTransferSequenceMaxLength = 100; // 100 MiB per sequence. Which is the same as the default of 800 * 131072.
+
+ FilePartSizePacket filePartSizePacket(fileTransferPacketSize);
+
+ if (!SendPacket(&filePartSizePacket))
+ {
+ Interface::PrintError("Failed to send file part size packet!\n");
+ return (false);
+ }
+
+ SessionSetupResponse filePartSizeResponse;
+
+ if (!ReceivePacket(&filePartSizeResponse))
+ return (false);
+
+ if (filePartSizeResponse.GetResult() != 0)
+ {
+ Interface::PrintError("Unexpected file part size response!\nExpected: 0\nReceived: %d\n", filePartSizeResponse.GetResult());
+ return (false);
+ }
+ }
// -------------------- KIES DOESN'T DO THIS --------------------
- DeviceTypePacket deviceTypePacket;
+ /*DeviceTypePacket deviceTypePacket;
if (!SendPacket(&deviceTypePacket))
{
@@ -626,39 +652,7 @@ bool BridgeManager::BeginSession(void)
if (verbose)
Interface::Print("Session begun with device of type: %d.\n\n", deviceType);
else
- Interface::Print("Session begun.\n\n", deviceType);
-
- if (deviceType == 30)
- {
- Interface::Print("In certain situations this device may take up to 2 minutes to respond.\nPlease be patient!\n\n", deviceType);
- Sleep(2000); // Give the user time to read the message.
-
- // The SGH-I727 is very unstable/unreliable using the default settings. Flashing
- // seems to be much more reliable using the following setup.
-
- fileTransferSequenceMaxLength = 30;
- fileTransferSequenceTimeout = 120000; // 2 minutes!
- fileTransferPacketSize = 1048576; // 1 MiB
-
- FilePartSizePacket filePartSizePacket(fileTransferPacketSize); // 1 MiB
-
- if (!SendPacket(&filePartSizePacket))
- {
- Interface::PrintError("Failed to send file part size packet!\n");
- return (false);
- }
-
- SessionSetupResponse filePartSizeResponse;
-
- if (!ReceivePacket(&filePartSizeResponse))
- return (false);
-
- if (filePartSizeResponse.GetResult() != 0)
- {
- Interface::PrintError("Unexpected file part size response!\nExpected: 0\nReceived: %d\n", filePartSizeResponse.GetResult());
- return (false);
- }
- }
+ Interface::Print("Session begun.\n\n");
return (true);
@@ -666,7 +660,10 @@ bool BridgeManager::BeginSession(void)
Interface::PrintError("Unexpected device info response!\nExpected: 0, 3, 30, 180 or 190\nReceived:%d\n", deviceType);
return (false);
- }
+ }*/
+
+ Interface::Print("Session begun.\n\n");
+ return (true);
}
bool BridgeManager::EndSession(bool reboot) const
diff --git a/heimdall/source/Heimdall.h b/heimdall/source/Heimdall.h
index 1cb2eaa..88969c2 100644
--- a/heimdall/source/Heimdall.h
+++ b/heimdall/source/Heimdall.h
@@ -37,8 +37,4 @@
#endif
-#ifndef nullptr
-#define nullptr 0
-#endif
-
#endif
diff --git a/heimdall/source/Interface.cpp b/heimdall/source/Interface.cpp
index 67f1bee..bbe1472 100644
--- a/heimdall/source/Interface.cpp
+++ b/heimdall/source/Interface.cpp
@@ -299,7 +299,7 @@ void Interface::PrintPit(const PitData *pitData)
Interface::Print("\n");
}
- Interface::Print("Partition Block Size: %d\n", entry->GetBlockSize());
+ Interface::Print("Partition Block Size/Offset: %d\n", entry->GetBlockSizeOrOffset());
Interface::Print("Partition Block Count: %d\n", entry->GetBlockCount());
Interface::Print("File Offset (Obsolete): %d\n", entry->GetFileOffset());