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_device_enumerator_linux.h" | 5 #include "device/serial/serial_device_enumerator_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 |
| 9 #include <memory> |
8 #include <utility> | 10 #include <utility> |
9 | 11 |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
12 | 14 |
13 namespace device { | 15 namespace device { |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 const char kSerialSubsystem[] = "tty"; | 19 const char kSerialSubsystem[] = "tty"; |
18 | 20 |
19 const char kHostPathKey[] = "DEVNAME"; | 21 const char kHostPathKey[] = "DEVNAME"; |
20 const char kHostBusKey[] = "ID_BUS"; | 22 const char kHostBusKey[] = "ID_BUS"; |
21 const char kVendorIDKey[] = "ID_VENDOR_ID"; | 23 const char kVendorIDKey[] = "ID_VENDOR_ID"; |
22 const char kProductIDKey[] = "ID_MODEL_ID"; | 24 const char kProductIDKey[] = "ID_MODEL_ID"; |
23 const char kProductNameKey[] = "ID_MODEL"; | 25 const char kProductNameKey[] = "ID_MODEL"; |
24 | 26 |
25 } // namespace | 27 } // namespace |
26 | 28 |
27 // static | 29 // static |
28 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { | 30 std::unique_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { |
29 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorLinux()); | 31 return std::unique_ptr<SerialDeviceEnumerator>( |
| 32 new SerialDeviceEnumeratorLinux()); |
30 } | 33 } |
31 | 34 |
32 SerialDeviceEnumeratorLinux::SerialDeviceEnumeratorLinux() { | 35 SerialDeviceEnumeratorLinux::SerialDeviceEnumeratorLinux() { |
33 udev_.reset(udev_new()); | 36 udev_.reset(udev_new()); |
34 } | 37 } |
35 | 38 |
36 SerialDeviceEnumeratorLinux::~SerialDeviceEnumeratorLinux() {} | 39 SerialDeviceEnumeratorLinux::~SerialDeviceEnumeratorLinux() {} |
37 | 40 |
38 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { | 41 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { |
39 mojo::Array<serial::DeviceInfoPtr> devices; | 42 mojo::Array<serial::DeviceInfoPtr> devices; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 88 } |
86 if (product_name) | 89 if (product_name) |
87 info->display_name = product_name; | 90 info->display_name = product_name; |
88 devices.push_back(std::move(info)); | 91 devices.push_back(std::move(info)); |
89 } | 92 } |
90 } | 93 } |
91 return devices; | 94 return devices; |
92 } | 95 } |
93 | 96 |
94 } // namespace device | 97 } // namespace device |
OLD | NEW |