summaryrefslogtreecommitdiffstats
path: root/heimdall/source
diff options
context:
space:
mode:
Diffstat (limited to 'heimdall/source')
-rw-r--r--heimdall/source/BridgeManager.cpp288
-rw-r--r--heimdall/source/BridgeManager.h21
-rw-r--r--heimdall/source/ClosePcScreenAction.cpp17
-rw-r--r--heimdall/source/DownloadPitAction.cpp17
-rw-r--r--heimdall/source/EndFileTransferPacket.h16
-rw-r--r--heimdall/source/FlashAction.cpp30
-rw-r--r--heimdall/source/Interface.cpp5
-rw-r--r--heimdall/source/PrintPitAction.cpp16
8 files changed, 182 insertions, 228 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index d21ea60..6546541 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -80,7 +80,6 @@ enum
enum
{
- kHandshakeMaxAttempts = 5,
kReceivePacketMaxAttempts = 5
};
@@ -307,144 +306,150 @@ void BridgeManager::ReleaseDeviceInterface(void)
Interface::Print("\n");
}
-bool BridgeManager::InitialiseProtocol(void)
+enum
{
- Interface::Print("Initialising protocol...\n");
-
- unsigned char dataBuffer[7];
-
- int result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x22, 0x3, 0, nullptr, 0, 1000);
-
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #1 failed. Result: %d\n", result);
+ kControlRequestSetLineCoding = 0x20,
+ kControlRequestSetControlLineState = 0x22
+};
- memset(dataBuffer, 0, 7);
- dataBuffer[1] = 0xC2;
- dataBuffer[2] = 0x01;
- dataBuffer[6] = 0x07;
- result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x20, 0x0, 0, dataBuffer, 7, 1000);
+enum
+{
+ kLineCodingCharFormatZeroToOneStopBit = 0,
+ kLineCodingCharFormatOneToOneAndAHalfStopBits = 1,
+ kLineCodingCharFormatTwoToTwoAndAHalfStopBits = 2
+};
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #2 failed. Result: %d\n", result);
+enum
+{
+ kParityTypeNone = 0,
+ kParityTypeOdd = 1,
+ kParityTypeEven = 2,
+ kParityTypeMark = 3,
+ kParityTypeSpace = 4
+};
- result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x22, 0x3, 0, nullptr, 0, 1000);
+bool BridgeManager::SetControlLineState(unsigned short controlSignalFlags)
+{
+ int result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, kControlRequestSetControlLineState, controlSignalFlags, 0, nullptr, 0, 1000);
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #3 failed. Result: %d\n", result);
+ if (result != LIBUSB_SUCCESS)
+ {
+ if (verbose)
+ Interface::PrintWarning("Control line state (signal flags: 0x%x) transfer failed. Result: %d\n", controlSignalFlags, result);
- result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x22, 0x2, 0, nullptr, 0, 1000);
+ return (false);
+ }
+ else
+ {
+ return (true);
+ }
+}
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #4 failed. Result: %d\n", result);
+bool BridgeManager::SetControlLineCoding(LineCoding lineCoding)
+{
+ unsigned char dataBuffer[7];
- memset(dataBuffer, 0, 7);
- dataBuffer[1] = 0xC2;
- dataBuffer[2] = 0x01;
- dataBuffer[6] = 0x08;
+ dataBuffer[0] = lineCoding.dteRate & 0xFF;
+ dataBuffer[1] = (lineCoding.dteRate >> 8) & 0xFF;
+ dataBuffer[2] = (lineCoding.dteRate >> 16) & 0xFF;
+ dataBuffer[3] = (lineCoding.dteRate >> 24) & 0xFF;
+ dataBuffer[4] = lineCoding.charFormat;
+ dataBuffer[5] = lineCoding.parityType;
+ dataBuffer[6] = lineCoding.dataBits;
- result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x20, 0x0, 0, dataBuffer, 7, 1000);
+ int result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, kControlRequestSetLineCoding, 0x0, 0, dataBuffer, 7, 1000);
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #5 failed. Result: %d\n", result);
+ if (result != LIBUSB_SUCCESS)
+ {
+ if (verbose)
+ Interface::PrintWarning("Setting control line coding failed. Result: %d\n", result);
- result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, 0x22, 0x2, 0, nullptr, 0, 1000);
+ return (false);
+ }
+ else
+ {
+ return (true);
+ }
+}
- if (result < 0 && verbose)
- Interface::PrintWarning("Control transfer #6 failed. Result: %d\n", result);
+enum
+{
+ kLineStateControlSignalDtePresent = 1,
+ kLineStateControlSignalCarrierControl = 1 << 1
+};
- unsigned int attempt = 0;
+bool BridgeManager::InitialiseProtocol(void)
+{
+ Interface::Print("Initialising protocol...\n");
- // max(250, communicationDelay)
- int retryDelay = (communicationDelay > 250) ? communicationDelay : 250;
+ /*LineCoding lineCoding;
- for (; attempt < kHandshakeMaxAttempts; attempt++)
- {
- if (attempt > 0)
- {
- if (verbose)
- Interface::PrintErrorSameLine(" Retrying...\n");
-
- // Wait longer each retry
- Sleep(retryDelay * (attempt + 1));
- }
+ lineCoding.dteRate = 115200;
+ lineCoding.charFormat = kLineCodingCharFormatZeroToOneStopBit;
+ lineCoding.parityType = kParityTypeNone;
+ lineCoding.dataBits = 7;
- int dataTransferred = 0;
+ SetControlLineState(kLineStateControlSignalDtePresent | kLineStateControlSignalCarrierControl);
+ SetControlLineCoding(lineCoding);
+ SetControlLineState(kLineStateControlSignalDtePresent | kLineStateControlSignalCarrierControl);
+ SetControlLineState(kLineStateControlSignalCarrierControl);
+
+ lineCoding.dataBits = 8;
+ SetControlLineCoding(lineCoding);
- // Send "ODIN"
- memcpy(dataBuffer, "ODIN", 4);
- memset(dataBuffer + 4, 0, 1);
+ SetControlLineState(kLineStateControlSignalCarrierControl);*/
- result = libusb_bulk_transfer(deviceHandle, outEndpoint, dataBuffer, 4, &dataTransferred, 1000);
- if (result < 0)
- {
- if (verbose)
- Interface::PrintError("Failed to send data: \"%s\"\n", dataBuffer);
- else
- Interface::PrintError("Failed to send data!");
+ int dataTransferred = 0;
- return (false);
- }
+ unsigned char dataBuffer[7];
- if (dataTransferred != 4)
- {
- if (verbose)
- Interface::PrintError("Failed to complete sending of data: \"%s\"\n", dataBuffer);
- else
- Interface::PrintError("Failed to complete sending of data!");
+ // Send "ODIN"
+ memcpy(dataBuffer, "ODIN", 4);
+ memset(dataBuffer + 4, 0, 1);
- return (false);
- }
+ if (!SendBulkTransfer(dataBuffer, 4, 1000))
+ {
+ Interface::PrintError("Failed to send handshake!");
+ }
- // Expect "LOKE"
- memset(dataBuffer, 0, 7);
+ // Expect "LOKE"
+ memset(dataBuffer, 0, 7);
- int retry = 0;
- dataTransferred = 0;
+ int retry = 0;
+ dataTransferred = 0;
- result = libusb_bulk_transfer(deviceHandle, inEndpoint, dataBuffer, 7, &dataTransferred, 1000);
+ int result = libusb_bulk_transfer(deviceHandle, inEndpoint, dataBuffer, 7, &dataTransferred, 1000);
- if (result < 0)
+ if (result != LIBUSB_SUCCESS)
+ {
+ if (verbose)
+ Interface::PrintError("Failed to receive handshake response. Result: %d\n", result);
+ }
+ else
+ {
+ if (dataTransferred == 4 && memcmp(dataBuffer, "LOKE", 4) == 0)
{
- if (verbose)
- Interface::PrintError("Failed to receive handshake response.");
+ // Successfully received "LOKE"
+ Interface::Print("Protocol initialisation successful.\n\n");
+ return (true);
}
else
{
- if (dataTransferred == 4 && memcmp(dataBuffer, "LOKE", 4) == 0)
- {
- // Successfully received "LOKE"
- break;
- }
- else
- {
- if (verbose)
- Interface::PrintError("Expected: \"%s\"\nReceived: \"%s\"\n", "LOKE", dataBuffer);
+ if (verbose)
+ Interface::PrintError("Expected: \"LOKE\"\nReceived: \"%s\"\n", dataBuffer);
- Interface::PrintError("Unexpected handshake response!");
- }
+ Interface::PrintError("Unexpected handshake response!\n");
}
}
- if (attempt == kHandshakeMaxAttempts)
- {
- if (verbose)
- Interface::PrintErrorSameLine("\n");
-
- Interface::PrintError("Protocol initialisation failed!\n\n");
- return (false);
- }
- else
- {
- Interface::Print("Protocol initialisation successful.\n\n");
- return (true);
- }
+ Interface::PrintError("Protocol initialisation failed!\n\n");
+ return (false);
}
-BridgeManager::BridgeManager(bool verbose, int communicationDelay)
+BridgeManager::BridgeManager(bool verbose)
{
this->verbose = verbose;
- this->communicationDelay = communicationDelay;
libusbContext = nullptr;
deviceHandle = nullptr;
@@ -652,46 +657,6 @@ bool BridgeManager::BeginSession(void)
}
}
- // -------------------- KIES DOESN'T DO THIS --------------------
-
- /*DeviceTypePacket deviceTypePacket;
-
- if (!SendPacket(&deviceTypePacket))
- {
- Interface::PrintError("Failed to request device type!\n");
- return (false);
- }
-
- SessionSetupResponse deviceTypeResponse;
-
- if (!ReceivePacket(&deviceTypeResponse))
- return (false);
-
- unsigned int deviceType = deviceTypeResponse.GetResult();
-
- switch (deviceType)
- {
- // NOTE: If you add a new device type don't forget to update the error message below!
-
- case 0: // Galaxy S etc.
- case 3: // Galaxy Tab
- case 30: // Galaxy S 2 Skyrocket
- case 180: // Galaxy S etc.
- case 190: // M110S Galaxy S
-
- if (verbose)
- Interface::Print("Session begun with device of type: %d.\n\n", deviceType);
- else
- Interface::Print("Session begun.\n\n");
-
- return (true);
-
- default:
-
- 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);
}
@@ -752,21 +717,17 @@ bool BridgeManager::EndSession(bool reboot) const
return (true);
}
-bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, bool retry) const
+bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeout, bool retry) const
{
- packet->Pack();
-
int dataTransferred;
- int result = libusb_bulk_transfer(deviceHandle, outEndpoint, packet->GetData(), packet->GetSize(),
- &dataTransferred, timeout);
+ int result = libusb_bulk_transfer(deviceHandle, outEndpoint, data, length, &dataTransferred, timeout);
- if (result < 0 && retry)
+ if (result != LIBUSB_SUCCESS && retry)
{
- // max(250, communicationDelay)
- int retryDelay = (communicationDelay > 250) ? communicationDelay : 250;
+ static const int retryDelay = 250;
if (verbose)
- Interface::PrintError("libusb error %d whilst sending packet.", result);
+ Interface::PrintError("libusb error %d whilst sending bulk transfer.", result);
// Retry
for (int i = 0; i < 5; i++)
@@ -777,24 +738,31 @@ bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, bool retry)
// Wait longer each retry
Sleep(retryDelay * (i + 1));
- result = libusb_bulk_transfer(deviceHandle, outEndpoint, packet->GetData(), packet->GetSize(),
- &dataTransferred, timeout);
+ result = libusb_bulk_transfer(deviceHandle, outEndpoint, data, length, &dataTransferred, timeout);
- if (result >= 0)
+ if (result == LIBUSB_SUCCESS)
break;
if (verbose)
- Interface::PrintError("libusb error %d whilst sending packet.", result);
+ Interface::PrintError("libusb error %d whilst sending bulk transfer.", result);
}
if (verbose)
Interface::PrintErrorSameLine("\n");
}
- if (communicationDelay != 0)
- Sleep(communicationDelay);
+ return (result == LIBUSB_SUCCESS && dataTransferred == length);
+}
- if (result < 0 || dataTransferred != packet->GetSize())
+bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, bool retry) const
+{
+ packet->Pack();
+
+ if (!SendBulkTransfer(packet->GetData(), packet->GetSize(), timeout, retry))
+ return (false);
+
+ // After each packet we send an empty bulk transfer... Hey! I'm just implementing the protocol, I didn't define it!
+ if (!SendBulkTransfer(nullptr, 0, timeout, retry))
return (false);
return (true);
@@ -816,8 +784,7 @@ bool BridgeManager::ReceivePacket(InboundPacket *packet, int timeout, bool retry
unsigned int attempt = 0;
unsigned int maxAttempts = (retry) ? kReceivePacketMaxAttempts : 1;
- // max(250, communicationDelay)
- int retryDelay = (communicationDelay > 250) ? communicationDelay : 250;
+ static const int retryDelay = 250;
for (; attempt < maxAttempts; attempt++)
{
@@ -845,9 +812,6 @@ bool BridgeManager::ReceivePacket(InboundPacket *packet, int timeout, bool retry
if (attempt == maxAttempts)
return (false);
- if (communicationDelay != 0)
- Sleep(communicationDelay);
-
if (dataTransferred != packet->GetSize() && !packet->IsSizeVariable())
{
if (verbose)
diff --git a/heimdall/source/BridgeManager.h b/heimdall/source/BridgeManager.h
index e67c679..6635724 100644
--- a/heimdall/source/BridgeManager.h
+++ b/heimdall/source/BridgeManager.h
@@ -61,11 +61,6 @@ namespace Heimdall
enum
{
- kCommunicationDelayDefault = 0
- };
-
- enum
- {
kInitialiseSucceeded = 0,
kInitialiseFailed,
kInitialiseDeviceNotDetected
@@ -94,12 +89,19 @@ namespace Heimdall
Default = Error
};
+ typedef struct
+ {
+ unsigned int dteRate;
+ unsigned char charFormat;
+ unsigned char parityType;
+ unsigned char dataBits;
+ } LineCoding;
+
private:
static const DeviceIdentifier supportedDevices[kSupportedDeviceCount];
bool verbose;
- int communicationDelay;
libusb_context *libusbContext;
libusb_device_handle *deviceHandle;
@@ -131,9 +133,14 @@ namespace Heimdall
bool InitialiseProtocol(void);
+ bool SetControlLineState(unsigned short controlSignalFlags);
+ bool SetControlLineCoding(LineCoding lineCoding);
+
+ bool SendBulkTransfer(unsigned char *data, int length, int timeout = 3000, bool retry = true) const;
+
public:
- BridgeManager(bool verbose, int communicationDelay = BridgeManager::kCommunicationDelayDefault);
+ BridgeManager(bool verbose);
~BridgeManager();
bool DetectDevice(void);
diff --git a/heimdall/source/ClosePcScreenAction.cpp b/heimdall/source/ClosePcScreenAction.cpp
index 2bc1b61..a72eab6 100644
--- a/heimdall/source/ClosePcScreenAction.cpp
+++ b/heimdall/source/ClosePcScreenAction.cpp
@@ -29,9 +29,12 @@ using namespace std;
using namespace Heimdall;
const char *ClosePcScreenAction::usage = "Action: close-pc-screen\n\
-Arguments: [--verbose] [--no-reboot] [--stdout-errors] [--delay <ms>]\n\
+Arguments: [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\
[--usb-log-level <none/error/warning/debug>]\n\
-Description: Attempts to get rid off the \"connect phone to PC\" screen.\n";
+Description: Attempts to get rid off the \"connect phone to PC\" screen.\n\
+Note: --no-reboot causes the device to remain in download mode after the action\n\
+ is completed. If you wish to perform another action whilst remaining in\n\
+ download mode, then the following action must specify the --resume flag.";
int ClosePcScreenAction::Execute(int argc, char **argv)
{
@@ -40,7 +43,6 @@ int ClosePcScreenAction::Execute(int argc, char **argv)
map<string, ArgumentType> argumentTypes;
argumentTypes["no-reboot"] = kArgumentTypeFlag;
argumentTypes["resume"] = kArgumentTypeFlag;
- argumentTypes["delay"] = kArgumentTypeUnsignedInteger;
argumentTypes["verbose"] = kArgumentTypeFlag;
argumentTypes["stdout-errors"] = kArgumentTypeFlag;
argumentTypes["usb-log-level"] = kArgumentTypeString;
@@ -53,9 +55,7 @@ int ClosePcScreenAction::Execute(int argc, char **argv)
return (0);
}
- const UnsignedIntegerArgument *communicationDelayArgument = static_cast<const UnsignedIntegerArgument *>(arguments.GetArgument("delay"));
const StringArgument *usbLogLevelArgument = static_cast<const StringArgument *>(arguments.GetArgument("usb-log-level"));
-
BridgeManager::UsbLogLevel usbLogLevel = BridgeManager::UsbLogLevel::Default;
if (usbLogLevelArgument)
@@ -104,12 +104,7 @@ int ClosePcScreenAction::Execute(int argc, char **argv)
// Download PIT file from device.
- int communicationDelay = BridgeManager::kCommunicationDelayDefault;
-
- if (communicationDelayArgument)
- communicationDelay = communicationDelayArgument->GetValue();
-
- BridgeManager *bridgeManager = new BridgeManager(verbose, communicationDelay);
+ BridgeManager *bridgeManager = new BridgeManager(verbose);
bridgeManager->SetUsbLogLevel(usbLogLevel);
if (bridgeManager->Initialise(resume) != BridgeManager::kInitialiseSucceeded || !bridgeManager->BeginSession())
diff --git a/heimdall/source/DownloadPitAction.cpp b/heimdall/source/DownloadPitAction.cpp
index abebfae..43325eb 100644
--- a/heimdall/source/DownloadPitAction.cpp
+++ b/heimdall/source/DownloadPitAction.cpp
@@ -33,9 +33,12 @@ using namespace Heimdall;
const char *DownloadPitAction::usage = "Action: download-pit\n\
Arguments: --output <filename> [--verbose] [--no-reboot] [--stdout-errors]\n\
- [--delay <ms>] [--usb-log-level <none/error/warning/debug>]\n\
+ [--usb-log-level <none/error/warning/debug>]\n\
Description: Downloads the connected device's PIT file to the specified\n\
- output file.\n";
+ output file.\n\
+Note: --no-reboot causes the device to remain in download mode after the action\n\
+ is completed. If you wish to perform another action whilst remaining in\n\
+ download mode, then the following action must specify the --resume flag.";
int DownloadPitAction::Execute(int argc, char **argv)
{
@@ -45,7 +48,6 @@ int DownloadPitAction::Execute(int argc, char **argv)
argumentTypes["output"] = kArgumentTypeString;
argumentTypes["no-reboot"] = kArgumentTypeFlag;
argumentTypes["resume"] = kArgumentTypeFlag;
- argumentTypes["delay"] = kArgumentTypeUnsignedInteger;
argumentTypes["verbose"] = kArgumentTypeFlag;
argumentTypes["stdout-errors"] = kArgumentTypeFlag;
argumentTypes["usb-log-level"] = kArgumentTypeString;
@@ -67,8 +69,6 @@ int DownloadPitAction::Execute(int argc, char **argv)
return (0);
}
- const UnsignedIntegerArgument *communicationDelayArgument = static_cast<const UnsignedIntegerArgument *>(arguments.GetArgument("delay"));
-
bool reboot = arguments.GetArgument("no-reboot") == nullptr;
bool resume = arguments.GetArgument("resume") != nullptr;
bool verbose = arguments.GetArgument("verbose") != nullptr;
@@ -130,12 +130,7 @@ int DownloadPitAction::Execute(int argc, char **argv)
// Download PIT file from device.
- int communicationDelay = BridgeManager::kCommunicationDelayDefault;
-
- if (communicationDelayArgument)
- communicationDelay = communicationDelayArgument->GetValue();
-
- BridgeManager *bridgeManager = new BridgeManager(verbose, communicationDelay);
+ BridgeManager *bridgeManager = new BridgeManager(verbose);
bridgeManager->SetUsbLogLevel(usbLogLevel);
if (bridgeManager->Initialise(resume) != BridgeManager::kInitialiseSucceeded || !bridgeManager->BeginSession())
diff --git a/heimdall/source/EndFileTransferPacket.h b/heimdall/source/EndFileTransferPacket.h
index 7e78899..9ae4a44 100644
--- a/heimdall/source/EndFileTransferPacket.h
+++ b/heimdall/source/EndFileTransferPacket.h
@@ -34,7 +34,7 @@ namespace Heimdall
{
kDestinationPhone = 0x00,
kDestinationModem = 0x01
- };
+ };
protected:
@@ -47,18 +47,18 @@ namespace Heimdall
unsigned int destination; // PDA / Modem
unsigned int sequenceByteCount;
- unsigned int unknown1;
- unsigned int chipIdentifier;
+ unsigned int unknown1; // EFS?
+ unsigned int deviceType;
protected:
- EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier)
+ EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int deviceType)
: FileTransferPacket(FileTransferPacket::kRequestEnd)
{
this->destination = destination;
this->sequenceByteCount = sequenceByteCount;
this->unknown1 = unknown1;
- this->chipIdentifier = chipIdentifier;
+ this->deviceType = deviceType;
}
public:
@@ -78,9 +78,9 @@ namespace Heimdall
return (unknown1);
}
- unsigned int GetChipIdentifier(void) const
+ unsigned int GetDeviceType(void) const
{
- return (chipIdentifier);
+ return (deviceType);
}
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, chipIdentifier);
+ PackInteger(FileTransferPacket::kDataSize + 12, deviceType);
}
};
}
diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp
index 6f2d49b..b528597 100644
--- a/heimdall/source/FlashAction.cpp
+++ b/heimdall/source/FlashAction.cpp
@@ -39,17 +39,19 @@ using namespace Heimdall;
const char *FlashAction::usage = "Action: flash\n\
Arguments:\n\
- --repartition --pit <filename>\n\
- --<partition name>|--<partition identifier> <filename> [...]\n\
- [--verbose] [--no-reboot] [--stdout-errors] [--delay <ms>]\n\
- [--usb-log-level <none/error/warning/debug>]\n\
+ [--<partition name> <filename> ...]\n\
+ [--<partition identifier> <filename> ...]\n\
+ [--pit <filename>] [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\
+ [--usb-log-level <none/error/warning/debug>]\n\
or:\n\
- --<partition name>|--<partition identifier> <filename> [...]\n\
- [--pit <filename>]\n\
- [--verbose] [--no-reboot] [--stdout-errors] [--delay <ms>]\n\
- [--usb-log-level <none/error/warning/debug>]\n\
+ --repartition --pit <filename> [--<partition name> <filename> ...]\n\
+ [--<partition identifier> <filename> ...] [--verbose] [--no-reboot]\n\
+ [--resume] [--stdout-errors] [--usb-log-level <none/error/warning/debug>]\n\
Description: Flashes one or more firmware files to your phone. Partition names\n\
(or identifiers) can be obtained by executing the print-pit action.\n\
+Note: --no-reboot causes the device to remain in download mode after the action\n\
+ is completed. If you wish to perform another action whilst remaining in\n\
+ download mode, then the following action must specify the --resume flag.\n\
WARNING: If you're repartitioning it's strongly recommended you specify\n\
all files at your disposal.\n";
@@ -251,7 +253,7 @@ static bool flashFile(BridgeManager *bridgeManager, const PartitionFlashInfo& pa
Interface::Print("Uploading %s\n", partitionFlashInfo.pitEntry->GetPartitionName());
if (bridgeManager->SendFile(partitionFlashInfo.file, EndModemFileTransferPacket::kDestinationModem,
- partitionFlashInfo.pitEntry->GetDeviceType())) // <-- Odin method
+ partitionFlashInfo.pitEntry->GetDeviceType()))
{
Interface::Print("%s upload successful\n\n", partitionFlashInfo.pitEntry->GetPartitionName());
return (true);
@@ -389,7 +391,6 @@ int FlashAction::Execute(int argc, char **argv)
argumentTypes["no-reboot"] = kArgumentTypeFlag;
argumentTypes["resume"] = kArgumentTypeFlag;
- argumentTypes["delay"] = kArgumentTypeUnsignedInteger;
argumentTypes["verbose"] = kArgumentTypeFlag;
argumentTypes["stdout-errors"] = kArgumentTypeFlag;
argumentTypes["usb-log-level"] = kArgumentTypeString;
@@ -417,8 +418,6 @@ int FlashAction::Execute(int argc, char **argv)
return (0);
}
- const UnsignedIntegerArgument *communicationDelayArgument = static_cast<const UnsignedIntegerArgument *>(arguments.GetArgument("delay"));
-
bool reboot = arguments.GetArgument("no-reboot") == nullptr;
bool resume = arguments.GetArgument("resume") != nullptr;
bool verbose = arguments.GetArgument("verbose") != nullptr;
@@ -497,12 +496,7 @@ int FlashAction::Execute(int argc, char **argv)
// Perform flash
- int communicationDelay = BridgeManager::kCommunicationDelayDefault;
-
- if (communicationDelayArgument)
- communicationDelay = communicationDelayArgument->GetValue();
-
- BridgeManager *bridgeManager = new BridgeManager(verbose, communicationDelay);
+ BridgeManager *bridgeManager = new BridgeManager(verbose);
bridgeManager->SetUsbLogLevel(usbLogLevel);
if (bridgeManager->Initialise(resume) != BridgeManager::kInitialiseSucceeded || !bridgeManager->BeginSession())
diff --git a/heimdall/source/Interface.cpp b/heimdall/source/Interface.cpp
index dbf8431..b070dad 100644
--- a/heimdall/source/Interface.cpp
+++ b/heimdall/source/Interface.cpp
@@ -42,7 +42,7 @@ using namespace Heimdall;
map<string, Interface::ActionInfo> actionMap;
bool stdoutErrors = false;
-const char *version = "v1.4.0";
+const char *version = "v1.4.1";
const char *actionUsage = "Usage: heimdall <action> <action arguments>\n";
const char *releaseInfo = "Heimdall %s\n\n\
@@ -264,6 +264,9 @@ void Interface::PrintPit(const PitData *pitData)
if (entry->GetAttributes() & PitEntry::kAttributeSTL)
Interface::Print("STL ");
+ /*if (entry->GetAttributes() & PitEntry::kAttributeBML)
+ Interface::Print("BML ");*/
+
if (entry->GetAttributes() & PitEntry::kAttributeWrite)
Interface::Print("Read/Write");
else
diff --git a/heimdall/source/PrintPitAction.cpp b/heimdall/source/PrintPitAction.cpp
index 1c8c98a..4ed6e6c 100644
--- a/heimdall/source/PrintPitAction.cpp
+++ b/heimdall/source/PrintPitAction.cpp
@@ -34,10 +34,13 @@ using namespace Heimdall;
const char *PrintPitAction::usage = "Action: print-pit\n\
Arguments: [--file <filename>] [--verbose] [--no-reboot] [--stdout-errors]\n\
- [--delay <ms>] [--usb-log-level <none/error/warning/debug>]\n\
+ [--usb-log-level <none/error/warning/debug>]\n\
Description: Prints the contents of a PIT file in a human readable format. If\n\
a filename is not provided then Heimdall retrieves the PIT file from the \n\
- connected device.\n";
+ connected device.\n\
+Note: --no-reboot causes the device to remain in download mode after the action\n\
+ is completed. If you wish to perform another action whilst remaining in\n\
+ download mode, then the following action must specify the --resume flag.";
int PrintPitAction::Execute(int argc, char **argv)
{
@@ -47,7 +50,6 @@ int PrintPitAction::Execute(int argc, char **argv)
argumentTypes["file"] = kArgumentTypeString;
argumentTypes["no-reboot"] = kArgumentTypeFlag;
argumentTypes["resume"] = kArgumentTypeFlag;
- argumentTypes["delay"] = kArgumentTypeUnsignedInteger;
argumentTypes["verbose"] = kArgumentTypeFlag;
argumentTypes["stdout-errors"] = kArgumentTypeFlag;
argumentTypes["usb-log-level"] = kArgumentTypeString;
@@ -61,7 +63,6 @@ int PrintPitAction::Execute(int argc, char **argv)
}
const StringArgument *fileArgument = static_cast<const StringArgument *>(arguments.GetArgument("file"));
- const UnsignedIntegerArgument *communicationDelayArgument = static_cast<const UnsignedIntegerArgument *>(arguments.GetArgument("delay"));
bool reboot = arguments.GetArgument("no-reboot") == nullptr;
bool resume = arguments.GetArgument("resume") != nullptr;
@@ -155,12 +156,7 @@ int PrintPitAction::Execute(int argc, char **argv)
{
// Print PIT from a device.
- int communicationDelay = BridgeManager::kCommunicationDelayDefault;
-
- if (communicationDelayArgument)
- communicationDelay = communicationDelayArgument->GetValue();
-
- BridgeManager *bridgeManager = new BridgeManager(verbose, communicationDelay);
+ BridgeManager *bridgeManager = new BridgeManager(verbose);
bridgeManager->SetUsbLogLevel(usbLogLevel);
if (bridgeManager->Initialise(resume) != BridgeManager::kInitialiseSucceeded || !bridgeManager->BeginSession())