diff options
-rw-r--r-- | tools/battor_agent/BUILD.gn | 2 | ||||
-rw-r--r-- | tools/battor_agent/DEPS | 1 | ||||
-rw-r--r-- | tools/battor_agent/battor_agent.gyp | 2 | ||||
-rw-r--r-- | tools/battor_agent/battor_agent_bin.cc | 24 | ||||
-rw-r--r-- | tools/battor_agent/battor_finder.cc | 39 | ||||
-rw-r--r-- | tools/battor_agent/battor_finder.h | 23 |
6 files changed, 4 insertions, 87 deletions
diff --git a/tools/battor_agent/BUILD.gn b/tools/battor_agent/BUILD.gn index 1a057f3..2f6dd28 100644 --- a/tools/battor_agent/BUILD.gn +++ b/tools/battor_agent/BUILD.gn @@ -28,8 +28,6 @@ source_set("battor_agent_lib") { "battor_connection_impl.cc", "battor_connection_impl.h", "battor_error.h", - "battor_finder.cc", - "battor_finder.h", "battor_sample_converter.cc", "battor_sample_converter.h", ] diff --git a/tools/battor_agent/DEPS b/tools/battor_agent/DEPS index b40de52..67358f38 100644 --- a/tools/battor_agent/DEPS +++ b/tools/battor_agent/DEPS @@ -1,5 +1,4 @@ include_rules = [ "+device/serial", - "+mojo/public", "+net/base", ]
\ No newline at end of file diff --git a/tools/battor_agent/battor_agent.gyp b/tools/battor_agent/battor_agent.gyp index c34c5cd..051f66d 100644 --- a/tools/battor_agent/battor_agent.gyp +++ b/tools/battor_agent/battor_agent.gyp @@ -35,8 +35,6 @@ 'battor_connection_impl.cc', 'battor_connection_impl.h', 'battor_error.h', - 'battor_finder.cc', - 'battor_finder.h', 'battor_sample_converter.cc', 'battor_sample_converter.h', ], diff --git a/tools/battor_agent/battor_agent_bin.cc b/tools/battor_agent/battor_agent_bin.cc index 93036e2..360146d 100644 --- a/tools/battor_agent/battor_agent_bin.cc +++ b/tools/battor_agent/battor_agent_bin.cc @@ -19,7 +19,6 @@ #include "base/threading/thread.h" #include "tools/battor_agent/battor_agent.h" #include "tools/battor_agent/battor_error.h" -#include "tools/battor_agent/battor_finder.h" using std::cout; using std::endl; @@ -48,11 +47,12 @@ void PrintSupportsExplicitClockSync() { cout << battor::BattOrAgent::SupportsExplicitClockSync() << endl; } -// Retrieves argument argnum from the argument list, or an empty string if the -// argument doesn't exist. +// Retrieves argument argnum from the argument list, printing the usage +// guidelines and exiting with an error code if the argument doesn't exist. std::string GetArg(int argnum, int argc, char* argv[]) { if (argnum >= argc) { - return std::string(); + PrintUsage(); + exit(1); } return argv[argnum]; @@ -89,10 +89,6 @@ class BattOrAgentBin : public BattOrAgent::Listener { // Runs the BattOr binary and returns the exit code. int Run(int argc, char* argv[]) { std::string cmd = GetArg(1, argc, argv); - if (cmd.empty()) { - PrintUsage(); - exit(1); - } // SupportsExplicitClockSync doesn't need to use the serial connection, so // handle it separately. @@ -102,18 +98,6 @@ class BattOrAgentBin : public BattOrAgent::Listener { } std::string path = GetArg(2, argc, argv); - // If no path is specified, see if we can find a BattOr and use that. - if (path.empty()) - path = BattOrFinder::FindBattOr(); - - // If we don't have any BattOr to use, exit. - if (path.empty()) { - cout << "Unable to find a BattOr, and no explicit BattOr path was " - "specified." - << endl; - exit(1); - } - SetUp(path); if (cmd == "StartTracing") { diff --git a/tools/battor_agent/battor_finder.cc b/tools/battor_agent/battor_finder.cc deleted file mode 100644 index b0e32db..0000000 --- a/tools/battor_agent/battor_finder.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "tools/battor_agent/battor_finder.h" - -#include "device/serial/serial.mojom.h" -#include "device/serial/serial_device_enumerator.h" -#include "mojo/public/cpp/bindings/array.h" - -namespace battor { - -namespace { - -// The USB display name prefix that all BattOrs have. -const char kBattOrDisplayNamePrefix[] = "BattOr"; - -} // namespace - -// Returns the path of the first BattOr that we find. -std::string BattOrFinder::FindBattOr() { - scoped_ptr<device::SerialDeviceEnumerator> serial_device_enumerator = - device::SerialDeviceEnumerator::Create(); - - mojo::Array<device::serial::DeviceInfoPtr> devices = - serial_device_enumerator->GetDevices(); - - for (size_t i = 0; i < devices.size(); i++) { - std::string display_name = devices[i]->display_name.get(); - - if (display_name.find(kBattOrDisplayNamePrefix) != std::string::npos) { - return devices[i]->path; - } - } - - return std::string(); -} - -} // namespace battor diff --git a/tools/battor_agent/battor_finder.h b/tools/battor_agent/battor_finder.h deleted file mode 100644 index fe6fa79..0000000 --- a/tools/battor_agent/battor_finder.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef TOOLS_BATTOR_AGENT_BATTOR_FINDER_H_ -#define TOOLS_BATTOR_AGENT_BATTOR_FINDER_H_ - -#include <string> - -#include "base/macros.h" - -namespace battor { - -class BattOrFinder { - public: - static std::string FindBattOr(); - - DISALLOW_COPY_AND_ASSIGN(BattOrFinder); -}; - -} // namespace battor - -#endif // TOOLS_BATTOR_AGENT_BATTOR_FINDER_H_ |