From 3af0c3ad63437ac53f5e2832a22e21a8790686f5 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 30 Apr 2014 01:40:10 +1000 Subject: Minor code clean up. --- heimdall/source/FlashAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index 6f2d49b..e951d4e 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.cpp @@ -251,7 +251,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); -- cgit v1.1 From a5452e884a1f1119d87e12e42d6ca9745617d054 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Mon, 5 May 2014 03:33:12 +1000 Subject: Cleaned up command line interface - Removed the "--delay " argument. - Improved Action usage info. --- heimdall/source/FlashAction.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'heimdall/source/FlashAction.cpp') 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 \n\ - --|-- [...]\n\ - [--verbose] [--no-reboot] [--stdout-errors] [--delay ]\n\ - [--usb-log-level ]\n\ + [-- ...]\n\ + [-- ...]\n\ + [--pit ] [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\ + [--usb-log-level ]\n\ or:\n\ - --|-- [...]\n\ - [--pit ]\n\ - [--verbose] [--no-reboot] [--stdout-errors] [--delay ]\n\ - [--usb-log-level ]\n\ + --repartition --pit [-- ...]\n\ + [-- ...] [--verbose] [--no-reboot]\n\ + [--resume] [--stdout-errors] [--usb-log-level ]\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(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()) -- cgit v1.1 From 9f957a193701788cac66292daea2c89ed94a033f Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Tue, 6 May 2014 22:52:10 +1000 Subject: Updated copyright notices to 2014 --- heimdall/source/FlashAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index b528597..e528680 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.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 -- cgit v1.1 From ce486f7ecbf4259e5cf401c16a175e63046d73c8 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 7 May 2014 06:48:00 +1000 Subject: Removed a few unused variables. --- heimdall/source/FlashAction.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index e528680..2ceaa3e 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.cpp @@ -100,7 +100,6 @@ static bool openFiles(Arguments& arguments, vector& partitionFile for (vector::const_iterator it = arguments.GetArguments().begin(); it != arguments.GetArguments().end(); it++) { - bool isPartitionArgument = false; const string& argumentName = (*it)->GetName(); // The only way an argument could exist without being in the argument types map is if it's a wild-card. -- cgit v1.1 From e6fdafd4829842d96eefa3163b6149265819fe95 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Sun, 11 May 2014 19:26:26 +1000 Subject: Fixed help output alignment. --- heimdall/source/FlashAction.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index 2ceaa3e..aa08ed8 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.cpp @@ -39,19 +39,19 @@ using namespace Heimdall; const char *FlashAction::usage = "Action: flash\n\ Arguments:\n\ - [-- ...]\n\ - [-- ...]\n\ - [--pit ] [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\ - [--usb-log-level ]\n\ + [-- ...]\n\ + [-- ...]\n\ + [--pit ] [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\ + [--usb-log-level ]\n\ or:\n\ --repartition --pit [-- ...]\n\ - [-- ...] [--verbose] [--no-reboot]\n\ - [--resume] [--stdout-errors] [--usb-log-level ]\n\ + [-- ...] [--verbose] [--no-reboot]\n\ + [--resume] [--stdout-errors] [--usb-log-level ]\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\ + 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"; -- cgit v1.1 From 082fb091f1a0cab9d00e82de54fee32b6a1c0c7b Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Sun, 1 Jun 2014 14:09:56 +1000 Subject: Fixed support for large files (up to 2^32 - 1 bytes) The Loke protocol supports 32-bit unsigned for the size of files being flashed. However, POSIX file commands only support 32-bit (signed). As such we now have platform specific support for larger files. --- heimdall/source/FlashAction.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index aa08ed8..590e0b5 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.cpp @@ -87,7 +87,7 @@ static bool openFiles(Arguments& arguments, vector& partitionFile if (pitArgument) { - pitFile = fopen(pitArgument->GetValue().c_str(), "rb"); + pitFile = FileOpen(pitArgument->GetValue().c_str(), "rb"); if (!pitFile) { @@ -109,7 +109,7 @@ static bool openFiles(Arguments& arguments, vector& partitionFile if (arguments.GetArgumentTypes().find(argumentName) == arguments.GetArgumentTypes().end()) { const StringArgument *stringArgument = static_cast(*it); - FILE *file = fopen(stringArgument->GetValue().c_str(), "rb"); + FILE *file = FileOpen(stringArgument->GetValue().c_str(), "rb"); if (!file) { @@ -130,34 +130,34 @@ static void closeFiles(vector& partitionFiles, FILE *& pitFile) if (pitFile) { - fclose(pitFile); + FileClose(pitFile); pitFile = nullptr; } // Close partition files for (vector::const_iterator it = partitionFiles.begin(); it != partitionFiles.end(); it++) - fclose(it->file); + FileClose(it->file); partitionFiles.clear(); } static bool sendTotalTransferSize(BridgeManager *bridgeManager, const vector& partitionFiles, FILE *pitFile, bool repartition) { - int totalBytes = 0; + unsigned int totalBytes = 0; for (vector::const_iterator it = partitionFiles.begin(); it != partitionFiles.end(); it++) { - fseek(it->file, 0, SEEK_END); - totalBytes += ftell(it->file); - rewind(it->file); + FileSeek(it->file, 0, SEEK_END); + totalBytes += (unsigned int)FileTell(it->file); + FileRewind(it->file); } if (repartition) { - fseek(pitFile, 0, SEEK_END); - totalBytes += ftell(pitFile); - rewind(pitFile); + FileSeek(pitFile, 0, SEEK_END); + totalBytes += (unsigned int)FileTell(pitFile); + FileRewind(pitFile); } bool success; @@ -168,7 +168,7 @@ static bool sendTotalTransferSize(BridgeManager *bridgeManager, const vector 0) { - rewind(pitFile); + FileRewind(pitFile); localPitData = new PitData(); localPitData->Unpack(pitFileBuffer); -- cgit v1.1 From 46c4f8be14aff1794f88f675ab372a8a07261c1a Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Mon, 29 Feb 2016 18:42:55 +0100 Subject: - fixed logical error, wrong variable was used in error message --- heimdall/source/FlashAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'heimdall/source/FlashAction.cpp') diff --git a/heimdall/source/FlashAction.cpp b/heimdall/source/FlashAction.cpp index 590e0b5..d9203b0 100644 --- a/heimdall/source/FlashAction.cpp +++ b/heimdall/source/FlashAction.cpp @@ -185,7 +185,7 @@ static bool sendTotalTransferSize(BridgeManager *bridgeManager, const vector