Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3205)

Unified Diff: device/serial/serial_device_enumerator_win.cc

Issue 158063002: Use udev for serial device enumeration on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: -___- Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/serial/serial_device_enumerator_win.h ('k') | device/serial/serial_device_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_device_enumerator_win.cc
diff --git a/device/serial/serial_device_enumerator_win.cc b/device/serial/serial_device_enumerator_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e3bde29028202602c7e25aff23275318ddac4d95
--- /dev/null
+++ b/device/serial/serial_device_enumerator_win.cc
@@ -0,0 +1,42 @@
+// Copyright 2014 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 "device/serial/serial_device_enumerator_win.h"
+
+#include <windows.h>
+
+#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/win/registry.h"
+
+namespace device {
+
+// static
+scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() {
+ return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorWin());
+}
+
+SerialDeviceEnumeratorWin::SerialDeviceEnumeratorWin() {}
+
+SerialDeviceEnumeratorWin::~SerialDeviceEnumeratorWin() {}
+
+// TODO(rockot): Query the system for more information than just device paths.
+// This may or may not require using a different strategy than scanning the
+// registry location below.
+void SerialDeviceEnumeratorWin::GetDevices(SerialDeviceInfoList* devices) {
+ devices->clear();
+
+ base::win::RegistryValueIterator iter_key(
+ HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\");
+ for (; iter_key.Valid(); ++iter_key) {
+ base::string16 value(iter_key.Value());
+ linked_ptr<SerialDeviceInfo> info(new SerialDeviceInfo);
+ info->path = WideToASCII(value);
+ devices->push_back(info);
+ }
+}
+
+} // namespace device
« no previous file with comments | « device/serial/serial_device_enumerator_win.h ('k') | device/serial/serial_device_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698