| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/serial/serial_io_handler_win.h" | 5 #include "device/serial/serial_io_handler_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <setupapi.h> | 8 #include <setupapi.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "device/core/device_info_query_win.h" | 13 #include "device/core/device_info_query_win.h" |
| 14 #include "device/core/device_monitor_win.h" | 14 #include "device/core/device_monitor_win.h" |
| 15 #include "third_party/re2/re2/re2.h" | 15 #include "third_party/re2/src/re2/re2.h" |
| 16 | 16 |
| 17 namespace device { | 17 namespace device { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 int BitrateToSpeedConstant(int bitrate) { | 21 int BitrateToSpeedConstant(int bitrate) { |
| 22 #define BITRATE_TO_SPEED_CASE(x) \ | 22 #define BITRATE_TO_SPEED_CASE(x) \ |
| 23 case x: \ | 23 case x: \ |
| 24 return CBR_##x; | 24 return CBR_##x; |
| 25 switch (bitrate) { | 25 switch (bitrate) { |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { | 533 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { |
| 534 // For COM numbers less than 9, CreateFile is called with a string such as | 534 // For COM numbers less than 9, CreateFile is called with a string such as |
| 535 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. | 535 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. |
| 536 if (port_name.length() > std::string("COM9").length()) | 536 if (port_name.length() > std::string("COM9").length()) |
| 537 return std::string("\\\\.\\").append(port_name); | 537 return std::string("\\\\.\\").append(port_name); |
| 538 | 538 |
| 539 return port_name; | 539 return port_name; |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace device | 542 } // namespace device |
| OLD | NEW |