aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/DetectAction.cpp
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2013-08-14 10:01:22 -0700
committerKoushik Dutta <koushd@gmail.com>2013-08-14 10:01:22 -0700
commit49a02b8c916e8ef011d9f56901d208eca626b85b (patch)
tree1148a42ede0e6661854b8f92d4bbe52a4290d02b /heimdall/source/DetectAction.cpp
parentc82df274ecea32cd6528f070a21528bf80a2f466 (diff)
parentf95619028fa5c80284e6ade2ced7772e41040424 (diff)
downloadexternal_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.zip
external_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.tar.gz
external_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.tar.bz2
Merge remote-tracking branch 'bd/master' into cm-10.2
Conflicts: Linux/README OSX/README.txt heimdall-frontend/doc-pak/README heimdall/doc-pak/README Change-Id: Ib5867d7a2be030290a3896ab82fe48a7f0a97e63
Diffstat (limited to 'heimdall/source/DetectAction.cpp')
-rw-r--r--heimdall/source/DetectAction.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/heimdall/source/DetectAction.cpp b/heimdall/source/DetectAction.cpp
index 319433f..13d8ea1 100644
--- a/heimdall/source/DetectAction.cpp
+++ b/heimdall/source/DetectAction.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012 Benjamin Dobell, Glass Echidna
+/* Copyright (c) 2010-2013 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
@@ -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();