summaryrefslogtreecommitdiffstats
path: root/heimdall
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-04 19:33:12 +0200
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-06 13:39:07 +0200
commita5452e884a1f1119d87e12e42d6ca9745617d054 (patch)
tree747607f94cfc92456a5aa6e86d5cba42290118c5 /heimdall
parentautogen'd for 1.4.1 (diff)
downloadHeimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar.gz
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar.bz2
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar.lz
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar.xz
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.tar.zst
Heimdall-a5452e884a1f1119d87e12e42d6ca9745617d054.zip
Diffstat (limited to 'heimdall')
-rw-r--r--heimdall/source/BridgeManager.cpp15
-rw-r--r--heimdall/source/BridgeManager.h8
-rw-r--r--heimdall/source/ClosePcScreenAction.cpp17
-rw-r--r--heimdall/source/DownloadPitAction.cpp17
-rw-r--r--heimdall/source/FlashAction.cpp28
-rw-r--r--heimdall/source/PrintPitAction.cpp16
6 files changed, 33 insertions, 68 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 3e85a09..e954f3b 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -447,10 +447,9 @@ bool BridgeManager::InitialiseProtocol(void)
return (false);
}
-BridgeManager::BridgeManager(bool verbose, int communicationDelay)
+BridgeManager::BridgeManager(bool verbose)
{
this->verbose = verbose;
- this->communicationDelay = communicationDelay;
libusbContext = nullptr;
deviceHandle = nullptr;
@@ -725,8 +724,7 @@ bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeou
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 bulk transfer.", result);
@@ -767,9 +765,6 @@ bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, bool retry)
if (!SendBulkTransfer(nullptr, 0, timeout, retry))
return (false);
- if (communicationDelay != 0)
- Sleep(communicationDelay);
-
return (true);
}
@@ -789,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++)
{
@@ -818,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 6481de6..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
@@ -107,7 +102,6 @@ namespace Heimdall
static const DeviceIdentifier supportedDevices[kSupportedDeviceCount];
bool verbose;
- int communicationDelay;
libusb_context *libusbContext;
libusb_device_handle *deviceHandle;
@@ -146,7 +140,7 @@ namespace Heimdall
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/FlashAction.cpp b/heimdall/source/FlashAction.cpp
index e951d4e..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";
@@ -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/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())