diff options
author | Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au> | 2013-03-07 14:00:52 +0100 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au> | 2013-03-07 14:12:27 +0100 |
commit | ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768 (patch) | |
tree | 2267ec17efe5435887cb68169a56418acf7a9f05 /heimdall/source/DetectAction.cpp | |
parent | Previous libusbx fix was a red herring of sorts. Inadvertedly it did fix the (diff) | |
download | Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.gz Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.bz2 Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.lz Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.xz Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.zst Heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.zip |
Diffstat (limited to 'heimdall/source/DetectAction.cpp')
-rw-r--r-- | heimdall/source/DetectAction.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/heimdall/source/DetectAction.cpp b/heimdall/source/DetectAction.cpp index 319433f..c5b4eb6 100644 --- a/heimdall/source/DetectAction.cpp +++ b/heimdall/source/DetectAction.cpp @@ -25,10 +25,12 @@ #include "Heimdall.h" #include "Interface.h" +using namespace std; using namespace Heimdall; const char *DetectAction::usage = "Action: detect\n\ Arguments: [--verbose] [--stdout-errors]\n\ + [--usb-log-level <none/error/warning/debug>]\n\ Description: Indicates whether or not a download mode device can be detected.\n"; int DetectAction::Execute(int argc, char **argv) @@ -38,6 +40,7 @@ int DetectAction::Execute(int argc, char **argv) map<string, ArgumentType> argumentTypes; argumentTypes["verbose"] = kArgumentTypeFlag; argumentTypes["stdout-errors"] = kArgumentTypeFlag; + argumentTypes["usb-log-level"] = kArgumentTypeString; Arguments arguments(argumentTypes); @@ -52,9 +55,46 @@ int DetectAction::Execute(int argc, char **argv) if (arguments.GetArgument("stdout-errors") != nullptr) Interface::SetStdoutErrors(true); + const StringArgument *usbLogLevelArgument = static_cast<const StringArgument *>(arguments.GetArgument("usb-log-level")); + + BridgeManager::UsbLogLevel usbLogLevel = BridgeManager::UsbLogLevel::Default; + + if (usbLogLevelArgument) + { + const string& usbLogLevelString = usbLogLevelArgument->GetValue(); + + if (usbLogLevelString.compare("none") == 0 || usbLogLevelString.compare("NONE") == 0) + { + usbLogLevel = BridgeManager::UsbLogLevel::None; + } + else if (usbLogLevelString.compare("error") == 0 || usbLogLevelString.compare("ERROR") == 0) + { + usbLogLevel = BridgeManager::UsbLogLevel::Error; + } + else if (usbLogLevelString.compare("warning") == 0 || usbLogLevelString.compare("WARNING") == 0) + { + usbLogLevel = BridgeManager::UsbLogLevel::Warning; + } + else if (usbLogLevelString.compare("info") == 0 || usbLogLevelString.compare("INFO") == 0) + { + usbLogLevel = BridgeManager::UsbLogLevel::Info; + } + else if (usbLogLevelString.compare("debug") == 0 || usbLogLevelString.compare("DEBUG") == 0) + { + usbLogLevel = BridgeManager::UsbLogLevel::Debug; + } + else + { + Interface::Print("Unknown USB log level: %s\n\n", usbLogLevelString.c_str()); + Interface::Print(DetectAction::usage); + return (0); + } + } + // Download PIT file from device. BridgeManager *bridgeManager = new BridgeManager(verbose); + bridgeManager->SetUsbLogLevel(usbLogLevel); bool detected = bridgeManager->DetectDevice(); |