From 1ef6e97b9089042316b49bb6c01668b531e2eae5 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 1 Jun 2011 06:42:21 +1000 Subject: 1.2.0b Heimdall command line update. Large update that adds lots of PIT file functionality and better support for more devices. --- heimdall/source/InterfaceManager.cpp | 87 +++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 16 deletions(-) (limited to 'heimdall/source/InterfaceManager.cpp') diff --git a/heimdall/source/InterfaceManager.cpp b/heimdall/source/InterfaceManager.cpp index 23791bc..aaf6d0b 100644 --- a/heimdall/source/InterfaceManager.cpp +++ b/heimdall/source/InterfaceManager.cpp @@ -29,18 +29,20 @@ using namespace std; using namespace Heimdall; -string InterfaceManager::actionNames[kActionCount] = { "flash", "close-pc-screen", "dump", "help" }; +string InterfaceManager::actionNames[kActionCount] = { "flash", "close-pc-screen", "dump", "print-pit", "help" }; string InterfaceManager::flashArgumentNames[kFlashArgCount * 2] = { // --- Long Names --- "-repartition", "-pit", "-factoryfs", "-cache", "-dbdata", "-primary-boot", "-secondary-boot", "-secondary-boot-backup", "-param", "-kernel", "-recovery", "-efs", "-modem", + "-normal-boot", "-system", "-user-data", "-fota", "-hidden", "-movinand", "-data", "-ums", "-emmc", "-%d", // --- Short Names --- "r", - "pit", "fs", "cache", "db", "boot", "sbl", "sbl2", "param", "z", "rec", "efs", "m" + "pit", "fs", "cache", "db", "boot", "sbl", "sbl2", "param", "z", "rec", "efs", "m", + "norm", "sys", "udata", "fota", "hide", "nand", "data", "ums", "emmc", "%d" }; string InterfaceManager::dumpArgumentNames[kDumpArgCount * 2] = { @@ -53,12 +55,12 @@ string InterfaceManager::dumpArgumentNames[kDumpArgCount * 2] = { string InterfaceManager::commonArgumentNames[kCommonArgCount * 2] = { // --- Long Names --- - "-verbose", + "-verbose", "-no-reboot" "-delay", // --- Short Names --- - "v", + "v", "nobt" "d" }; @@ -74,6 +76,9 @@ string *InterfaceManager::actionArgumentNames[kActionCount + 1] = { // kActionDump dumpArgumentNames, + // kActionPrintPit + nullptr, + // kActionHelp nullptr, @@ -82,28 +87,36 @@ string *InterfaceManager::actionArgumentNames[kActionCount + 1] = { }; int InterfaceManager::actionArgumentCounts[kActionCount + 1] = { - kFlashArgCount, 0, kDumpArgCount, 0, kCommonArgCount + kFlashArgCount, 0, kDumpArgCount, 0, 0, kCommonArgCount }; int InterfaceManager::actionValuelessArgumentCounts[kActionCount + 1] = { - kFlashArgPit, 0, kDumpArgChipType, 0, kCommonArgDelay + kFlashArgPit, 0, kDumpArgChipType, 0, 0, kCommonArgDelay }; -const char *InterfaceManager::usage = "Usage: heimdall [--verbose] [--delay ]\n\ +const char *InterfaceManager::usage = "Usage: heimdall [--verbose] [--no-reboot] [--delay ]\n\ \n\ action: flash\n\ arguments:\n\ - --repartition --pit --factoryfs \n\ - --cache --dbdata --primary-boot \n\ - --secondary-boot --param --kernel \n\ - --modem \n\ + --repartition --pit [--factoryfs ]\n\ + [--cache ] [--dbdata ] [--primary-boot ]\n\ + [--secondary-boot ] [--param ] [--kernel ]\n\ + [--modem ] [--normal-boot ] [--system ]\n\ + [--user-data ] [--fota ] [--hidden ]\n\ + [--movinand ] [--data ] [--ums ]\n\ + [--emmc ] [-- ]\n\ or:\n\ - [--pit ] [--factoryfs ] [--cache ]\n\ - [--dbdata ] [--primary-boot ]\n\ - [--secondary-boot ] [--secondary-boot-backup ]\n\ - [--param ] [--kernel ] [--recovery ]\n\ - [--efs ] [--modem ]\n\ + [--factoryfs ] [--cache ] [--dbdata ]\n\ + [--primary-boot ] [--secondary-boot ]\n\ + [--secondary-boot-backup ] [--param ]\n\ + [--kernel ] [--recovery ] [--efs ]\n\ + [--modem ] [--normal-boot ] [--system ]\n\ + [--user-data ] [--fota ] [--hidden ]\n\ + [--movinand ] [--data ] [--ums ]\n\ + [--emmc ] [-- ]\n\ description: Flashes firmware files to your phone.\n\ +WARNING: If you're repartitioning it's strongly recommended you specify\n\ + all files at your disposal, including bootloaders.\n\ \n\ action: close-pc-screen\n\ description: Attempts to get rid off the \"connect phone to PC\" screen.\n\ @@ -114,6 +127,10 @@ description: Attempts to dump data from the phone corresponding to the\n\ specified chip type and chip ID.\n\ NOTE: Galaxy S phones don't appear to properly support this functionality.\n\ \n\ +action: print-pit\n\ +description: Dumps the PIT file from the connected device and prints it in\n\ + a human readable format.\n\ +\n\ action: help\n\ description: Display this dialogue.\n"; @@ -200,6 +217,25 @@ bool InterfaceManager::GetArguments(int argc, char **argv, map& // Check if the argument is a valid regular argument for (int i = actionValuelessArgumentCount; i < actionArgumentCount; i++) { + // Support for -- and - parameters. + if (argumentName.length() > 1 && argumentNames[i].compare("-%d") == 0) + { + if (atoi(argumentName.substr(1).c_str()) > 0 || argumentName.compare("-0") == 0) + { + valid = true; + break; + } + } + else if (argumentNames[i].compare("%d") == 0) + { + if (atoi(argumentName.c_str()) > 0 || argumentName.compare("0") == 0) + { + argumentName = "-" + argumentName; + valid = true; + break; + } + } + if (argumentName == argumentNames[i] || argumentName == argumentNames[actionArgumentCount + i]) { argumentName = argumentNames[i]; @@ -213,6 +249,25 @@ bool InterfaceManager::GetArguments(int argc, char **argv, map& // Check if it's a common regular argument for (int i = commonValuelessArgumentCount; i < commonArgumentCount; i++) { + // Support for -- and - parameters. + if (argumentName.length() > 1 && argumentNames[i].compare("-%d")) + { + if (atoi(argumentName.substr(1).c_str()) > 0 || argumentName.compare("-0") == 0) + { + valid = true; + break; + } + } + else if (argumentNames[i].compare("%d")) + { + if (atoi(argumentName.c_str()) > 0 || argumentName.compare("0") == 0) + { + argumentName = "-" + argumentName; + valid = true; + break; + } + } + if (argumentName == commonArgumentNames[i] || argumentName == commonArgumentNames[commonArgumentCount + i]) { argumentName = commonArgumentNames[i]; -- cgit v1.2.3