aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/PrintPitAction.cpp
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-04-30 10:00:29 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-04-30 10:00:29 +0200
commitd9c6729c9df44fcaf894cc966e4e2a8ae7109bc3 (patch)
tree24f0e6518939f38330ea51095c88e7f08fdb8bcf /heimdall/source/PrintPitAction.cpp
parent61f67d4dd3f81560417c7b8d1bd5b2611eb7a001 (diff)
parentb6fe7f8535355eb8025f4872efef6cd7d3993db6 (diff)
downloadexternal_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.zip
external_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.tar.gz
external_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.tar.bz2
Merge branch 'master' of https://github.com/Benjamin-Dobell/Heimdall into cm-12.1
Diffstat (limited to 'heimdall/source/PrintPitAction.cpp')
-rw-r--r--heimdall/source/PrintPitAction.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/heimdall/source/PrintPitAction.cpp b/heimdall/source/PrintPitAction.cpp
index 20144a7..8e33126 100644
--- a/heimdall/source/PrintPitAction.cpp
+++ b/heimdall/source/PrintPitAction.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2013 Benjamin Dobell, Glass Echidna
+/* Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -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.\n";
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;
@@ -114,7 +115,7 @@ int PrintPitAction::Execute(int argc, char **argv)
{
const char *filename = fileArgument->GetValue().c_str();
- localPitFile = fopen(filename, "rb");
+ localPitFile = FileOpen(filename, "rb");
if (!localPitFile)
{
@@ -132,14 +133,14 @@ int PrintPitAction::Execute(int argc, char **argv)
{
// Print PIT from file; there's no need for a BridgeManager.
- fseek(localPitFile, 0, SEEK_END);
- long localPitFileSize = ftell(localPitFile);
- rewind(localPitFile);
+ FileSeek(localPitFile, 0, SEEK_END);
+ unsigned int localPitFileSize = (unsigned int)FileTell(localPitFile);
+ FileRewind(localPitFile);
// Load the local pit file into memory.
unsigned char *pitFileBuffer = new unsigned char[localPitFileSize];
- size_t dataRead = fread(pitFileBuffer, 1, localPitFileSize, localPitFile); // dataRead is discarded, it's here to remove warnings.
- fclose(localPitFile);
+ (void)fread(pitFileBuffer, 1, localPitFileSize, localPitFile);
+ FileClose(localPitFile);
PitData *pitData = new PitData();
pitData->Unpack(pitFileBuffer);
@@ -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())